void OnTapped() { //checks that the database has elements before proceeding if (QueryList.Count() > 0) { //adds first category HistoricalStandingsDataList.Add(new HistoricalStandingTitleModel { Title = QueryList.First().TournamentName }); //checks for each element if there already exists a matching category, adds it if not for (int i = 1; i < QueryList.Count(); i++) { if (QueryList.ElementAt(i).TournamentName != QueryList.ElementAt(i - 1).TournamentName) { bool add = true; foreach (var item in HistoricalStandingsDataList) { if (item.Title.ToUpper() == QueryList.ElementAt(i).TournamentName.ToUpper()) { add = false; } } if (add) { HistoricalStandingsDataList.Add(new HistoricalStandingTitleModel { Title = QueryList.ElementAt(i).TournamentName }); } } } ShowListView = !_showListView; if (_showListView) { ArrowImage = "up_arrow.png"; } else { ArrowImage = "down_arrow.png"; } } }
private async void CheckForUpdate() { int oldCount = 0; while (true) { if (QueryList != null && QueryList.Count() != oldCount) { oldCount = QueryList.Count(); _realm.Write(() => { PlayersList = new ObservableCollection <POTYModel>(QueryList.ToList()); int i = 0; foreach (POTYModel item in PlayersList) { item.Index = i++; } OnPropertyChanged(nameof(PlayersList)); }); } await Task.Delay(100); } }