public AggregatedStatsOverlay(AggregatedStats stats, Boolean IsSelf) { InitializeComponent(); IsOwnPlayer = IsSelf; AllStats = new AggregatedChampion(); ChampionStats = new List <AggregatedChampion>(); ParseStats(stats); SelectedStats = AllStats; HideGrid.Visibility = System.Windows.Visibility.Visible; DisplayStats(); }
public AggregatedStatsOverlay(AggregatedStats stats, Boolean IsSelf) { InitializeComponent(); IsOwnPlayer = IsSelf; AllStats = new AggregatedChampion(); ChampionStats = new List<AggregatedChampion>(); ParseStats(stats); SelectedStats = AllStats; HideGrid.Visibility = System.Windows.Visibility.Visible; DisplayStats(); }
private void ChampionsListView_SelectionChanged(object sender, SelectionChangedEventArgs e) { if (((ListViewItem)ChampionsListView.SelectedItem).Tag != null) { SelectedStats = (AggregatedChampion)((ListViewItem)ChampionsListView.SelectedItem).Tag; if (!IsOwnPlayer) { HideGrid.Visibility = System.Windows.Visibility.Hidden; } DisplayStats(); } }
private void ParseStats(AggregatedStats stats) { foreach (AggregatedStat stat in stats.LifetimeStatistics) { AggregatedChampion Champion = null; Champion = ChampionStats.Find(x => x.ChampionId == stat.ChampionId); if (Champion == null) { Champion = new AggregatedChampion(); Champion.ChampionId = stat.ChampionId; ChampionStats.Add(Champion); } var type = typeof(AggregatedChampion); string fieldName = Client.TitleCaseString(stat.StatType.Replace('_', ' ')).Replace(" ", ""); var f = type.GetField(fieldName); f.SetValue(Champion, stat.Value); } ChampionStats.Sort((x, y) => y.TotalSessionsPlayed.CompareTo(x.TotalSessionsPlayed)); //AllStats = ChampionStats; foreach (AggregatedChampion ChampionStat in ChampionStats) { if (ChampionStat.ChampionId != 0) { ListViewItem item = new ListViewItem(); ProfileChampionImage championImage = new ProfileChampionImage(); champions champ = champions.GetChampion((int)ChampionStat.ChampionId); championImage.ChampImage.Source = champ.icon; championImage.ChampName.Content = champ.displayName; championImage.Width = 96; championImage.Height = 84; item.Tag = ChampionStat; item.Content = championImage.Content; ChampionsListView.Items.Add(item); } } }
private void ParseStats(AggregatedStats stats) { foreach (AggregatedStat stat in stats.LifetimeStatistics) { AggregatedChampion Champion = null; Champion = ChampionStats.Find(x => x.ChampionId == stat.ChampionId); if (Champion == null) { Champion = new AggregatedChampion(); Champion.ChampionId = stat.ChampionId; ChampionStats.Add(Champion); } var type = typeof(AggregatedChampion); string fieldName = Client.TitleCaseString(stat.StatType.Replace('_', ' ')).Replace(" ", ""); var f = type.GetField(fieldName); f.SetValue(Champion, stat.Value); } ChampionStats.Sort((x, y) => y.TotalSessionsPlayed.CompareTo(x.TotalSessionsPlayed)); //AllStats = ChampionStats[0]; foreach (AggregatedChampion ChampionStat in ChampionStats) { if (ChampionStat.ChampionId != 0) { ProfileChampionImage championImage = new ProfileChampionImage(); champions champion = champions.GetChampion((int)ChampionStat.ChampionId); championImage.DataContext = champion; championImage.Width = 96; championImage.Height = 84; championImage.Tag = ChampionStat; ChampionsListView.Items.Add(championImage); } } }
private void ClearButton_Click(object sender, RoutedEventArgs e) { SelectedStats = AllStats; HideGrid.Visibility = System.Windows.Visibility.Visible; DisplayStats(); }
private void ChampionsListView_SelectionChanged(object sender, SelectionChangedEventArgs e) { if (((ProfileChampionImage)ChampionsListView.SelectedItem).Tag != null) { SelectedStats = (AggregatedChampion)((ProfileChampionImage)ChampionsListView.SelectedItem).Tag; if (!IsOwnPlayer) HideGrid.Visibility = System.Windows.Visibility.Hidden; DisplayStats(); } }
private void ClearButton_Click(object sender, RoutedEventArgs e) { SelectedStats = AllStats; HideGrid.Visibility = System.Windows.Visibility.Visible; DisplayStats(); }