Exemplo n.º 1
0
        private void FilterChampions()
        {
            ChampionSelectListView.Items.Clear();

            List <ChampionDTO> tempList = ChampionList.ToList();

            if (!String.IsNullOrEmpty(SearchTextBox.Text))
            {
                tempList = tempList.Where(x => champions.GetChampion(x.ChampionId).displayName.ToLower().Contains(SearchTextBox.Text.ToLower())).ToList();
            }

            bool AllChampions       = false;
            bool OwnedChampions     = false;
            bool NotOwnedChampions  = false;
            bool AvaliableChampions = false;

            switch ((string)FilterComboBox.SelectedValue)
            {
            case "All":
                AllChampions = true;
                break;

            case "Owned":
                OwnedChampions = true;
                break;

            case "Not Owned":
                NotOwnedChampions = true;
                break;

            default:
                AvaliableChampions = true;
                break;
            }

            foreach (ChampionDTO champ in tempList)
            {
                if ((AvaliableChampions && (champ.Owned || champ.FreeToPlay)) ||
                    (AllChampions) ||
                    (OwnedChampions && champ.Owned) ||
                    (NotOwnedChampions && !champ.Owned))
                {
                    ProfileChampionImage championImage = new ProfileChampionImage();
                    champions            champion      = champions.GetChampion(champ.ChampionId);
                    championImage.ChampImage.Source = champion.icon;
                    if (champ.FreeToPlay)
                    {
                        championImage.FreeToPlayLabel.Visibility = System.Windows.Visibility.Visible;
                    }
                    championImage.ChampName.Content = champion.displayName;
                    if (!champ.Owned && !champ.FreeToPlay)
                    {
                        championImage.ChampImage.Opacity = 0.5;
                    }
                    championImage.Tag = champ.ChampionId;
                    ChampionSelectListView.Items.Add(championImage);
                }
            }
        }
Exemplo n.º 2
0
 private void ChampionSelectListView_SelectionChanged(object sender, SelectionChangedEventArgs e)
 {
     if (ChampionSelectListView.SelectedIndex != -1)
     {
         ProfileChampionImage selectedChampion = (ProfileChampionImage)ChampionSelectListView.SelectedItem;
         Client.OverlayContainer.Content    = new ChampionDetailsPage((int)selectedChampion.Tag).Content;
         Client.OverlayContainer.Visibility = Visibility.Visible;
     }
 }
        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 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);
                }
            }
        }
Exemplo n.º 5
0
        private void FilterChampions()
        {
            ChampionSelectListView.Items.Clear();

            var tempList = _championList.ToList();

            if (!string.IsNullOrEmpty(SearchTextBox.Text))
            {
                tempList =
                    tempList.Where(
                        x =>
                        champions.GetChampion(x.ChampionId)
                        .displayName.ToLower()
                        .Contains(SearchTextBox.Text.ToLower())).ToList();
            }

            var allChampions       = false;
            var ownedChampions     = false;
            var notOwnedChampions  = false;
            var avaliableChampions = false;

            switch ((string)FilterComboBox.SelectedValue)
            {
            case "All":
                allChampions = true;
                break;

            case "Owned":
                ownedChampions = true;
                break;

            case "Not Owned":
                notOwnedChampions = true;
                break;

            default:
                avaliableChampions = true;
                break;
            }

            foreach (var champ in tempList)
            {
                if ((!avaliableChampions || (!champ.Owned && !champ.FreeToPlay)) && (!allChampions) &&
                    (!ownedChampions || !champ.Owned) && (!notOwnedChampions || champ.Owned))
                {
                    continue;
                }

                var championImage = new ProfileChampionImage();
                var champion      = champions.GetChampion(champ.ChampionId);
                championImage.ChampImage.Source = champion.icon;
                if (champ.FreeToPlay)
                {
                    championImage.FreeToPlayLabel.Visibility = Visibility.Visible;
                }

                championImage.ChampName.Content = champion.displayName;
                if (!champ.Owned && !champ.FreeToPlay)
                {
                    championImage.ChampImage.Opacity = 0.5;
                }

                championImage.Tag = champ.ChampionId;
                ChampionSelectListView.Items.Add(championImage);
            }
        }