Beispiel #1
0
 private void OnTimerStopped(TimerStopped @event)
 {
     if (@event.IsIntervalCompleted && userPreferences.PlaySoundNotifications)
     {
         intervalCompletedNotification.Play();
     }
 }
Beispiel #2
0
 private void OnTimerStopped(TimerStopped timerStopped)
 {
     if (timerStopped.IntervalType == IntervalType.Pomodoro && timerStopped.IsIntervalCompleted)
     {
         PomodoroCompleted(timerStopped.Duration);
     }
 }
 private void OnTimerStopped(TimerStopped @event)
 {
     if (@event.IsIntervalCompleted && userPreferences.ShowToastNotifications)
     {
         var toast = Toasts.IntervalCompleted(@event.IntervalType, pomodoroEngine.SuggestedBreakType);
         toast.Activated += OnToastActivated;
         toastNotifier.Show(toast);
     }
 }
Beispiel #4
0
 private void OnTimerStopped(TimerStopped @event)
 {
     if (@event.IsIntervalCompleted)
     {
         EnterState(GetCompletedIntervalStateFor(@event.IntervalType), @event.RemainingTime);
     }
     else
     {
         EnterState(GetTimerInterruptedStateFor(@event.IntervalType), @event.RemainingTime);
     }
 }
 private void OnTimerStopped(TimerStopped timerStopped)
 {
     menu.Update(mutator =>
     {
         mutator.UpdateRemainingTime(Duration.Zero.ToTimeString());
         mutator.EnableStartPomodoroItem(true);
         mutator.EnableStartShortBreakItem(true);
         mutator.EnableStartLongBreakItem(true);
         mutator.EnableStopTimerItem(false);
     });
 }
Beispiel #6
0
        private void OnTimerStopped(TimerStopped @event)
        {
            if (@event.IsIntervalCompleted && userPreferences.ShowToastNotifications)
            {
                var toast = Toasts.IntervalCompleted(@event.IntervalType, pomodoroEngine.SuggestedBreakType);

                TimerWindow.DispatcherUi.BeginInvoke(new System.Action
                                                         (() => toastNotifier.Show(toast))
                                                     );
            }
        }
Beispiel #7
0
        public void Publish_PomodoroCompleted_event_when_timer_stops_with_zero_remaining_time()
        {
            var remainingTime          = Duration.Zero;
            var duration               = Duration.InMinutes(25);
            var pomodoroCompletedEvent = new TimerStopped(IntervalType.Pomodoro, duration, remainingTime);

            eventHub.Publish(pomodoroCompletedEvent);

            var pomodoroCompleted = eventHub.PublishedEvents <PomodoroCompleted>().Single();

            Assert.AreEqual(duration, pomodoroCompleted.Duration);
        }
Beispiel #8
0
        /// <summary>
        /// Handles one tick of the timer that repeats itself until
        /// the clock rings. It substracts a second from the current
        /// value and stops the timer if it's the case, and starts
        /// the ringing timer, and invokes the TimerStopped event.
        /// </summary>
        internal void HandleTick()
        {
            SubstractSeconds(1);

            if (GetSeconds() == 0)
            {
                Running = false;
                t2.Start();
                TimerStopped?.Invoke(this, new ClockEventArgs()
                {
                    Clock = this
                });
            }
        }
Beispiel #9
0
 public void End(bool update = true)
 {
     if (!Running)
     {
         throw new Exception("Ending timer before starting it");
     }
     FinishTime   = DateTime.Now;
     _elapsedTime = (FinishTime.Value - StartTime.Value).TotalSeconds;
     if (update)
     {
         Record.WorkedTime += _elapsedTime;
     }
     TimerStopped?.Invoke(this, EventArgs.Empty);
 }
Beispiel #10
0
 internal void EmitTimerStopped(IEntry <TeaTimerDefinition> entry)
 {
     TimerStopped?.Invoke(this, new TeaTimerEventArgs(entry));
 }
 private void OnTimerStopped(TimerStopped @event)
 {
     notifyIcon.Icon = Properties.Resources.icon_tomato_white;
 }
        private void StopCounter()
        {
            _timer.Stop();

            TimerStopped?.Invoke(this, new TimerElapsedEventArgs());
        }