public StatisticsViewModel()
 {
     Levels        = statisticManager.GetLevels();
     SelectedLevel = Levels.FirstOrDefault();
     Games         = statisticManager.GetWonGames(SelectedLevel.Id);
     UserName      = statisticManager.GetUserNickName();
     ResetCommand  = new Command(Reset);
 }
Ejemplo n.º 2
0
        private void menuItemSettings_Click(object sender, RoutedEventArgs e)
        {
            SettingsWindow settingsWindow = new SettingsWindow();

            if (settingsWindow.ShowDialog() == true)
            {
                var vm = settingsWindow.DataContext as SettingsViewModel;
                gameConfiguration = vm.SelectedConfiguration;
                currentLevel      = statisticManager.GetLevels().Where(r => r.SizeHeight == gameConfiguration.Rows && r.SizeWidth == gameConfiguration.Columns).FirstOrDefault();
                NewGame();
            }
        }
Ejemplo n.º 3
0
 private async void Window_Loaded(object sender, RoutedEventArgs e)
 {
     if (await userManager.IsAuthorized())
     {
         statisticManager = new StatisticManager();
         currentLevel     = statisticManager.GetLevels().First();
         NewGame();
     }
     else
     {
         AuthorizeWindow authorizeWindow = new AuthorizeWindow();
         if (authorizeWindow.ShowDialog() == true)
         {
             statisticManager = new StatisticManager();
             currentLevel     = statisticManager.GetLevels().First();
             NewGame();
         }
         else
         {
             Close();
         }
     }
 }