public async Task LoadData() { var response = await ISSDataService.GetCurrentCrew(); //var response = await ISSDataService.GetISSFlyByTime(50.9085179f, 8.0054351f, 10); MainThread.BeginInvokeOnMainThread(() => { ISSCurrentCrew = response; }); }
public async Task <ISSCurrentCrew> GetCurrentCrew() { try { var response = await httpClient.GetAsync($"{baseUrl}/astros.json"); if (!response.IsSuccessStatusCode) { var content = await response.Content.ReadAsStringAsync(); throw new HttpRequestException(content); } string serialized = await response.Content.ReadAsStringAsync(); ISSCurrentCrew result = JsonConvert.DeserializeObject <ISSCurrentCrew>(serialized); return(result); } catch (Exception ex) { throw ex; } }