Пример #1
0
        private async Task <ResponseMessage> CheckTokenAsync()
        {
            var message = new ResponseMessage();

            if (AccessTokenSettings.Current.AccessTokenExpiresIn)
            {
                try
                {
                    var result = await TokenAsync();

                    if (result.Success)
                    {
                        AccessTokenSettings.UpdateToken(JsonConvert.DeserializeObject <Token>(result.Message.ToString()));
                    }
                    else
                    {
                        result.Success = false;
                    }
                    return(result);
                }
                catch (Exception ex)
                {
                    message.Success = false;
                    message.Message = ex.Message;
                    DependencyService.Get <ILog>().SaveLog("CheckTokenAsync", ex);
                    return(message);
                }
            }
            else
            {
                message.Success = true;
            }
            return(message);
        }
Пример #2
0
        private async Task <ResponseMessage> CheckTokenAsync()
        {
            var message = new ResponseMessage();

            if (AccessTokenSettings.Current.AccessTokenExpiresIn)
            {
                try
                {
                    var result = await TokenAsync();

                    if (result.Success)
                    {
                        AccessTokenSettings.UpdateToken(JsonConvert.DeserializeObject <Token>(result.Message.ToString()));
                    }
                    else
                    {
                        result.Success = false;
                    }
                    return(result);
                }
                catch (Exception ex)
                {
                    message.Success = false;
                    message.Message = ex.Message;
                    Crashes.TrackError(ex);
                    return(message);
                }
            }
            else
            {
                message.Success = true;
            }
            return(message);
        }