private async void Delete() { try { if (IsLoadingData) { return; } if (this.SelectedObservation.IdObsv == 0) { Alert.Show(AlertMessages.Delete); return; } bool result = await Confirm.Show("Desea eliminar la observación"); if (result) { IsLoadingData = true; UserDialogs.Instance.ShowLoading(AlertMessages.Deleting, MaskType.Black); if (!TokenValidator.IsValid(TokenGet)) { if (!await ApiIsOnline()) { UserDialogs.Instance.HideLoading(); Toast.ShowError(AlertMessages.Error); return; } else { if (!await GetTokenSuccess()) { UserDialogs.Instance.HideLoading(); Toast.ShowError(AlertMessages.Error); return; } } } ObservationDelQueryValues QueryValuesDel = new ObservationDelQueryValues() { IdObsv = this.SelectedObservation.IdObsv }; Response resultObservationsDel = await ApiSrv.DelObservations(TokenGet.Key, QueryValuesDel); if (!resultObservationsDel.IsSuccess) { UserDialogs.Instance.HideLoading(); Toast.ShowError(AlertMessages.Error); return; } else { ObservationDel = JsonConvert.DeserializeObject <List <ObservationDel> >(Crypto.DecodeString(resultObservationsDel.Data)); if (!ObservationDel[0].Result) { UserDialogs.Instance.HideLoading(); Toast.ShowError(AlertMessages.NoSuccess); } else { UserDialogs.Instance.HideLoading(); UserDialogs.Instance.ShowLoading(AlertMessages.UpdatingList, MaskType.Black); ObservationGetQueryValues QueryValuesGet; if (this.LotAndCommandData.HasData) { QueryValuesGet = new ObservationGetQueryValues() { IdLog = this.LogItem.IdLog, IdUser = PbUser.IdUser, IdInstance = this.LotAndCommandData.IdInstance, IdLot = this.LotAndCommandData.IdLot, IdCommand = this.LotAndCommandData.IdCommand }; } else { QueryValuesGet = new ObservationGetQueryValues() { IdLog = this.LogItem.IdLog, IdUser = PbUser.IdUser, IdInstance = 0, IdLot = 0, IdCommand = 0 }; } Response resultObservationsGet = await ApiSrv.GetObservations(TokenGet.Key, QueryValuesGet); if (!resultObservationsGet.IsSuccess) { UserDialogs.Instance.HideLoading(); Toast.ShowError(AlertMessages.Error); return; } else { Observations = JsonConvert.DeserializeObject <List <ObservationGet> >(Crypto.DecodeString(resultObservationsGet.Data)); ObservationItems.Clear(); foreach (ObservationGet observationGet in Observations) { ObservationItems.Add(new ObservationItem() { IdObsv = observationGet.IdObsv, DateObsv = observationGet.DateObsv, NameObsv = observationGet.NameObsv, IdUser = observationGet.IdUser, DetailObsv = observationGet.DetailObsv, DateObsvString = observationGet.DateObsv.ToString(DateTimeFormatString.LatinDate) }); } UserDialogs.Instance.HideLoading(); } Toast.ShowSuccess(AlertMessages.Success); this.Name = string.Empty; this.Details = string.Empty; this.SelectedObservation = new ObservationItem(); } } IsLoadingData = false; } } catch //(Exception ex) { UserDialogs.Instance.HideLoading(); Toast.ShowError(AlertMessages.Error); } }