private async void buttonFilterChampion_Click(object sender, RoutedEventArgs e) { buttonFilterChampion.IsEnabled = false; List <string> filters = new List <string>(); if (filterChampionAssassin.IsChecked == true) { filters.Add("Assassin"); } if (filterChampionFigther.IsChecked == true) { filters.Add("Fighter"); } if (filterChampionMarksman.IsChecked == true) { filters.Add("Marksman"); } if (filterChampionTank.IsChecked == true) { filters.Add("Tank"); } if (filterChampionSupport.IsChecked == true) { filters.Add("Support"); } if (filterChampionMage.IsChecked == true) { filters.Add("Mage"); } if (ChampionListDto.AllChampions == null) { await ChampionListDto.LoadAllChampions(); } ChampionsList.Items.Clear(); foreach (ChampionDto champion in ChampionListDto.AllChampions) { foreach (string tag in champion.Tags) { if (filters.Contains(tag)) { ChampionSelected item = new ChampionSelected(); item.Champion = champion; item.Tap += item_Tap; ChampionsList.Items.Add(item); break; } } } buttonFilterChampion.IsEnabled = true; }
private async void buttonFilterFreeWeek_Click(object sender, RoutedEventArgs e) { buttonFilterFreeWeek.IsEnabled = false; if (ChampionListDto.AllChampions == null) { await ChampionListDto.LoadAllChampions(); } ChampionsList.Items.Clear(); foreach (ChampionDto champion in ChampionListDto.AllChampions) { if (champion.FreeToPlay) { ChampionSelected item = new ChampionSelected(); item.Champion = champion; item.Tap += item_Tap; ChampionsList.Items.Add(item); } } buttonFilterFreeWeek.IsEnabled = true; }