Пример #1
0
 private void StageTimerOnTimeChanged(object sender, TickEventArgs tickEventArgs)
 {
     if (tickEventArgs.TimesUp)
     {
         TimerLbl.Content = "Time's Up";
         StatisticsUpdate();
         SetStartStopBtnAsStart();
         TaskbarItemInfo.ProgressState = TaskbarItemProgressState.None;
     }
     else
     {
         TimerLbl.Content = tickEventArgs.TimeLeft.ToString(@"mm\:ss");
         var x = TimeSpan.Parse(_stagesValues[_currentStage]); // Current time
         // Converts the ratio of total time and past time to [0-1] range
         // and makes the progress bar moving from 0 to 1 instead of 1 to 0.
         TaskbarItemInfo.ProgressValue = 1-(tickEventArgs.TimeLeft.TotalSeconds /
                                          x.TotalSeconds);
     }
 }
Пример #2
0
 private void PauseTimerOnTimeChanged(object sender, TickEventArgs tickEventArgs)
 {
     PauseTimerLbl.Content = tickEventArgs.TimeLeft.ToString(@"mm\:ss");
 }
Пример #3
0
 protected virtual void OnTimeChange(TickEventArgs e)
 {
     TimeChanged?.Invoke(this, e); // Inform about event if we have listeners
 }