예제 #1
0
        private void PlayPause()
        {
            TimeSpan activeTime = TimeSpan.Parse(lblRemainingTime.Content.ToString());

            if (activeTime.TotalSeconds == 0)
            {
                WindowSetTimer frm = new WindowSetTimer(activeTime);
                Session.IsSetTimer = false;
                frm.ShowDialog();
                if (Session.IsSetTimer)
                {
                    LastCountdown            = frm.Timer;
                    lblRemainingTime.Content = LastCountdown.ToString();
                    return;
                }
            }

            if (timerState == TimerState.Play)
            {
                if (activeTime.TotalSeconds == 0)
                {
                    return;
                }
                timerState = TimerState.Pause;
                PlayPauseSetBackround();
                timer1.IsEnabled = true;
                timerTime        = Convert.ToDateTime(DateTime.Now.Add(activeTime));
            }
            else
            {
                timerState = TimerState.Play;
                PlayPauseSetBackround();
                timer1.IsEnabled = false;
            }
        }
예제 #2
0
        private void BtnReset_Click(object sender, RoutedEventArgs e)
        {
            lblRemainingTime.Content = LastCountdown.ToString(@"hh\:mm\:ss");
            TimeSpan activeTime = TimeSpan.Parse(lblRemainingTime.Content.ToString());

            timerTime = Convert.ToDateTime(DateTime.Now.Add(activeTime));

            if (timerState == TimerState.Pause)
            {
                GetDefaultSettings();
                PlayPause();
            }
        }
예제 #3
0
        private void SetTimer()
        {
            if (timerState == TimerState.Pause)
            {
                PlayPause();
            }

            TimeSpan       activeTime = TimeSpan.Parse(lblRemainingTime.Content.ToString());
            WindowSetTimer frm        = new WindowSetTimer(activeTime);

            Session.IsSetTimer = false;
            frm.ShowDialog();

            if (Session.IsSetTimer)
            {
                LastCountdown            = frm.Timer;
                lblRemainingTime.Content = LastCountdown.ToString();
            }
        }