public FilterSelectorConfig(GamesStats stats, FilterSettings settings) { Stats = stats; Settings = settings; }
public override void RefreshData(Expression <Func <GameResult, bool> > gameFilter, Expression <Func <ArenaSession, bool> > arenaFilter) { GamesStats.RefreshFrom(this.dbContext, gameFilter); ArenaStats.RefreshFrom(this.dbContext, arenaFilter); }
private void Window_Loaded(object sender, RoutedEventArgs e) { BringToForeground(); NotificationsWin.AutoOpen = true; positionManager.RestoreSizeAndLocation(Config); Config.PropertyChanged += Config_PropertyChanged; Config.FilterSettings.PropertyChanged += FilterSettings_PropertyChanged; gamesStats = new GamesStats(GameDatabase.Instance); MenuMainMenu.DataContext = this; MenuViewSettings.DataContext = Config; FilterSelector.DataContext = new FilterSelectorConfig(gamesStats, Config.FilterSettings); CheckFilterView.DataContext = Config.FilterSettings; GridGamesView.AppSettings = Config; if (!Config.FirstTimeWizardComplete) { var window = new FirstTimeStartupWindow() { Owner = this }; if (window.ShowDialog() == true) { config.SteamSettings.IdSource = window.SteamImportLibByName ? SteamIdSource.Name : SteamIdSource.LocalUser; Config.SteamSettings.AccountId = window.SteamIdLibImport; Config.SteamSettings.IntegrationEnabled = window.SteamEnabled; Config.SteamSettings.LibraryDownloadEnabled = window.SteamImportLibrary; Config.SteamSettings.AccountName = window.SteamAccountName; Config.GOGSettings.IntegrationEnabled = window.GOGEnabled; Config.GOGSettings.LibraryDownloadEnabled = window.GogImportLibrary; Config.OriginSettings.IntegrationEnabled = window.OriginEnabled; Config.OriginSettings.LibraryDownloadEnabled = window.OriginImportLibrary; Config.UplaySettings.IntegrationEnabled = window.UplayEnabled; importSteamCatWizard = window.SteamImportCategories; importSteamCatWizardId = window.SteamIdCategoryImport; if (window.DatabaseLocation == FirstTimeStartupWindow.DbLocation.Custom) { Config.DatabasePath = window.DatabasePath; } else { FileSystem.CreateFolder(Paths.UserProgramDataPath); Config.DatabasePath = System.IO.Path.Combine(Paths.UserProgramDataPath, "games.db"); } GameDatabase.Instance.OpenDatabase(Config.DatabasePath); AddInstalledGames(window.ImportedGames); Config.FirstTimeWizardComplete = true; PropertyChanged?.Invoke(this, new PropertyChangedEventArgs("Config")); } } if (!Config.EmulatorWizardComplete) { GameDatabase.Instance.OpenDatabase(Config.DatabasePath); var window = new EmulatorImportWindow(DialogType.Wizard) { Owner = this }; if (window.ShowDialog() == true) { Config.EmulatorWizardComplete = true; } } if (!Config.MigrationV2PcPlatformAdded) { GameDatabase.Instance.OpenDatabase(Config.DatabasePath); var db = GameDatabase.Instance; foreach (var game in db.GamesCollection.Find(a => a.Provider != Provider.Custom).ToList()) { db.AssignPcPlatform(game); db.UpdateGameInDatabase(game); } Config.MigrationV2PcPlatformAdded = true; } LoadGames(Config.UpdateLibStartup); CheckUpdate(); SendUsageData(); Focus(); pipeService = new PipeService(); pipeService.CommandExecuted += PipeService_CommandExecuted; pipeServer = new PipeServer(Settings.GetAppConfigValue("PipeEndpoint")); pipeServer.StartServer(pipeService); var args = Environment.GetCommandLineArgs(); if (args.Count() > 0 && args.Contains("-command")) { var commandArgs = args[2].Split(new char[] { ':' }); var command = commandArgs[0]; var cmdArgs = commandArgs.Count() > 1 ? commandArgs[1] : string.Empty; PipeService_CommandExecuted(this, new CommandExecutedEventArgs(command, cmdArgs)); } }
//private GamesStats game; public ShowStats(GamesStats game) { InitializeComponent(); using (GamingPlatformDB_v4Entities entities = new GamingPlatformDB_v4Entities()) { List <GameBall> gameBall; List <GameSwitch> gameSwitch; List <GameMine> gameMine; List <GameTetri> gameTetris; List <SnakeGame> gameSnake; List <MemoryCardsGame> gameMemoryCards; switch (game) { case GamesStats.Ball: gameBall = entities.GameBalls.OrderByDescending(s => s.BestScore).ToList(); nameGame.Text = "Ball"; place1.Text = "1. " + gameBall[0].Player.LoginUser + "(" + gameBall[0].BestScore + ")"; place2.Text = "2. " + gameBall[1].Player.LoginUser + "(" + gameBall[1].BestScore + ")"; place3.Text = "3. " + gameBall[2].Player.LoginUser + "(" + gameBall[2].BestScore + ")"; place4.Text = "4. " + gameBall[3].Player.LoginUser + "(" + gameBall[3].BestScore + ")"; break; case GamesStats.Mines: gameMine = entities.GameMines.OrderBy(s => s.BestScore).ToList(); nameGame.Text = "Switch"; place1.Text = "1. " + gameMine[0].Player.LoginUser + "(" + gameMine[0].BestScore + ")"; place2.Text = "2. " + gameMine[1].Player.LoginUser + "(" + gameMine[1].BestScore + ")"; place3.Text = "3. " + gameMine[2].Player.LoginUser + "(" + gameMine[2].BestScore + ")"; place4.Text = "4. " + gameMine[3].Player.LoginUser + "(" + gameMine[3].BestScore + ")"; break; case GamesStats.Tetris: gameTetris = entities.GameTetris.OrderByDescending(s => s.BestScore).ToList(); nameGame.Text = "Tetris"; place1.Text = "1. " + gameTetris[0].Player.LoginUser + "(" + gameTetris[0].BestScore + ")"; place2.Text = "2. " + gameTetris[1].Player.LoginUser + "(" + gameTetris[1].BestScore + ")"; place3.Text = "3. " + gameTetris[2].Player.LoginUser + "(" + gameTetris[2].BestScore + ")"; place4.Text = "4. " + gameTetris[3].Player.LoginUser + "(" + gameTetris[3].BestScore + ")"; break; case GamesStats.Switch: gameSwitch = entities.GameSwitches.OrderBy(s => s.BestScore).ToList(); nameGame.Text = "Minesweapper"; place1.Text = "1. " + gameSwitch[0].Player.LoginUser + "(" + gameSwitch[0].BestScore + ")"; place2.Text = "2. " + gameSwitch[1].Player.LoginUser + "(" + gameSwitch[1].BestScore + ")"; place3.Text = "3. " + gameSwitch[2].Player.LoginUser + "(" + gameSwitch[2].BestScore + ")"; place4.Text = "4. " + gameSwitch[3].Player.LoginUser + "(" + gameSwitch[3].BestScore + ")"; break; case GamesStats.Snake: gameSnake = entities.SnakeGames.OrderByDescending(s => s.BestScore).ToList(); nameGame.Text = "Snake"; place1.Text = "1. " + gameSnake[0].Player.LoginUser + "(" + gameSnake[0].BestScore + ")"; place2.Text = "2. " + gameSnake[1].Player.LoginUser + "(" + gameSnake[1].BestScore + ")"; place3.Text = "3. " + gameSnake[2].Player.LoginUser + "(" + gameSnake[2].BestScore + ")"; place4.Text = "4. " + gameSnake[3].Player.LoginUser + "(" + gameSnake[3].BestScore + ")"; break; case GamesStats.MemoryCards: gameMemoryCards = entities.MemoryCardsGames.OrderByDescending(s => s.BestScore).ToList(); nameGame.Text = "MemoryCards"; place1.Text = "1. " + gameMemoryCards[0].Player.LoginUser + "(" + gameMemoryCards[0].BestScore + ")"; place2.Text = "2. " + gameMemoryCards[1].Player.LoginUser + "(" + gameMemoryCards[1].BestScore + ")"; place3.Text = "3. " + gameMemoryCards[2].Player.LoginUser + "(" + gameMemoryCards[2].BestScore + ")"; place4.Text = "4. " + gameMemoryCards[3].Player.LoginUser + "(" + gameMemoryCards[3].BestScore + ")"; break; } } }