private void Updater_UpdateStateChanged(object sender, UpdateStateEventArgs e) { switch (e.NewState) { //Апдейтер ничего не делает. Так же переключается в этот режим, чтобы сбросить текущее состояние. Например, после //Completed сразу же срабатывает None. case UpdateState.None: break; case UpdateState.Checking: //Проверяет наличие обновлений playButton.IsEnabled = false; break; case UpdateState.NotNeeded: //Обновление не требуется playButton.IsEnabled = true; progressBar.Visibility = Visibility.Hidden; playButton.Content = "PLAY"; break; case UpdateState.Started: //Обновление запущено playButton.IsEnabled = false; progressBar.Visibility = Visibility.Visible; playButton.Content = "UPDATE"; break; case UpdateState.Completed: //Обновление успешно завершено playButton.IsEnabled = true; progressBar.Visibility = Visibility.Hidden; playButton.Content = "PLAY"; break; default: throw new ArgumentOutOfRangeException(); } }
private void Updater_UpdateStateChanged(object sender, UpdateStateEventArgs e) { ResourceProvider resource = ResourceProvider.Instance; switch (e.NewState) { case UpdateState.None: infoDownload.Visibility = Visibility.Hidden; break; case UpdateState.Checking: //checking for update playButton.IsEnabled = false; break; case UpdateState.NotNeeded: //update not needed playButton.IsEnabled = true; this.ProgressBar1.NotNeeded(); ProgressBar1.Visibility = Visibility.Hidden; playButton.Content = resource.Get(TextResource.PLAY); break; case UpdateState.Started: //update start FancyBalloon updateStart = new FancyBalloon(); updateStart.BalloonMessage = resource.Get(TextResource.UPDSTART); tb.ShowCustomBalloon(updateStart, PopupAnimation.Slide, 5000); infoDownload.Visibility = Visibility.Visible; playButton.IsEnabled = false; this.ProgressBar1.Visibility = Visibility.Visible; playButton.Content = resource.Get(TextResource.UPDATING); break; case UpdateState.Completed: //update success FancyBalloon balloon = new FancyBalloon(); balloon.BalloonMessage = resource.Get(TextResource.UPDCOMPLETE); tb.ShowCustomBalloon(balloon, PopupAnimation.Slide, 5000); infoDownload.Visibility = Visibility.Hidden; playButton.IsEnabled = true; this.ProgressBar1.Complete(); playButton.Content = resource.Get(TextResource.PLAY); Logger.Current.AppendText("Mise à jour terminée avec succès"); break; default: throw new ArgumentOutOfRangeException(); } }