public void SetStats(PublicSummoner summoner, PlayerLifetimeStats stats) { if (summoner == null || stats == null) return; if (InvokeRequired) { Invoke(new Action<PublicSummoner, PlayerLifetimeStats>(SetStats), summoner, stats); return; } SetLevel(summoner.SummonerLevel); RemoveAll(p => (p.Tag as string) == "Stats"); foreach (var stat in stats.PlayerStatSummaries.PlayerStatSummarySet) { var sc = new StatsControl { Dock = DockStyle.Fill, Tag = "Stats" }; sc.SetStatSummary(stat); var tab = new TabPage(MinifyStatType(stat.PlayerStatSummaryType)) { BackColor = this.BackColor, Tag = "Stats" }; tab.Controls.Add(sc); InfoTabs.TabPages.Add(tab); } }
public void SetStats(PublicSummoner summoner, SummonerLeaguesDTO leagueInfo, PlayerLifetimeStats stats) { if (summoner == null || stats == null) return; if (InvokeRequired) { Invoke(new Action<PublicSummoner, SummonerLeaguesDTO, PlayerLifetimeStats>(SetStats), summoner, leagueInfo, stats); return; } RemoveAll(p => (p.Tag as string) == "Stats"); var nameMap = new Dictionary<string, string>() { {"RankedSolo5x5", "RANKED_SOLO_5x5"}, {"RankedTeam5x5", "RANKED_TEAM_5x5"}, {"RankedTeam3x3", "RANKED_TEAM_3x3"} }; foreach (var stat in stats.PlayerStatSummaries.PlayerStatSummarySet) { var sc = new StatsControl { Dock = DockStyle.Fill, Tag = "Stats" }; Dictionary<string, object> queueInfo = null; if (leagueInfo != null) { string queueType; if (nameMap.TryGetValue(stat.PlayerStatSummaryTypeString, out queueType)) { queueInfo = leagueInfo.GetQueueByName(queueType); } } sc.SetStatSummary(stat, SummonerLeaguesDTO.GetRanking(queueInfo)); var tab = new TabPage(MinifyStatType(stat.PlayerStatSummaryType)) { BackColor = this.BackColor, Tag = "Stats" }; tab.Controls.Add(sc); AddTab(tab); } }