示例#1
0
        private async Task RefreshBannedPlayerCount()
        {
            try
            {
                List <string> suspectIdList = await _cacheService.GetSuspectsListFromCache();

                List <string> bannedIdList = await _cacheService.GetSuspectsBannedList();

                List <Suspect> newSuspectBannedList = await _steamService.GetNewSuspectBannedList(suspectIdList, bannedIdList);

                if (newSuspectBannedList.Any())
                {
                    NewBannedPlayerCount += newSuspectBannedList.Count;
                    NotificationMessage   = NewBannedPlayerCount + " suspects have been banned!";
                    // Add new banned suspects to banned list
                    foreach (Suspect suspectBanned in newSuspectBannedList)
                    {
                        await _cacheService.AddSuspectToBannedList(suspectBanned);
                    }
                    IsBusy = false;
                    await Task.Delay(5000);

                    HasNotification = false;
                }
            }
            catch (Exception e)
            {
                await _dialogService.ShowErrorAsync("Error while trying to get suspects information.", MessageDialogStyle.Affirmative);

                Logger.Instance.Log(e);
            }
        }