public void OpenMenu()
 {
     if (inGameMenu != null)
     {
         inGameMenu.Close();
     }
     else
     {
         Game.Instance.Pause();
         Program.Instance.Interface.AddChild(inGameMenu = new InGameMenu
         {
             MapSettings  = Game.Instance.Map.Settings,
             Localization = Game.Instance.Map.StringLocalizationStorage
         });
         inGameMenu.Closed += new EventHandler(inGameMenu_Closed);
     }
 }
 void inGameMenu_Closed(object sender, EventArgs e)
 {
     if (inGameMenu.Result == InGameMenuResult.MainMenu)
     {
         Game.Instance.EndPlayingMap(GameState.Aborted, "Back to main menu");
         Program.Instance.EnterProfileMenuState();
     }
     else if (inGameMenu.Result == InGameMenuResult.Restart)
     {
         Game.Instance.EndPlayingMap(GameState.Aborted, "Restart");
         Game.Instance.Resume();
         Game.Instance.Restart();
     }
     else if (inGameMenu.Result == InGameMenuResult.Resume)
     {
         Game.Instance.Resume();
     }
     inGameMenu.Closed -= new EventHandler(inGameMenu_Closed);
     inGameMenu = null;
 }
 public void OpenMenu()
 {
     if (inGameMenu != null)
     {
         inGameMenu.Close();
     }
     else
     {
         Game.Instance.Pause();
         Program.Instance.Interface.AddChild(inGameMenu = new InGameMenu
         {
             MapSettings = Game.Instance.Map.Settings,
             Localization = Game.Instance.Map.StringLocalizationStorage
         });
         inGameMenu.Closed += new EventHandler(inGameMenu_Closed);
     }
 }