Пример #1
0
        /// <summary>
        /// Called when timer tick event raises.
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void OnTimerTick(object sender, EventArgs e)
        {
            _counter++;
            int seconds = _duration * 60 - _counter;

            RemainingTime = BreakTimerHelper.GetFormattedTimeFromSeconds(seconds);
            if (seconds == 0)
            {
                StopTimerCommand.Execute(null);
            }
        }
        /// <summary>
        /// Timer tick event.
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void OnTimerTick(object sender, EventArgs e)
        {
            _counter++;
            int seconds = BreakTimer.Frequency * 60 - _counter;

            RemainingTime = BreakTimerHelper.GetFormattedTimeFromSeconds(seconds);
            if (UserIdleHelper.GetLastInputTime() == BreakTimer.IdleResetTime * 60 && BreakTimer.IsIdleResetActive)
            {
                StopTimerCommand.Execute(null);
            }
            else if (seconds == BreakTimer.NextBreakAlert)
            {
                StopTimerCommand.Execute(null);
                if (BreakTimer.NextBreakAlert != 0)
                {
                    NotifyNextBreak(BreakTimer.NextBreakAlert);
                }
                else
                {
                    StartRelaxation();
                }
            }
        }