public GamePage()
 {
     this.InitializeComponent();
     game = new Game();
     leaderBoard = new LeaderBoard();
     levelTimer = new DispatcherTimer();
     levelTimer.Tick += levelTimer_Tick;
     DataContext = game;
     this.navigationHelper = new NavigationHelper(this);
     this.navigationHelper.LoadState += this.NavigationHelper_LoadState;
     this.navigationHelper.SaveState += this.NavigationHelper_SaveState;
     Windows.Phone.UI.Input.HardwareButtons.BackPressed += HardwareButtons_BackPressed;
     Application.Current.Resuming += new EventHandler<Object>(OnResuming);
 }
 public GamePage()
 {
     this.InitializeComponent();
     game = new Game();
     leaderBoard = new LeaderBoard();
     levelTimer = new DispatcherTimer();
     levelTimer.Tick += levelTimer_Tick;
     this.DataContext = game;
     SettingsPane.GetForCurrentView().CommandsRequested += OnCommandsRequested;
     SizeChanged += GamePage_SizeChanged;
     this.navigationHelper = new NavigationHelper(this);
     this.navigationHelper.LoadState += navigationHelper_LoadState;
     this.navigationHelper.SaveState += navigationHelper_SaveState;
     Application.Current.Resuming += new EventHandler<Object>(OnResuming);
 }
 /// <summary>
 /// Populates the page with content passed during navigation. Any saved state is also
 /// provided when recreating a page from a prior session.
 /// </summary>
 /// <param name="sender">
 /// The source of the event; typically <see cref="NavigationHelper"/>
 /// </param>
 /// <param name="e">Event data that provides both the navigation parameter passed to
 /// <see cref="Frame.Navigate(Type, Object)"/> when this page was initially requested and
 /// a dictionary of state preserved by this page during an earlier
 /// session. The state will be null the first time a page is visited.</param>
 void navigationHelper_LoadState(object sender, LoadStateEventArgs e)
 {
     levelTimer.Interval = new TimeSpan(0, 0, 1);
     if (e.PageState != null)
     {
         game = e.PageState[Constants.GAME_STATE] as Game;
         this.DataContext = game;
     }
     levelTimer.Start();
 }