示例#1
0
        /// <summary>
        /// The check victory.
        /// </summary>
        private void CheckVictory()
        {
            if (this.player1ScoreCount == this.player2ScoreCount && this.player1ScoreCount == 13)
            {
                if (this.player1TotalSum > this.player2TotalSum)
                {
                    MessageBox.Show("Player 1 WON !!!");
                }
                else if (this.player1TotalSum < this.player2TotalSum)
                {
                    MessageBox.Show("Player 2 WON !!!");
                }
                else
                {
                    MessageBox.Show("DRAW !!!");
                }

                MessageBoxResult messageBoxResult = MessageBox.Show("Do you want to play new game?", "Victory", System.Windows.MessageBoxButton.YesNo);
                if (messageBoxResult == MessageBoxResult.Yes)
                {
                    TwoPlayersWindow twoPlayersWindow = new TwoPlayersWindow();
                    twoPlayersWindow.Left = this.Left;
                    twoPlayersWindow.Top  = this.Top;
                    this.Close();
                    twoPlayersWindow.Show();
                }
                else
                {
                    this.Close();
                }
            }
        }
示例#2
0
        /// <summary>
        /// The button two players click.
        /// </summary>
        /// <param name="sender">
        /// The sender.
        /// </param>
        /// <param name="e">
        /// The e.
        /// </param>
        private void BtnTwoPlayersClick(object sender, RoutedEventArgs e)
        {
            TwoPlayersWindow twoPlayersWindow = new TwoPlayersWindow();

            twoPlayersWindow.Left = this.Left;
            twoPlayersWindow.Top  = this.Top;
            this.Close();
            twoPlayersWindow.Show();
        }