private void BtnRetry_OnClick(object sender, RoutedEventArgs e)
 {
     GameGridManager.Clear();
     if (TopFrameManager.Instance.MainFrame.Content is GamePage)
     {
         (TopFrameManager.Instance.MainFrame.Content as GamePage).EndGame(disconnect: false);
     }
     //Recreate the gamepage
     TopFrameManager.Instance.MainFrame.Navigate(new GamePage(pt, et, level));
     //Close the overlay
     TopFrameManager.Instance.ClearOverlayFrame();
 }
 public void GoToMainMenu()
 {
     //End the game completely if running
     if (MainFrame.Content is GamePage)
     {
         GameGridManager.Clear();
         GamePage gp = (GamePage)MainFrame.Content;
         gp.EndGame();
     }
     //Clear the overlay frame
     ClearOverlayFrame();
     //Clear the main frame
     while (MainFrame.CanGoBack)
     {
         MainFrame.GoBack();
     }
 }