Пример #1
0
 private void CancelGameButton_Click(object sender, EventArgs e)
 {
     if (TwentyOne_Game.GetNumOfGamesWon(0) > TwentyOne_Game.GetNumOfGamesWon(1))            // If player wins
     {
         MessageBox.Show("You won! Well done.");                                             // Show message
         TwentyOne_Game.ResetTotals();                                                       // Reset points and games
         this.Hide();                                                                        // Close window
         First_GUI_Form GameForm = new First_GUI_Form();                                     // Open initial window
         GameForm.Closed += (s, args) => this.Close();                                       // Dispose this form together when the other is closed
         GameForm.Show();                                                                    // Show the initial menu
     }
     else if (TwentyOne_Game.GetNumOfGamesWon(0) < TwentyOne_Game.GetNumOfGamesWon(1))       // If dealer wins
     {
         MessageBox.Show("House won! Better luck next time.");                               // " "
         TwentyOne_Game.ResetTotals();
         this.Hide();
         First_GUI_Form GameForm = new First_GUI_Form();
         GameForm.Closed += (s, args) => this.Close();
         GameForm.Show();
     }
     else                                                                                    // If it was a draw
     {
         MessageBox.Show("It was a draw!");
         TwentyOne_Game.ResetTotals();
         this.Hide();
         First_GUI_Form GameForm = new First_GUI_Form();
         GameForm.Closed += (s, args) => this.Close();
         GameForm.Show();
     }
 }
        private void NoRadio_CheckedChanged(object sender, EventArgs e)
        {
            DialogResult result = MessageBox.Show("Do you want to exit?", "Quit?", MessageBoxButtons.YesNo, MessageBoxIcon.Question);

            if (result == DialogResult.Yes)
            {
                this.Hide();
                First_GUI_Form GameForm = new First_GUI_Form();
                GameForm.Closed += (s, args) => this.Close();
                GameForm.Show();
            }
        }
Пример #3
0
        private void ExitButton_Click(object sender, EventArgs e)
        {
            DialogResult result = MessageBox.Show("Do you really want to quit?", "Quit?", MessageBoxButtons.YesNo, MessageBoxIcon.Question);

            if (result == DialogResult.Yes)
            {
                this.Hide();
                First_GUI_Form GameForm = new First_GUI_Form();
                GameForm.Closed += (s, args) => this.Close();
                GameForm.Show();
            }
        }