private void IntervalBox_TextChanged(object sender, EventArgs e) { if (SleepTimer.Enabled) { SleepTimer.Stop(); } }
private bool validate() { SleepTimer.Stop(); string message = "Your Input Is Not Number"; string caption; MessageBoxButtons buttons = MessageBoxButtons.OK; if (!int.TryParse(inputTextBox.Text, out int n) || int.Parse(inputTextBox.Text) <= 0 || !int.TryParse(IntervalBox.Text, out int m) || int.Parse(IntervalBox.Text) <= 0) { caption = "Error Detected in Input"; DialogResult result; result = MessageBox.Show(message, caption, buttons); if (result == System.Windows.Forms.DialogResult.OK) { this.Refresh(); return(false); } } if (int.Parse(inputTextBox.Text) > 70) { caption = "Your Number Is Too Big"; DialogResult result; result = MessageBox.Show(message, caption, buttons); if (result == System.Windows.Forms.DialogResult.OK) { this.Refresh(); return(false); } } return(true); }
private void StopButton_Click(object sender, EventArgs e) { SleepTimer.Stop(); }