private void AutoUpdater_OnUpdaterStatusChanged(AutoUpdater.State newStatus) { UpdaterPresentation.GetSingleton().Dispatcher.Invoke(DispatcherPriority.Normal, (SendOrPostCallback) delegate { UpdaterStateChanged(newStatus); }, null); if (newStatus == State.UpdateAvailable && Settings.Default.AutoDownload) { if (downloadRetry < 3) { Download(); downloadRetry++; } else { GuiLogMessage("AutoUpdate: Auto download failed, try again later.", NotificationLevel.Warning); } } }
void MainWindow_OnUpdaterStateChanged(AutoUpdater.State newStatus) { switch (newStatus) { case AutoUpdater.State.Idle: NoUpdateButtonImage(); AutoUpdaterIconImageRotating = false; SetUpdaterToolTip(Properties.Resources.No_update_available_); break; case AutoUpdater.State.Checking: NoUpdateButtonImage(); AutoUpdaterIconImageRotating = true; SetUpdaterToolTip(Properties.Resources.Checking_for_updates___); break; case AutoUpdater.State.UpdateAvailable: Dispatcher.Invoke(DispatcherPriority.Normal, (SendOrPostCallback) delegate { updateDownloadBar.Visibility = Visibility.Hidden; }, null); UpdateButtonImage(); AutoUpdaterIconImageRotating = false; SetUpdaterToolTip(Properties.Resources.Update_available_); MainWindow_OnUpdateDownloadProgressChanged(0); if (!Settings.Default.AutoDownload) { Dispatcher.Invoke(DispatcherPriority.Normal, (SendOrPostCallback) delegate { AutoUpdater_Executed(null, null); }, null); } break; case AutoUpdater.State.Downloading: UpdateButtonImage(); AutoUpdaterIconImageRotating = true; SetUpdaterToolTip(Properties.Resources.Downloading_update___); Dispatcher.Invoke(DispatcherPriority.Normal, (SendOrPostCallback) delegate { updateDownloadBar.Visibility = Visibility.Visible; }, null); break; case AutoUpdater.State.UpdateReady: Dispatcher.Invoke(DispatcherPriority.Normal, (SendOrPostCallback) delegate { updateDownloadBar.Visibility = Visibility.Hidden; }, null); UpdateReadyButtonImage(); AutoUpdaterIconImageRotating = false; SetUpdaterToolTip(Properties.Resources.Update_ready_to_install_); if (!Settings.Default.AutoInstall) { Dispatcher.Invoke(DispatcherPriority.Normal, (SendOrPostCallback) delegate { AutoUpdater_Executed(null, null); }, null); } break; } }