public static int ShowInputDialog(Form parent, string title, string message) { if (dialog == null) { dialog = new NumericInputDialog(); } dialog.Text = (title.Length > 0)? title : dialog.Text; dialog.lbMessage.Text = message; if (dialog.ShowDialog(parent) == DialogResult.OK) { return((int)dialog.time.Value); } throw new DialogCancelResultException("The user cancelled the operation"); }
private void cbHideCountdown_CheckedChanged(object sender, EventArgs e) { bool isChecked = ((CheckBox)sender).Checked; if (isChecked && !isHideConfirmed) { ((CheckBox)sender).Checked = false; try { int time = NumericInputDialog.ShowInputDialog(this, "Choose Time", "What Time Do You Want The Countdown Window To Appear"); isHideConfirmed = true; invisibilityTimeout = time; ((CheckBox)sender).Checked = true; MessageBox.Show(this, "Countdown window will reappear in " + time + " seconds.", "Notice!"); }catch (DialogCancelResultException arg) { } } else { isHideConfirmed = false; } }