コード例 #1
0
        //Plays the game
        private void playTheGame()
        {
            //Instructions
            string instructions = "This is the game of Bingo!! One number is called at a time. \n\n" +
                                  "Check the number that is called, and if it is  found click on the cell.\n\n" +
                                  "The number will be called to your right. If you get five in a row then it is BINGO!!";

            //Catchs any errors or exception
            try
            {   //Tests that the txtbox is valid
                if (validateName(txtEnterName))
                {
                    //Creates the bingo card,
                    createCard();

                    //Clears and initilizes tracked numbers array,
                    TrackUsedNumbers.initilizeTrackedNumbersArray();

                    //Creates the player and displays their name,
                    Player playerOne = new Player(txtEnterName.Text);

                    lblDsiplayName.Text = playerOne.displayName();

                    //Disables other controls
                    txtEnterName.Visible  = false;
                    lblEnterName.Visible  = false;
                    btnOK.Visible         = false;
                    btnNextNumber.Enabled = true;
                    txtNextNumber.Enabled = true;

                    //Displays instructions
                    lblInstructions.Text = instructions;

                    //Calls next number
                    callNumber();
                }
            }

            catch (Exception ex)
            {
                MessageBox.Show(ex.Message + "\n\n" + "Please try again." + "\n\n" + "Type of error encountered: " + ex.GetType().ToString(), "Error: Exception found.");
            }
        }
コード例 #2
0
 //Resets tracked numbers
 public void reset()
 {
     TrackUsedNumbers numbersTracked = new TrackUsedNumbers();
     //numbersTracked.initilizeTrackedNumbersArray();
 }
コード例 #3
0
 //Default constructor
 public SelectedNumbersListType()
 {
     ///Initializes tracked numbers obj
     numbersTracked = new TrackUsedNumbers();
     //numbersTracked.initilizeTrackedNumbersArray();
 }