public async Task Editar(Notification notification) { var notificacionAntigua = ListaNotifications.Find(x => x.NotificationId == notification.NotificationId); notificacionAntigua = notification; dataService.Update(notificacionAntigua, true); var FechayTiempo = notification.Fecha.Date + notification.Horario; notification.TiempoRestanteEnvio = FechayTiempo - DateTime.Now; var tiempoSchedule = notification.TiempoRestanteEnvio.TotalMinutes; try { CrossLocalNotifications.Current.Cancel(notification.NotificationId); CrossLocalNotifications.Current.Show( notification.Title, notification.Message, notification.NotificationId, DateTime.Now.AddMinutes(tiempoSchedule)); } catch (Exception e) { await dialogService.ShowMessage("Error", e.Message); } CollectionNotification = new ObservableCollection <Notification>(ListaNotifications.OrderByDescending(x => x.TiempoRestanteEnvio.TotalMinutes)); }
public async Task Delete(Notification notification) { var confirmacion = await dialogService.ShowMessageConfirmacion("Mensaje", "¿Desea borrar este elemento?"); if (confirmacion) { var notificacionAntigua = ListaNotifications.Find(x => x.NotificationId == notification.NotificationId); CrossLocalNotifications.Current.Cancel(notification.NotificationId); dataService.Delete(notificacionAntigua); ListaNotifications.Remove(notification); CollectionNotification = new ObservableCollection <Notification>(ListaNotifications.OrderByDescending(x => x.TiempoRestanteEnvio.TotalMinutes)); } else { return; } }