コード例 #1
0
 private void ButtonZero_Click(object sender, RoutedEventArgs e)
 {
     UserInput = UserInput + "0";
     Count++;
     TipsRichTextBox.AppendText("0");
     if (Count == Number)
     {
         CallGuessGame();
     }
 }
コード例 #2
0
 private void NewGameButton_Click(object sender, RoutedEventArgs e)
 {
     TipsRichTextBox.Document.Blocks.Clear();
     guess     = new Guess(Number);
     Count     = 0;
     UserInput = "";
     State     = true;
     TipsRichTextBox.AppendText("Game Start!\r");
     ButtonOne.IsEnabled   = true;
     ButtonTwo.IsEnabled   = true;
     ButtonThree.IsEnabled = true;
     ButtonFour.IsEnabled  = true;
     ButtonFive.IsEnabled  = true;
     ButtonSix.IsEnabled   = true;
     ButtonSeven.IsEnabled = true;
     ButtonEight.IsEnabled = true;
     ButtonNine.IsEnabled  = true;
     ButtonZero.IsEnabled  = true;
 }
コード例 #3
0
 public void CallGuessGame()
 {
     TipsRichTextBox.AppendText("    ");
     if (guess.FindNumber(UserInput))
     {
         guess.ABCounter(UserInput);
         if (guess.ACount == Number)
         {
             TipsRichTextBox.AppendText("You got it!\r");
             ButtonOne.IsEnabled   = false;
             ButtonTwo.IsEnabled   = false;
             ButtonThree.IsEnabled = false;
             ButtonFour.IsEnabled  = false;
             ButtonFive.IsEnabled  = false;
             ButtonSix.IsEnabled   = false;
             ButtonSeven.IsEnabled = false;
             ButtonEight.IsEnabled = false;
             ButtonNine.IsEnabled  = false;
             ButtonZero.IsEnabled  = false;
             TipsRichTextBox.AppendText("Press New Game To Start.");
         }
         else
         {
             TipsRichTextBox.AppendText(guess.ACount + "A" + guess.BCount + "B\r");
         }
         UserInput    = "";
         Count        = 0;
         guess.ACount = 0;
         guess.BCount = 0;
         TipsRichTextBox.ScrollToEnd();
     }
     else
     {
         TipsRichTextBox.AppendText("Number Invalid. Guess Again!\r");
         UserInput = "";
         Count     = 0;
     }
 }