I'm developing an Android App with Xamarin. I have a static class NetworkServices that exposes some method to call webservices. One of them, query server status:
public static async Task<SystemInfo> TestConnection(HomeServerInfo hsi)
{
HttpClient openRequest = new HttpClient();
HttpResponseMessage hrm = await openRequest.GetAsync(new System.Uri(hsi.ToString() + "/HomeServices/ServerController"));
return new SystemInfo(hrm.ToString());
}
This method is called from the OnCreate:
// Query server status
Task<SystemInfo> si = NetworkServices.TestConnection(hsi);
serverStatus.SetText(si.Result.CurrentDateTime, TextView.BufferType.Normal);
but this freeze the app. Why is wrong? The query Result property is not correct? Thank you