Пример #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 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)
            {
                lastSetUserTime          = frm.Timer;
                lblRemainingTime.Content = lastSetUserTime.ToString();
            }
        }
Пример #3
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)
                {
                    lastSetUserTime          = frm.Timer;
                    lblRemainingTime.Content = lastSetUserTime.ToString();
                    return;
                }
            }

            if (timerState == TimerState.Play)
            {
                if (activeTime.TotalSeconds == 0)
                {
                    return;
                }

                imgPlayPause.Source = new BitmapImage(ResourceAccessor.Get("images/icon/white-pause.png"));
                timerState          = TimerState.Pause;
                timer1.IsEnabled    = true;

                timerTime = Convert.ToDateTime(DateTime.Now.Add(activeTime));
            }
            else
            {
                imgPlayPause.Source = new BitmapImage(ResourceAccessor.Get("images/icon/white-play.png"));
                timerState          = TimerState.Play;
                timer1.IsEnabled    = false;
            }
        }