Пример #1
0
        private async Task <bool> RefreshMatchesListAsync()
        {
            DisposeGuard();

            ICollection <ChessGameDetails> matches;

            try
            {
                matches = IsAnonymous
                        ? new List <ChessGameDetails>()
                        : (await _client.GetMatchesWithDetailsAsync(_loginResult?.TokenString)).ToList();
            }
            catch (Exception e)
            {
                OnBackgroundError(ServiceConnectionEventArgs.Error(e));
                return(false);
            }

            var oldMatches = Matches.Select(x => x.Id).ToList();
            var newMatches = matches.Select(x => x.Id).ToList();

            _matches.Clear();
            _matches.AddRange(matches);

            return(!oldMatches.SequenceEqual(newMatches));
        }
        public async Task <IEnumerable <ChessGame> > GetMatchesWithDetails()
        {
            await Login();

            return(await _client.GetMatchesWithDetailsAsync(JwtToken));
        }