Exemple #1
0
        /// <summary>
        /// this button is to close the game (end game)
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void endBtn_Click(object sender, RoutedEventArgs e)
        {
            try
            {
                //stop countdown timer
                gameTime.Stop();
                //load sound
                SoundPlayer playSound = new SoundPlayer(@"ta_da.wav");
                //play sound
                playSound.Play();
                //output message box for player final score
                MessageBox.Show("Good Job! " + getPlayerInfo.playerName + ", You got " + numOfRight +
                                " out of 10 right in " + timeUse.ToString() + " second!!");
                //call addScore method to add final score to list
                addScore(scoreList, CopyPlayerInfo.userArr[CopyPlayerInfo.count - 1, 0], numOfRight, 10 - numOfRight, timeUse);

                // hScore.showScore();
                hScore.ShowDialog();

                //hide current window
                this.Hide();
            }
            catch (Exception ex)
            {
                //call handleError method
                HandleError.handleError(MethodInfo.GetCurrentMethod().DeclaringType.Name,
                                        MethodInfo.GetCurrentMethod().Name, ex.Message);
            }
        }
Exemple #2
0
 /// <summary>
 /// this the high score button
 /// </summary>
 /// <param name="sender"></param>
 /// <param name="e"></param>
 private void highScoreButton_Click(object sender, RoutedEventArgs e)
 {
     try
     {
         //hide window
         this.Hide();
         //call show score method
         highScore.showScore();
         //show high score window
         highScore.ShowDialog();
         //show main window
         this.Show();
     }
     catch (Exception ex)
     {
         //call handleError method
         HandleError.handleError(MethodInfo.GetCurrentMethod().DeclaringType.Name,
                                 MethodInfo.GetCurrentMethod().Name, ex.Message);
     }
 }