private async Task LoadAlerts() { try { int otbId = int.Parse(Application.Current.Properties["Otb_ID"].ToString()); if (Connectivity.NetworkAccess == NetworkAccess.Internet) { ResponseHTTP <AlertModel> responseHTTP = await alertService.listarAlertas(otbId); if (responseHTTP.Code == System.Net.HttpStatusCode.OK) { listActivity = responseHTTP.Data; await App.SQLiteDB.SaveAlertAsync(listActivity); } else { DependencyService.Get <IMessage>().LongAlert(responseHTTP.Msj); } } else { listActivity = await App.SQLiteDB.GetAlertAsync(); } } catch (Exception ex) { throw ex; } }
// Metodo que carga la data de actividades de usuarios public async void LoadData() { try { ResponseHTTP <AlertModel> response = await alertService.listarAlertas(int.Parse(Application.Current.Properties["Otb_ID"].ToString())); if (response.Code == System.Net.HttpStatusCode.OK) { listaAlertas = response.Data; } else { DependencyService.Get <IMessage>().LongAlert(response.Msj); } } catch (Exception ex) { DependencyService.Get <IMessage>().LongAlert(ex.Message); } }