protected override async void OnViewLoaded() { base.OnViewLoaded(); // Load settings _settingsService.Load(); // Check and prepare update try { var updateVersion = await _updateService.CheckPrepareUpdateAsync(); if (updateVersion != null) { // Show notification Notifications.Enqueue( $"Update to YoutubeDownloader v{updateVersion} will be installed when you exit", "INSTALL NOW", () => { _updateService.FinalizeUpdate(true); RequestClose(); }); } } catch { Notifications.Enqueue("Failed to perform application auto-update"); } }
protected override async void OnViewLoaded() { base.OnViewLoaded(); // Load settings _settingsService.Load(); // Get last token if (_settingsService.LastToken != null) { IsBotToken = _settingsService.LastToken.Type == AuthTokenType.Bot; TokenValue = _settingsService.LastToken.Value; } // Check and prepare update try { var updateVersion = await _updateService.CheckPrepareUpdateAsync(); if (updateVersion != null) { Notifications.Enqueue( $"Update to DiscordChatExporter v{updateVersion} will be installed when you exit", "INSTALL NOW", () => { _updateService.FinalizeUpdate(true); RequestClose(); }); } } catch { Notifications.Enqueue("Failed to perform application auto-update"); } }
protected override async void OnViewLoaded() { base.OnViewLoaded(); // Load settings _settingsService.Load(); // Load last recommendations Recommendations = _cacheService.RetrieveOrDefault <IReadOnlyList <Recommendation> >("LastRecommendations"); // Check and prepare update try { var updateVersion = await _updateService.CheckPrepareUpdateAsync(); if (updateVersion != null) { Notifications.Enqueue($"Update to osu!helper v{updateVersion} will be installed when you exit", "INSTALL NOW", () => { _updateService.FinalizeUpdate(true); RequestClose(); }); } } catch { Notifications.Enqueue("Failed to perform application auto-update"); } }
public RootViewModel( IViewModelFactory viewModelFactory, DialogManager dialogManager, SettingsService settingsService, UpdateService updateService) { _viewModelFactory = viewModelFactory; _dialogManager = dialogManager; _settingsService = settingsService; Core = viewModelFactory.CreateCoreViewModel(); DisplayName = $"{App.Name} v{App.VersionString}"; _checkForUpdatesTimer = new AutoResetTimer(async() => await updateService.CheckPrepareUpdateAsync()); }
public RootViewModel( IViewModelFactory viewModelFactory, DialogManager dialogManager, SettingsService settingsService, UpdateService updateService) { _viewModelFactory = viewModelFactory; _dialogManager = dialogManager; _settingsService = settingsService; Dashboard = viewModelFactory.CreateDashboardViewModel(); DisplayName = $"{App.Name} v{App.VersionString}"; _checkForUpdatesTimer = new Timer( TimeSpan.FromHours(3), async() => await updateService.CheckPrepareUpdateAsync() ); }
protected override async void OnViewLoaded() { base.OnViewLoaded(); // Check for updates var updateVersion = await _updateService.CheckPrepareUpdateAsync(); // If there are updates - notify the user and ask them if they want them installed immediately if (updateVersion != null) { // Show notification Notifications.Enqueue($"Update to YoutubeDownloader v{updateVersion} will be installed when you exit", "INSTALL NOW", () => { _updateService.FinalizeUpdate(true); RequestClose(); }); } }
public RootViewModel(IViewModelFactory viewModelFactory, DialogManager dialogManager, SettingsService settingsService, UpdateService updateService, GammaService gammaService, HotKeyService hotKeyService, RegistryService registryService, ExternalApplicationService externalApplicationService, SystemEventService systemEventService) { _viewModelFactory = viewModelFactory; _dialogManager = dialogManager; _settingsService = settingsService; _updateService = updateService; _gammaService = gammaService; _hotKeyService = hotKeyService; _registryService = registryService; _externalApplicationService = externalApplicationService; _systemEventService = systemEventService; // Title DisplayName = $"{App.Name} v{App.VersionString}"; // Cancel 'disable temporarily' when switched on this.Bind(o => o.IsEnabled, (sender, args) => { if (IsEnabled) { _enableAfterDelayTimer.Stop(); } }); // Initialize timers _updateConfigurationTimer = new AutoResetTimer(UpdateConfiguration); _updateInstantTimer = new AutoResetTimer(UpdateInstant); _updateIsPausedTimer = new AutoResetTimer(UpdateIsPaused); _checkForUpdatesTimer = new AutoResetTimer(async() => await _updateService.CheckPrepareUpdateAsync()); _pollingTimer = new AutoResetTimer(PollGamma); _enableAfterDelayTimer = new ManualResetTimer(Enable); // Reset gamma when power settings change _systemEventService.DisplayStateChanged += (sender, args) => InvalidateGamma(); SystemEvents.DisplaySettingsChanging += (sender, args) => InvalidateGamma(); SystemEvents.DisplaySettingsChanged += (sender, args) => InvalidateGamma(); }