public string DoRequest()
        {
            var result = String.Empty;

            if (!shouldSend())
            {
                return(null);
            }

            try
            {
                using (HttpClientHandler handler = new HttpClientHandler())
                {
                    using (HttpClient client = new HttpClient(handler)
                    {
                        BaseAddress = new Uri(KeyValues.REQUEST_BASE_URL)
                    })
                    {
                        string           content    = client.ExecutePostDataAsJsonAsync(this.mRequestUri, BuildPostData()).Result.GetResult();
                        SCServerResponse scResponse = new SCServerResponse(JObject.Parse(content));
                        result = scResponse.DeepLinkString;
                    }
                }
                mStatus = KeyValues.STATUS_SUCCESS;
            }
            catch (Exception ex)
            {
                mStatus = KeyValues.STATUS_CONNECTION_ERROR;
                return(ex.StackTrace);
            }
            return(result);
        }
示例#2
0
 public void OnRequestSucceeded(SCServerResponse response)
 {
     if (this.mCallback != null)
     {
         JObject json = response.Json;
         string  Url  = json[KeyValues.SHORT_URL_RESPONSE_KEY].ToString();
         if (!String.IsNullOrWhiteSpace(Url))
         {
             Uri shortLink = new Uri(Url);
             this.mCallback.OnLinkCreated(shortLink.ToString());
         }
     }
 }
 public void OnRequestSucceeded(SCServerResponse response)
 {
     if (this.mCallback != null)
     {
         JObject json = response.Json;
         string Url = json[KeyValues.SHORT_URL_RESPONSE_KEY].ToString();
         if (!String.IsNullOrWhiteSpace(Url))
         {
             Uri shortLink = new Uri(Url);
             this.mCallback.OnLinkCreated(shortLink.ToString());
         }
     }
 }
 public virtual void OnRequestSucceeded(SCServerResponse response)
 {
 }
        public string DoRequest()
        {
            var result = String.Empty;

            if (!shouldSend())
                return null;

            try
            {
                using (HttpClientHandler handler = new HttpClientHandler())
                {
                    using (HttpClient client = new HttpClient(handler) { BaseAddress = new Uri(KeyValues.REQUEST_BASE_URL) })
                    {
                        string content = client.ExecutePostDataAsJsonAsync(this.mRequestUri, BuildPostData()).Result.GetResult();
                        SCServerResponse scResponse = new SCServerResponse(JObject.Parse(content));
                        result = scResponse.DeepLinkString;
                    }
                }
                mStatus = KeyValues.STATUS_SUCCESS;
            }
            catch (Exception ex)
            {
                mStatus = KeyValues.STATUS_CONNECTION_ERROR;
                return ex.StackTrace;
            }
            return result;
        }
 public virtual void OnRequestSucceeded(SCServerResponse response)
 {
 }