예제 #1
0
        private async Task <bool> RefreshCurrentMatchAsync()
        {
            DisposeGuard();

            if (IsAnonymous)
            {
                if (CurrentGame == null)
                {
                    return(false);
                }

                CurrentGame = null;
            }

            if (CurrentGame == null)
            {
                return(false);
            }

            ChessGameDetails match;

            try
            {
                match = await _client.GetMatchAsync(_loginResult?.TokenString, CurrentGame.Id);
            }
            catch (Exception e)
            {
                OnBackgroundError(ServiceConnectionEventArgs.Error(e));
                return(false);
            }

            if (match.Equals(CurrentGame))
            {
                return(false);
            }

            CurrentGame = match;
            return(true);
        }
        public async Task <ChessGameDetails> GetMatch(string id)
        {
            await Login();

            return(await _client.GetMatchAsync(JwtToken, id));
        }