private void Timer1_Tick(object sender, EventArgs e) { if (timeleft > 0) { timeleft--; timer.Text = timeleft.ToString(); } if (timeleft == 0) { DONE.Enabled = false; START.Enabled = true; timer1.Stop(); timer.Text = ""; const string msg = "You ran out of time! Try again?"; const string caption = "GAME OVER!"; var result = MessageBox.Show(msg, caption, MessageBoxButtons.YesNo, MessageBoxIcon.Error); if (result == DialogResult.Yes) { DONE.Enabled = false; START.Enabled = true; START.PerformClick(); textBox1.Text = ""; } if (result == DialogResult.No) { Application.Exit(); } } }
private void Dialog() { timer1.Stop(); const string msg = "Wrong answer! Try again?"; const string caption = "GAME OVER!"; var result = MessageBox.Show(msg, caption, MessageBoxButtons.YesNo, MessageBoxIcon.Error); if (result == DialogResult.Yes) { DONE.Enabled = false; START.Enabled = true; START.PerformClick(); textBox1.Text = ""; } if (result == DialogResult.No) { Application.Exit(); } }