Exemple #1
0
        private void LoadData()
        {
            Invoke(new Action(Show));

              logData = database.Select();
              Invoke(new Action(() => {
            gameTable.DataSource = gameData = new SortableBindingList<GameStats>(logData.Select(log => new GameStats(log)));
            gameData.SetDefaultDirection("Date", -1);
              }));

              summoners = new Dictionary<string, SummonerStats>();
              foreach (var row in logData) {
            foreach (var x in row.BlueTeam.Concat(row.PurpleTeam)) {
              if (!x.IsBot && (!row.BotGame || !x.Name.EndsWith(" Bot"))) {
            var key = x.Name;
            // Is this someone on a different server?
            if (summoners.ContainsKey(x.Name) && !String.IsNullOrEmpty(row.Server) && !String.IsNullOrEmpty(summoners[x.Name].Server)) {
              if (row.Server != summoners[x.Name].Server) {
                key = x.Name + "_" + row.Server;
              }
            }
            if (!summoners.ContainsKey(key)) {
              summoners[key] = new SummonerStats(x.Name);
            }
            summoners[key].AddGame(row);
              }
            }
              }

              Invoke(new Action(() => {
            summonerTable.DataSource = summonerData = new SortableBindingList<SummonerStats>(summoners.Values.OrderByDescending(x => x.Games));
            summonerData.SetDefaultDirection("Games", -1);
            summonerData.SetDefaultDirection("PlayedWith", -1);
            summonerData.SetDefaultDirection("PlayedVs", -1);
            summonerData.SetDefaultDirection("KnownWins", -1);
            summonerData.SetDefaultDirection("KnownLosses", -1);
              }));
        }
Exemple #2
0
        private void LoadChampionStats()
        {
            championData = new SortableBindingList<SummonerStats.ChampionStats>(Data.ChampStats.Values.OrderByDescending(x => x.Games));
              championData.SetDefaultDirection("Games", -1);
              championData.SetDefaultDirection("Wins", -1);
              championData.SetDefaultDirection("Losses", -1);
              championData.SetDefaultDirection("WinRate", -1);

              championTable.DataSource = championData;
              championTable.ColumnHeadersBorderStyle = Util.ProperColumnHeadersBorderStyle;
              championTable.Columns["Wins"].HeaderText = "W";
              championTable.Columns["Losses"].HeaderText = "L";
              championTable.Columns["WinRate"].HeaderText = "WR";
              if (Data.GamesAs > 0) {
            championTable.Columns["DeathsPerGame"].HeaderText = "D/G";
            championTable.Columns["DeathsPerGame"].ToolTipText = "Deaths per game";
              } else {
            championTable.Columns["DeathsPerGame"].Visible = false;
              }
              championTable.Columns["Name"].AutoSizeMode = DataGridViewAutoSizeColumnMode.AllCells;
              championTable.Select();
        }