示例#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);
        }
示例#2
0
        public override void Reset()
        {
            current = taskTime;
            RepeatTimeLeft.Value = RepeatTime;

            ResetToDestination(current);
        }
示例#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();
                }
            });
        }
示例#4
0
 void ResetToDestination(TimerTime destination)
 {
     Hour = destination.Hour;
     Minute = destination.Minute;
     Second = destination.Second;
 }