Exemplo n.º 1
0
        public static void TimerElapsed(MasterViewModel m)
        {
            // TODO: Inline timerUp and negate
            bool timerUp = (m.TimeLeft - 1) < 0;

            if (!timerUp)
            {
                --m.TimeLeft;
            }
            else
            {
                PauseTimer(m.Timer);

                if ((m.TurnsLeft - 1) <= 0)
                {
                    m.TimeForBreak = true;
                }
                else
                {
                    --m.TurnsLeft;

                    m.TimeForBreak = false;
                }

                m.NextPersonCommand.Execute(null);

                m.RaiseTimerUp();
            }
        }
Exemplo n.º 2
0
        public static void Increment(bool positive, string prop, MasterViewModel model)
        {
            int num = 0;

            if (positive)
            {
                num = 1;
            }
            else
            {
                num = -1;
            }

            switch (prop)
            {
            case nameof(model.TurnMinutes):
                model.TurnMinutes += num;
                break;

            case nameof(model.BreakMinutes):
                model.BreakMinutes += num;
                break;

            case nameof(model.TurnsTillBreak):
                model.TurnsTillBreak += num;
                break;
            }
        }
Exemplo n.º 3
0
        public static void ResetTimer(MasterViewModel model)
        {
            model.Timer.Stop();

            int time = 0;

            if (model.TimeForBreak)
            {
                time = model.BreakMinutes * 60;

                ResetBreaks(model);
            }
            else
            {
                time = model.TurnMinutes * 60;
            }

            model.TimeLeft = time;
        }
Exemplo n.º 4
0
 public static void ResetBreaks(MasterViewModel model)
 {
     model.TurnsLeft    = model.TurnsTillBreak;
     model.TimeForBreak = false;
 }