/// <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 }); } }
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); }
internal void EmitTimerStopped(IEntry <TeaTimerDefinition> entry) { TimerStopped?.Invoke(this, new TeaTimerEventArgs(entry)); }
private void StopCounter() { _timer.Stop(); TimerStopped?.Invoke(this, new TimerElapsedEventArgs()); }