Hi All,
`private async Task GetStringDeserializedParms(string ServiceAddress, string FunctionName, object[] Parameters, object[] ParameterValues, string glbtoken)
{
try
{
OutputString = string.Empty;
var httpClient = new HttpClient();
var obj = new JObject();
for (int i = 0; i < Parameters.Length; i++)
{
obj[Parameters[i]] = ParameterValues[i] + "";
}
string s = obj.ToString();
httpClient.DefaultRequestHeaders.TryAddWithoutValidation("Accept", "application/json");
httpClient.DefaultRequestHeaders.TryAddWithoutValidation("Accept-Charset", "UTF-8");
httpClient.DefaultRequestHeaders.TryAddWithoutValidation("Authorization", glbtoken);
String url = ServiceAddress + "/" + FunctionName;
var response = httpClient.PostAsync(new Uri(url), new StringContent(s, Encoding.UTF8, "application/json")).Result;
response.EnsureSuccessStatusCode();
using (var responseStream = response.Content.ReadAsStreamAsync().Result)
using (var streamReader = new StreamReader(responseStream))
{
getstring = streamReader.ReadToEnd().ToString();
OutputString = (string)Newtonsoft.Json.JsonConvert.DeserializeObject(getstring);
}
}
catch(Exception ex)
{
}
return OutputString + "";
}
`
The above code working fine in android device and Iphone devices but , In Windows phone not responding after this below line executed
** var response = httpClient.PostAsync(new Uri(url), new StringContent(s, Encoding.UTF8, "application/json")).Result;**
What i need is windows need to wait for response from service. After receiving the response only next line should execute.