コード例 #1
0
 private void ValidateOK(object sender, RoutedEventArgs e)
 {
     if (name.Text == "")
     {
         MessageBox.Show("Please enter your name!");
     }
     else
     {
         game.addPlayer(new Player(name.Text));
         if (playerIndex > 1)
         {
             playerIndex--;
             PlayerNames namewindow = new PlayerNames(playerIndex, numofPlayers);
             namewindow.Show();
             this.Close();
         }
         else
         {
             Monopoly m_View = new Monopoly();
             game.possibleWindows.Add(m_View);
             m_View.Show();
             this.Close();
         }
     }
 }
コード例 #2
0
        //this function is called if user has not selected anything
        private void ValidateOK(object sender, RoutedEventArgs e)
        {
            //if neither one of the boxes is checked
            if ((Box2.IsChecked == false) && (Box3.IsChecked == false) && (Box4.IsChecked == false))
            {
                // show a polite message to the user
                MessageBox.Show("Please select number of players!");
            }


            //everything went fine, so call next windows where players' names will be defined
            //and close this window
            else
            {
                PlayerNames namewindow = new PlayerNames(num, num);
                namewindow.Show();
                this.Close();
            }
        }