Пример #1
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
                });
            }
        }
Пример #2
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);
 }
Пример #3
0
 internal void EmitTimerStopped(IEntry <TeaTimerDefinition> entry)
 {
     TimerStopped?.Invoke(this, new TeaTimerEventArgs(entry));
 }
Пример #4
0
        private void StopCounter()
        {
            _timer.Stop();

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