private void OnTournamentChoiceExecute(TournamentVw tournament) { if (tournament.IsOutrightGroup) { var tournamentsData = new TournamentsViewModel(SelectedCategoryId, tournament); tournamentsData.OnNavigationCompleted(); var outrightsMatches = new SortableObservableCollection <IMatchVw>(); var tournaments = new SortableObservableCollection <TournamentVw>(tournamentsData.Tournaments); foreach (var tornmt in tournaments) { var matchData = new MatchesViewModel(new HashSet <string>() { tornmt.ContainsOutrights?tornmt.Id.ToString() + "*1" : tornmt.Id.ToString() + "*0" }); matchData.SelectedDescriptors.Add(SelectedSportDescriptor); matchData.OnNavigationCompleted(); outrightsMatches.AddRange(matchData.Matches); } TournamentMatches = outrightsMatches; } else { var matchesData = new MatchesViewModel(new HashSet <string>() { tournament.ContainsOutrights?tournament.Id.ToString() + "*1" : tournament.Id.ToString() + "*0" }); matchesData.SelectedDescriptors.Add(SelectedSportDescriptor); matchesData.OnNavigationCompleted(); TournamentMatches = matchesData.Matches; } }
private void SetImageCategories(SyncObservableCollection <SportCategory> categories) { var categoryVM = new CategoriesViewModel(); categoryVM.OnNavigationCompleted(); TournamentsViewModel b = new TournamentsViewModel(); b.OnNavigationCompleted(); foreach (SportCategory item in categories) { item.SportImageSource = categoryVM.Categories.Where(a => a.Name == item.SportName).FirstOrDefault().CategoryIconBySport as ImageSource; int counter = 0; foreach (TournamentVw itemTour in item.Tournaments) { if (!itemTour.IsOutrightGroup) { counter++; } else { counter += itemTour.MatchesCount; } } item.Count = $"({counter})"; item.CountAll = item.Tournaments.Count(); setBorderCategories(item); } OnPropertyChanged("Categories"); }
private void OnChoiceExecute(long id) { TournamentVw.CheckFlag = true; TournamentVw._instances.Clear(); if (TournamentMatches != null && TournamentMatches.Count > 0) { TournamentMatches = null; } if (SelectedTournaments != null && SelectedTournaments.Count > 0) { SelectedTournaments.Clear(); } var category = Categories.Where(c => c.Id == id).FirstOrDefault(); SelectedSportDescriptor = category.SportDescriptor; ButtonBackground = category.BackgroundBySport; var tournamentsData = new TournamentsViewModel(id); tournamentsData.OnNavigationCompleted(); Tournaments = new SortableObservableCollection <TournamentVw>(tournamentsData.Tournaments); ShowCountries = new SortableObservableCollection <TournamentVw>(Tournaments.GroupBy(p => p.Country).Select(g => g.First()).ToList()); ShowCountries[0].Country = "Outrights"; SelectedCategoryId = id; TournamentVw.CheckFlag = false; }