Exemplo n.º 1
0
        void SwitchTimer()
        {
            if (current == taskTime)
            {
                RepeatTimeLeft.Value--;
                if (RepeatTimeLeft.Value <= 0)
                {
                    current = longBreakTime;
                }
                else
                {
                    current = breakTime;
                }
            }
            else if (current == breakTime)
            {
                current = taskTime;
            }
            else if (current == longBreakTime)
            {
                Stop();
                Reset();
                Phase.Value = TimerPhase.IsIdle;

                return;
            }

            Stop();
            ResetToDestination(current);
        }
Exemplo n.º 2
0
        public override void Reset()
        {
            current = taskTime;
            RepeatTimeLeft.Value = RepeatTime;

            ResetToDestination(current);
        }
Exemplo n.º 3
0
        public PomodoroTimer(TimerTime taskTime, TimerTime breakTime, int repeat, TimerTime longBreakTime) : base()
        {
            this.taskTime = taskTime;
            this.breakTime = breakTime;
            this.RepeatTime = repeat;
            this.longBreakTime = longBreakTime;

            Reset();

            CountdownEnd.Subscribe(x =>
            {
                if (x)
                {
                    SwitchTimer();
                }
            });
        }
Exemplo n.º 4
0
 void ResetToDestination(TimerTime destination)
 {
     Hour = destination.Hour;
     Minute = destination.Minute;
     Second = destination.Second;
 }