private void GotStats(AggregatedStats stats) { Dispatcher.BeginInvoke(DispatcherPriority.Input, new ThreadStart(() => { SelectedAggregatedStats = stats; ViewAggregatedStatsButton.IsEnabled = false; TopChampionsListView.Items.Clear(); List <AggregatedChampion> ChampionStats = new List <AggregatedChampion>(); int i = 0; if (SelectedAggregatedStats.LifetimeStatistics != null) { if (SelectedAggregatedStats.LifetimeStatistics.Count() > 0) { foreach (AggregatedStat stat in SelectedAggregatedStats.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)); foreach (AggregatedChampion info in ChampionStats) { if (i++ > 6) { break; } ViewAggregatedStatsButton.IsEnabled = true; if (info.ChampionId != 0.0) { ChatPlayer player = new ChatPlayer(); champions Champion = champions.GetChampion(Convert.ToInt32(info.ChampionId)); player.LevelLabel.Visibility = System.Windows.Visibility.Hidden; player.PlayerName.Content = Champion.displayName; player.PlayerStatus.Content = info.TotalSessionsPlayed + " games played"; player.ProfileImage.Source = champions.GetChampion(Champion.id).icon; TopChampionsListView.Items.Add(player); } } } } })); }
public AggregatedStatsOverlay(AggregatedStats stats, bool isSelf) { InitializeComponent(); isOwnPlayer = isSelf; allStats = new AggregatedChampion(); championStats = new List<AggregatedChampion>(); ParseStats(stats); selectedStats = allStats; HideGrid.Visibility = Visibility.Visible; DisplayStats(); }
public AggregatedStatsOverlay(AggregatedStats stats, bool isSelf) { InitializeComponent(); isOwnPlayer = isSelf; allStats = new AggregatedChampion(); championStats = new List <AggregatedChampion>(); ParseStats(stats); selectedStats = allStats; HideGrid.Visibility = Visibility.Visible; DisplayStats(); }
public AggregatedStatsOverlay(AggregatedStats stats, Boolean isSelf) { InitializeComponent(); Change(); _isOwnPlayer = isSelf; _allStats = new AggregatedChampion(); _championStats = new List <AggregatedChampion>(); ParseStats(stats); _selectedStats = _allStats; HideGrid.Visibility = Visibility.Visible; DisplayStats(); }
private void ChampionsListView_SelectionChanged(object sender, SelectionChangedEventArgs e) { if (((ListViewItem)ChampionsListView.SelectedItem).Tag == null) { return; } _selectedStats = (AggregatedChampion)((ListViewItem)ChampionsListView.SelectedItem).Tag; if (!_isOwnPlayer) { HideGrid.Visibility = Visibility.Hidden; } DisplayStats(); }
private void ParseStats(AggregatedStats stats) { foreach (var stat in stats.LifetimeStatistics) { var champion = _championStats.Find(x => Math.Abs(x.ChampionId - stat.ChampionId) < Math.Abs(x.ChampionId * .00001)); if (champion == null) { champion = new AggregatedChampion { ChampionId = stat.ChampionId }; _championStats.Add(champion); } var type = typeof(AggregatedChampion); var fieldName = Client.TitleCaseString(stat.StatType.Replace('_', ' ')).Replace(" ", string.Empty); var f = type.GetField(fieldName); f.SetValue(champion, stat.Value); } _championStats.Sort((x, y) => y.TotalSessionsPlayed.CompareTo(x.TotalSessionsPlayed)); //AllStats = ChampionStats; foreach (var championStat in _championStats) { if (Math.Abs(championStat.ChampionId) < .00001) { continue; } var item = new ListViewItem(); var championImage = new ProfileChampionImage(); var 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 GotStats(AggregatedStats stats) { Dispatcher.BeginInvoke(DispatcherPriority.Input, new ThreadStart(() => { _selectedAggregatedStats = stats; ViewAggregatedStatsButton.IsEnabled = false; TopChampionsListView.Items.Clear(); var championStats = new List <AggregatedChampion>(); var i = 0; if (_selectedAggregatedStats.LifetimeStatistics == null) { return; } if (!_selectedAggregatedStats.LifetimeStatistics.Any()) { return; } foreach (var stat in _selectedAggregatedStats.LifetimeStatistics) { var champion = championStats.Find(x => Math.Abs(x.ChampionId - stat.ChampionId) < .00001); if (champion == null) { champion = new AggregatedChampion { ChampionId = stat.ChampionId }; championStats.Add(champion); } var type = typeof(AggregatedChampion); var fieldName = Client.TitleCaseString(stat.StatType.Replace('_', ' ')).Replace(" ", string.Empty); var f = type.GetField(fieldName); f.SetValue(champion, stat.Value); } championStats.Sort((x, y) => y.TotalSessionsPlayed.CompareTo(x.TotalSessionsPlayed)); foreach (var info in championStats.TakeWhile(info => i++ <= 6)) { ViewAggregatedStatsButton.IsEnabled = true; if (!(Math.Abs(info.ChampionId) > 0)) { continue; } var champion = champions.GetChampion(Convert.ToInt32(info.ChampionId)); var player = new ChatPlayer { LevelLabel = { Visibility = Visibility.Hidden }, PlayerName = { Content = champion.displayName }, PlayerStatus = { Content = info.TotalSessionsPlayed + " games played" }, ProfileImage = { Source = champions.GetChampion(champion.id).icon }, Background = new SolidColorBrush(Color.FromArgb(102, 80, 80, 80)), Width = 270 }; TopChampionsListView.Items.Add(player); } })); }
private void ClearButton_Click(object sender, RoutedEventArgs e) { _selectedStats = _allStats; HideGrid.Visibility = Visibility.Visible; DisplayStats(); }
private void GotStats(AggregatedStats stats) { Dispatcher.BeginInvoke(DispatcherPriority.Input, new ThreadStart(() => { SelectedAggregatedStats = stats; ViewAggregatedStatsButton.IsEnabled = false; TopChampionsListView.Items.Clear(); List<AggregatedChampion> ChampionStats = new List<AggregatedChampion>(); int i = 0; if (SelectedAggregatedStats.LifetimeStatistics.Count() > 0) { foreach (AggregatedStat stat in SelectedAggregatedStats.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)); foreach (AggregatedChampion info in ChampionStats) { if (i++ > 6) break; ViewAggregatedStatsButton.IsEnabled = true; if (info.ChampionId != 0.0) { ChatPlayer player = new ChatPlayer(); champions Champion = champions.GetChampion(Convert.ToInt32(info.ChampionId)); player.LevelLabel.Visibility = System.Windows.Visibility.Hidden; player.PlayerName.Content = Champion.displayName; player.PlayerStatus.Content = info.TotalSessionsPlayed + " games played"; player.ProfileImage.Source = champions.GetChampion(Champion.id).icon; TopChampionsListView.Items.Add(player); } } } })); }
private void ParseStats(AggregatedStats stats) { foreach (var stat in stats.LifetimeStatistics) { var champion = championStats.Find(x => Math.Abs(x.ChampionId - stat.ChampionId) < Math.Abs(x.ChampionId*.00001)); if (champion == null) { champion = new AggregatedChampion { ChampionId = stat.ChampionId }; championStats.Add(champion); } var type = typeof (AggregatedChampion); var fieldName = Client.TitleCaseString(stat.StatType.Replace('_', ' ')).Replace(" ", string.Empty); var f = type.GetField(fieldName); f.SetValue(champion, stat.Value); } championStats.Sort((x, y) => y.TotalSessionsPlayed.CompareTo(x.TotalSessionsPlayed)); //AllStats = ChampionStats; foreach (var championStat in championStats) { if (Math.Abs(championStat.ChampionId) < .00001) { continue; } var item = new ListViewItem(); var championImage = new ProfileChampionImage(); var 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 ClearButton_Click(object sender, RoutedEventArgs e) { selectedStats = allStats; HideGrid.Visibility = Visibility.Visible; DisplayStats(); }
private void ChampionsListView_SelectionChanged(object sender, SelectionChangedEventArgs e) { if (((ListViewItem) ChampionsListView.SelectedItem).Tag == null) { return; } selectedStats = (AggregatedChampion) ((ListViewItem) ChampionsListView.SelectedItem).Tag; if (!isOwnPlayer) { HideGrid.Visibility = Visibility.Hidden; } DisplayStats(); }
private void GotStats(AggregatedStats stats) { Dispatcher.BeginInvoke(DispatcherPriority.Input, new ThreadStart(() => { selectedAggregatedStats = stats; ViewAggregatedStatsButton.IsEnabled = false; TopChampionsListView.Items.Clear(); var championStats = new List<AggregatedChampion>(); var i = 0; if (selectedAggregatedStats.LifetimeStatistics == null) { return; } if (!selectedAggregatedStats.LifetimeStatistics.Any()) { return; } foreach (var stat in selectedAggregatedStats.LifetimeStatistics) { var champion = championStats.Find(x => Math.Abs(x.ChampionId - stat.ChampionId) < .00001); if (champion == null) { champion = new AggregatedChampion { ChampionId = stat.ChampionId }; championStats.Add(champion); } var type = typeof (AggregatedChampion); var fieldName = Client.TitleCaseString(stat.StatType.Replace('_', ' ')).Replace(" ", string.Empty); var f = type.GetField(fieldName); if (f == null) Client.Log(fieldName, "NewStatType"); else f.SetValue(champion, stat.Value); } championStats.Sort((x, y) => y.TotalSessionsPlayed.CompareTo(x.TotalSessionsPlayed)); foreach (var info in championStats.TakeWhile(info => i++ <= 6)) { ViewAggregatedStatsButton.IsEnabled = true; if (!(Math.Abs(info.ChampionId) > 0)) { continue; } var champion = champions.GetChampion(Convert.ToInt32(info.ChampionId)); var player = new ChatPlayer { LevelLabel = {Visibility = Visibility.Hidden}, PlayerName = {Content = champion.displayName}, PlayerStatus = {Content = info.TotalSessionsPlayed + " games played"}, ProfileImage = {Source = champions.GetChampion(champion.id).icon}, Background = new SolidColorBrush(Color.FromArgb(102, 80, 80, 80)), Width = 270 }; TopChampionsListView.Items.Add(player); } })); }