void _hourglassTimer_Tick(object sender, TickEventArgs e) { var clockRunningEventArgs = new ClockRunningHandlerArgs() { Elapsed_ms = e.Elapsed_ms, Remaining_ms = (int)this.Duration.WorkDuration.TotalMilliseconds - e.Elapsed_ms }; switch (Mode) { case Mode.Idle: clockRunningEventArgs = null; break; case Mode.Work: if (Working != null) Working(this, clockRunningEventArgs); break; case Mode.ShortBreak: if (ShortBreaking != null) ShortBreaking(this, clockRunningEventArgs); break; case Mode.LongBreak: if (LongBreaking != null) LongBreaking(this, clockRunningEventArgs); break; default: break; } }
void Clock_Working(object sender, ClockRunningHandlerArgs e) { this.TimeRemaining = TimeSpan.FromMilliseconds(e.Remaining_ms); }