Ejemplo n.º 1
0
        private void btnStartTimer_Click(object sender, EventArgs e)
        {
            TimerThread tt = new TimerThread();
            Thread timerThread = new Thread(new ThreadStart(tt.StartTimer));

            if (!string.IsNullOrWhiteSpace(txtTime.Text))
            {
                int timerLength = -1;
                if (int.TryParse(txtTime.Text, out timerLength))
                    tt.timerLength = timerLength * 1000;
            }

            timerThread.Start();
            timerThread.IsBackground = true;
        }
Ejemplo n.º 2
0
        private void btnStopTimer_Click(object sender, EventArgs e)
        {
            TimerThread tt = new TimerThread();

            if (tt.isTimerRunning())
            {
                tt.PauseTimer();
            }
            else
            {
                tt.ContinueTimer();
            }
        }