Esempio n. 1
0
        protected async override void LoadState(Object navigationParameter, Dictionary<String, Object> pageState)
        {
            flyStartGame.StartGameEvent += flyStartGame_Continue;
            flyRestartGame.ContinueEvent += flyRestartGame_Continue;
            flyRestartGame.CancelEvent += flyRestartGame_Cancel;
            flyNextRound.ContinueEvent += flyNextRound_Continue;
            flyBonus.ContinueEvent += flyBonus_Continue;
            flyLostBonus.ContinueEvent += flyLostBonus_Continue;
            flyLostGame.ContinueEvent += flyLostGame_Continue;
            flyFinishedGame.ContinueEvent += flyFinishedGame_Continue;
            flyFinishedGameWithHiScore.ContinueEvent += flyFinishedGameWithHiScore_Continue;
            flyInstructions.ContinueEvent += flyInstructions_Continue;
            flyInstructions.CancelEvent += flyInstructions_Cancel;

            flyStartGame.Visibility = Windows.UI.Xaml.Visibility.Collapsed;
            flyRestartGame.Visibility = Windows.UI.Xaml.Visibility.Collapsed;
            flyNextRound.Visibility = Windows.UI.Xaml.Visibility.Collapsed;
            flyBonus.Visibility = Windows.UI.Xaml.Visibility.Collapsed;
            flyLostBonus.Visibility = Windows.UI.Xaml.Visibility.Collapsed;
            flyLostGame.Visibility = Windows.UI.Xaml.Visibility.Collapsed;
            flyFinishedGame.Visibility = Windows.UI.Xaml.Visibility.Collapsed;
            flyFinishedGameWithHiScore.Visibility = Windows.UI.Xaml.Visibility.Collapsed;
            flyInstructions.Visibility = Windows.UI.Xaml.Visibility.Collapsed;

            inGame = new InGame();
            
            DisplayFlyout_StartGame();

            this.DefaultViewModel["Items"] = inGame;

            if (this.dispatcherTimer == null)
            {
                dispatcherTimer = new DispatcherTimer();
                dispatcherTimer.Tick += new EventHandler<object>(dispatcherTimer_Tick);
                dispatcherTimer.Interval = TimeSpan.FromSeconds(1);
            }

            this.dispatcherTimer.Start();

            PauseGame();
        }
Esempio n. 2
0
        void Reset()
        {
            try
            {
                inGame = new InGame();
                inGame.HiScore = App.Instance.GameDataSource.GameStats.Score;
                inGame.HiScoreDate = App.Instance.GameDataSource.GameStats.Date;

                if (inGame.HiScoreDate != DateTime.MinValue)
                {
                    txtHiScore.Text = inGame.HiScore.ToString();
                    txtHiScoreDate.Text = inGame.HiScoreDate.ToString("dd/MM/yyyy");
                }
            }
            catch (Exception)
            {                
                throw;
            }
        }