Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- internal static JObject GetToBackOffice(string action)
- {
- var url = backOfficeUrl;
- url = url + action;
- HttpClient httpClient = new HttpClient();
- var response =
- httpClient.GetAsync(url
- ).Result;
- if (response.StatusCode == System.Net.HttpStatusCode.OK)
- {
- var idProcess = Newtonsoft.Json.Linq.JObject.Parse(response.Content.ReadAsStringAsync().Result);
- return idProcess;
- }
- else
- return null;
- internal static JObject GetToBackOffice(string action)
- {
- var url = backOfficeUrl;
- url = url + action;
- HttpClient httpClient = new HttpClient();
- JObject idProcess = new JObject();
- httpClient.GetString(new Uri(url),
- (response) =>
- {
- // Raised when the download completes
- if (response.StatusCode == System.Net.HttpStatusCode.OK)
- {
- idProcess = Newtonsoft.Json.Linq.JObject.Parse(response.Data);
- }
- else
- {
- idProcess = null;
- }
- });
- // Here I would like to wait for the response, so that idProcess is filled with the received data before returning
- return idProcess;
- }
- IEnumerator WaitForResponce(ResponceType response)
- {
- while(response.Data == null)
- yield return new WaitForSeconds (0.02f);
- //do what you want here
- }
- httpClient.GetString(new Uri(url),
- (response) =>
- {
- // Raised when the download completes
- if (response.StatusCode == System.Net.HttpStatusCode.OK)
- {
- //idProcess = Newtonsoft.Json.Linq.JObject.Parse(response.Data);
- StartCoroutine(WaitForResponce(responce));
- }
- else
- {
- idProcess = null;
- }
- });
Add Comment
Please, Sign In to add comment