private void GameOver()
        {
            timer.Stop();

            MessageBox.Show("Ship crashed! Game Over!", "", MessageBoxButton.OK, MessageBoxImage.Hand);
            String nick         = "Noname";
            bool   correctInput = false;

            do
            {
                InputDialog dialog = new InputDialog(
                    String.Format("Enter your name (it cannot contain \"{0}\"): ", WpfProject.HighScoresPage.SPECIAL_CHAR), nick);
                if (dialog.ShowDialog() == true && !dialog.Answer.Contains(WpfProject.HighScoresPage.SPECIAL_CHAR))
                {
                    nick         = dialog.Answer;
                    correctInput = true;
                }
            } while (!correctInput);

            HighScoresPage highScores = new HighScoresPage();

            highScores.updateResults(nick, game.player.score);

            ProjectHome       projectHome = new ProjectHome();
            NavigationService ns          = NavigationService.GetNavigationService(this);

            ns.Navigate(projectHome);
        }
 private void HighScoresClick(object sender, RoutedEventArgs e)
 {
     HighScoresPage highScoresPage = new HighScoresPage();
     this.NavigationService.Navigate(highScoresPage);
 }
        private void GameOver()
        {
            timer.Stop();

            MessageBox.Show("Ship crashed! Game Over!", "", MessageBoxButton.OK, MessageBoxImage.Hand);
            String nick = "Noname";
            bool correctInput = false;
            do {
                InputDialog dialog = new InputDialog(
                    String.Format("Enter your name (it cannot contain \"{0}\"): ", WpfProject.HighScoresPage.SPECIAL_CHAR), nick);
                if (dialog.ShowDialog() == true && !dialog.Answer.Contains(WpfProject.HighScoresPage.SPECIAL_CHAR))
                {
                    nick = dialog.Answer;
                    correctInput = true;
                }
            } while (!correctInput);

            HighScoresPage highScores = new HighScoresPage();
            highScores.updateResults(nick, game.player.score);

            ProjectHome projectHome = new ProjectHome();
            NavigationService ns = NavigationService.GetNavigationService(this);
            ns.Navigate(projectHome);
        }
Beispiel #4
0
        private void HighScoresClick(object sender, RoutedEventArgs e)
        {
            HighScoresPage highScoresPage = new HighScoresPage();

            this.NavigationService.Navigate(highScoresPage);
        }