mirror of
https://github.com/microsoft/PowerToys.git
synced 2026-04-10 21:41:51 +02:00
Removing update logic from PowerLuanch App.xaml.cs as was done in Wox project.
This commit is contained in:
@@ -26,7 +26,6 @@ namespace PowerLauncher
|
||||
private Settings _settings;
|
||||
private MainViewModel _mainVM;
|
||||
private SettingWindowViewModel _settingsVM;
|
||||
private readonly Updater _updater = new Updater(PowerLauncher.Properties.Settings.Default.GithubRepo);
|
||||
private readonly Alphabet _alphabet = new Alphabet();
|
||||
private StringMatcher _stringMatcher;
|
||||
|
||||
@@ -54,7 +53,7 @@ namespace PowerLauncher
|
||||
|
||||
ImageLoader.Initialize();
|
||||
|
||||
_settingsVM = new SettingWindowViewModel(_updater);
|
||||
_settingsVM = new SettingWindowViewModel();
|
||||
_settings = _settingsVM.Settings;
|
||||
|
||||
_alphabet.Initialize(_settings);
|
||||
@@ -84,37 +83,16 @@ namespace PowerLauncher
|
||||
|
||||
RegisterExitEvents();
|
||||
|
||||
AutoStartup();
|
||||
AutoUpdates();
|
||||
|
||||
_mainVM.MainWindowVisibility = _settings.HideOnStartup ? Visibility.Hidden : Visibility.Visible;
|
||||
Log.Info("|App.OnStartup|End Wox startup ---------------------------------------------------- ");
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
private void AutoStartup()
|
||||
{
|
||||
}
|
||||
|
||||
//[Conditional("RELEASE")]
|
||||
private void AutoUpdates()
|
||||
{
|
||||
Task.Run(async () =>
|
||||
{
|
||||
if (_settings.AutoUpdates)
|
||||
{
|
||||
// check udpate every 5 hours
|
||||
var timer = new Timer(1000 * 60 * 60 * 5);
|
||||
timer.Elapsed += async (s, e) =>
|
||||
{
|
||||
await _updater.UpdateApp();
|
||||
};
|
||||
timer.Start();
|
||||
|
||||
// check updates on startup
|
||||
await _updater.UpdateApp();
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user