// replay game
        private void button_Replay_Click(object sender, RoutedEventArgs e)
        {
            GameOptions go = new GameOptions(mainWindow, playerOneId, playerTwoId, gameMode);
            this.Hide();
            go.Show();

        }
Exemple #2
0
        // This button checks if player has logged in with a registered user or if it is a guest.
        // If a player is logged in as a guest or registered user then open the Game options window.  
        private void Button_Play_Click(object sender, RoutedEventArgs e)
        {

            if (playerOneValid)
            {

                // GameOptions window is opened with 4 arguments
                // 1. current window, 2. Player Ones ID, 3. Player Twos ID, 4. 1 for One player game / 2 for Two players
                GameOptions go = new GameOptions (this, playerOneUserID, playerTwoUserID, 1);
                this.Hide();
                go.Show();
            }
            else
            {
                MessageBox.Show("Please provide valid Player One credentials.");
            }

        }
        // Button is used to open the GameOptions window only after both Players has logged in as guest or as a registered user
        private void Button_Play_Click(object sender, RoutedEventArgs e)
        {

            if (playerOneValid && playerTwoValid)
            {

                GameOptions go = new GameOptions(this, playerOneUserID, playerTwoUserID, 2);
                this.Hide();
                go.Show();
            }

            else
            {
                MessageBox.Show("Please provide valid Player One credentials.");
            }
        }