Beispiel #1
0
        public void CloseMenu(Menus menu)
        {
            switch (menu)
            {
            case Menus.MainMenu:
                MainMenu.Close();
                CurrentMenu = null;
                break;

            case Menus.NewGameMenu:
                NewGameMenu.Close();
                CurrentMenu = null;
                break;

            case Menus.GameInfoMenu:
                GameInfoMenu.Close();
                break;

            case Menus.AdvancedSettingsMenu:
                AdvancedSettingsMenu.Close();
                break;

            case Menus.HighscoresMenu:
                HighscoresMenu.Close();
                CurrentMenu = null;
                break;

            case Menus.LoadGameMenu:
                LoadGameMenu.Close();
                CurrentMenu = null;
                break;

            case Menus.ConfirmStepWindow:
                ConfirmStepWindow.Close();
                break;

            case Menus.PlayAgainWindow:
                PlayAgainWindow.Close();
                break;

            case Menus.PauseWindow:
                PauseWindow.Close();
                CurrentMenu = null;
                break;

            case Menus.SaveGameWindow:
                SaveGameWindow.Close();
                CurrentMenu = null;
                break;

            case Menus.LoadGameWindow:
                LoadGameWindow.Close();
                CurrentMenu = null;
                break;
            }
        }
Beispiel #2
0
 private async void SaveGameClose(object sender, string e)
 {
     if (e != null)
     {
         try
         {
             var games = _model.List();
             if (games.All(g => g.Name != e) ||
                 MessageBox.Show("Biztos, hogy felülírja a meglévő mentést?", "Snake",
                                 MessageBoxButton.YesNo, MessageBoxImage.Question) == MessageBoxResult.Yes)
             {
                 await _model.SaveGameState(e);
             }
         }
         catch (Exception err)
         {
             MessageBox.Show(err.Message, "Hiba!", MessageBoxButton.OK, MessageBoxImage.Error);
         }
     }
     _model.IsPaused = false;
     _savewindow.Close();
 }