private void Iteration_Tick(object sender, StutterTimerEvent e) { double progressRatio = e.Elapsed.TotalSeconds / e.Total.TotalSeconds; // Update the progress bar in the application. PhraseProgressBar.Value = PhraseProgressBar.Maximum * progressRatio; // Update the progress bar in the taskbar. [0-1] // Display green during a phrase and red during a block. TaskbarItemInfo.ProgressState = (e.State == StutterTimedState.Phrase) ? TaskbarItemProgressState.Normal : TaskbarItemProgressState.Error; TaskbarItemInfo.ProgressValue = progressRatio; // Update the text string. PhraseProgressLabel.Content = e.State.ToString() + " — " + e.Total.Subtract(e.Elapsed).ToString(@"mm\:ss") + " Remaining"; }
private void Iteration_Complete(object sender, StutterTimerEvent e) { PhraseProgressBar.Value = PhraseProgressBar.Maximum; switch (e.State) { case StutterTimedState.Block: // Handle iteration completion. PhraseProgressLabel.Content = "Iteration Complete"; TryPlaySound(Properties.Resources.StartWork); StartNextIteration(); break; case StutterTimedState.Phrase: // Handle phrase completion. // TODO: Reverse fill direction and stuff. TryPlaySound(Properties.Resources.StopWork); Iteration.BeginBlock(); // Display a visual alert if the user has hidden the application. NotificationHelper.CreateNotificiation(this, "The current phrase has ended. Take a short break.", "Phrase Ended"); // Update the task list with new values. RefreshTaskList(); break; default: break; } RefreshGoal(); }