示例#1
0
        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 toMain_Click(object sender, RoutedEventArgs e)
 {
     ProjectHome projectHome = new ProjectHome();
     this.NavigationService.Navigate(projectHome);
 }
示例#3
0
        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 toMain_Click(object sender, RoutedEventArgs e)
        {
            ProjectHome projectHome = new ProjectHome();

            this.NavigationService.Navigate(projectHome);
        }