Exemplo n.º 1
0
        private void guessButton_Click(object sender, EventArgs e)
        {
            int guess = Convert.ToInt16(inputBox.Text);

            Form1.guessList.Add(guess);


            if (guess < rand)
            {
                outputLabel.Text = "Too Low!";
            }
            else if (guess > rand)
            {
                outputLabel.Text = "Too High!";
            }
            else
            {
                outputLabel.Text = "You Got it!";
                Refresh();
                Thread.Sleep(1000);

                Form f = this.FindForm();
                f.Controls.Remove(this);

                resultsScreen rs = new resultsScreen();
                f.Controls.Add(rs);
            }

            inputBox.Text = "";
            inputBox.Focus();
        }
Exemplo n.º 2
0
        private void guessButton_Click(object sender, EventArgs e)
        {
            int guess = Convert.ToInt16(inputBox.Text);

            //TODO add guess to List of guesses on Form1

            Form1.unsortedGuess.Add(inputBox.Text);
            Form1.sortedGuess.Add(inputBox.Text);

            Form1.sortedGuess.Sort();


            if (guess < rand)
            {
                outputLabel.Text = "Too Low!";
            }
            else if (guess > rand)
            {
                outputLabel.Text = "Too High!";
            }
            else
            {
                outputLabel.Text = "You Got it!";
                Refresh();
                Thread.Sleep(1000);

                //TODO close this screen and open a Results Screen (you need to create this)
                Form login = this.FindForm();
                login.Controls.Remove(value: this);

                resultsScreen sc = new resultsScreen();
                login.Controls.Add(sc);
            }

            inputBox.Text = "";
            inputBox.Focus();
        }