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; }
private void btnStopTimer_Click(object sender, EventArgs e) { TimerThread tt = new TimerThread(); if (tt.isTimerRunning()) { tt.PauseTimer(); } else { tt.ContinueTimer(); } }