private void Worker_DoWork(object sender, DoWorkEventArgs e) { IUpdateService updateService = e.Argument as IUpdateService; string version = Assembly.GetExecutingAssembly().GetName().Version.ToString(); UpdateResult result = updateService.CheckForUpdates(Settings.Default.ProductCode, version); e.Result = result; return; }
private async Task UpdatesCheck() { try { string?newUpdateUrl = await updateService.CheckForUpdates(); if (newUpdateUrl != null) { if (settingsProvider.Settings.EnableSilentUpdates) { DownloadUpdate(); statusBar.PublishNotification(new PlainNotification(NotificationType.Info, "Downloading update...")); } else { if (await messageBoxService.ShowDialog(new MessageBoxFactory <bool>() .SetTitle("New update") .SetMainInstruction("A new update is ready to be downloaded") .SetContent("Do you want to download the update now?") .WithYesButton(true) .WithNoButton(false) .SetIcon(MessageBoxIcon.Information) .Build())) { DownloadUpdate(); } else { statusBar.PublishNotification(new PlainNotification(NotificationType.Info, "New updates are ready to download. Click to download.", new DelegateCommand(DownloadUpdate))); } } } } catch (Exception e) { statusBar.PublishNotification(new PlainNotification(NotificationType.Error, "Error while checking for the updates: " + e.Message)); } }
private async Task UpdatesCheck() { try { string?newUpdateUrl = await updateService.CheckForUpdates(); if (newUpdateUrl != null) { statusBar.PublishNotification(new PlainNotification(NotificationType.Info, "New updates are ready to download. Click to download.", new DelegateCommand(() => { statusBar.PublishNotification( new PlainNotification(NotificationType.Info, "Downloading...")); DownloadUpdate(); }))); } } catch (Exception e) { statusBar.PublishNotification(new PlainNotification(NotificationType.Error, "Error while checking for the updates: " + e.Message)); } }