Beispiel #1
0
        private void SubmitAnswer()
        {
            try
            {
                myGame.UserAnswer = Convert.ToInt32(txtUserAnswer.Text);

                if (myGame.checkAnswer())
                {
                    lblOutcome.Text = "That's correct :)";
                }
                else
                {
                    lblOutcome.Text = "Sorry, that's incorrect :(";
                }
                myGame.CurrentQuestion++;
                txtUserAnswer.Clear();
                if (myGame.CurrentQuestion != 10)
                {
                    lblQuestionNum.Text  = "Question #" + (myGame.CurrentQuestion + 1).ToString();
                    lblMathQuestion.Text = myGame.Number1.ToString() + " " + mathSymbol(this.gametype) + " " + myGame.Number2.ToString() + " =";
                }
                else
                {
                    myTimer.Stop();
                    this.Hide();
                    frmFinalScoreForm.UserScore = myGame.FinalScore;
                    frmFinalScoreForm.ShowDialog();
                    this.Close();
                }
            }
            catch (Exception ex)
            {
                throw new Exception(MethodInfo.GetCurrentMethod().DeclaringType.Name + "." + MethodInfo.GetCurrentMethod().Name + " -> " + ex.Message);
            }
        }
Beispiel #2
0
 private void btnHighScores_Click(object sender, EventArgs e)
 {
     frmHighScoresForm.ShowDialog();
 }