public override void Cleanup() { base.Cleanup(); SelectedSuspect = null; Suspects.Clear(); SelectedSuspects.Clear(); _cts = null; }
private void UpdateSuspectList(List <Suspect> suspectList) { SelectedSuspects.Clear(); Suspects.Clear(); foreach (Suspect suspect in suspectList) { Suspects.Add(suspect); } }
private async Task LoadPlayers() { if (!AppSettings.IsInternetConnectionAvailable()) { await _dialogService.ShowNoInternetConnectionAsync(); return; } Suspects.Clear(); SelectedSuspects.Clear(); List <string> suspectsIdList = await _cacheService.GetPlayersWhitelist(); if (suspectsIdList.Any()) { // Split list to 100 elements as Steam API allow to request by 100 SteamID maximum IEnumerable <IEnumerable <string> > ids = suspectsIdList.Batch(100); try { foreach (IEnumerable <string> idList in ids) { IEnumerable <Suspect> suspects = await _steamService.GetBanStatusForUserList(idList.ToList()); foreach (Suspect suspect in suspects) { Suspects.Add(suspect); } } } catch (Exception e) { Logger.Instance.Log(e); await _dialogService.ShowErrorAsync("Error while trying to get players information.", MessageDialogStyle.Affirmative); } } }
private async Task LoadSuspects() { if (!AppSettings.IsInternetConnectionAvailable()) { await _dialogService.ShowNoInternetConnectionAsync(); return; } try { Suspects.Clear(); SelectedSuspects.Clear(); List <string> suspectsIdList = await _cacheService.GetSuspectsListFromCache(); if (suspectsIdList.Any()) { // Split list to 100 elements as Steam API allow to request by 100 SteamID maximum IEnumerable <IEnumerable <string> > ids = suspectsIdList.Batch(100); foreach (IEnumerable <string> idList in ids) { List <Suspect> suspects = await _steamService.GetBanStatusForUserList(idList.ToList()); foreach (Suspect s in suspects) { Suspects.Add(s); } } } } catch (Exception e) { Logger.Instance.Log(e); await _dialogService.ShowErrorAsync(Properties.Resources.DialogErrorWhileRetrievingSuspectsInformation, MessageDialogStyle.Affirmative); } }