Ejemplo n.º 1
0
        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;
            }
        }
Ejemplo n.º 2
0
 void Clock_Working(object sender, ClockRunningHandlerArgs e)
 {
     this.TimeRemaining = TimeSpan.FromMilliseconds(e.Remaining_ms);
 }