private void ReAddReminderDate( int notificationId, TaskListItemViewModel taskList, GoogleTask task) { if (!TasksHelper.CanReAddReminder(task.RemindOn.Value)) { return; } string notes = TasksHelper.GetNotesForNotification(task.Notes); _notificationService.RemoveScheduledNotification(notificationId); _notificationService.ScheduleNotification(new TaskReminderNotification { Id = notificationId, TaskListId = taskList.Id, TaskId = task.ID, TaskListTitle = taskList.Title, TaskTitle = task.Title, TaskBody = notes, DeliveryOn = task.RemindOn.Value }); }
private async Task MoveCurrentTaskAsync() { ShowTaskProgressRing = true; var moveResponse = await _dataService .TaskService .MoveAsync(SelectedTaskList.TaskListID, CurrentTask.TaskID, null, null); if (!moveResponse.Succeed) { ShowTaskProgressRing = false; await _dialogService.ShowMessageDialogAsync( $"An error occurred while trying to move the selected task from {_currentTaskList.Title} to {SelectedTaskList.Title}", $"Error: {moveResponse.Message}."); return; } var movedTask = moveResponse.Result; if (movedTask != null && TasksHelper.HasReminderId(movedTask.RemindOnGUID, out int id) && TasksHelper.CanReAddReminder(movedTask.RemindOn.Value)) { string notes = TasksHelper.GetNotesForNotification(movedTask.Notes); _notificationService.RemoveScheduledNotification(id); _notificationService.ScheduleNotification(new TaskReminderNotification { Id = id, TaskListId = SelectedTaskList.Id, TaskId = movedTask.ID, TaskListTitle = SelectedTaskList.Title, TaskTitle = movedTask.Title, TaskBody = notes, DeliveryOn = movedTask.RemindOn.Value }); } if (!CurrentTask.HasParentTask) { _messenger.Send(CurrentTask.TaskID, $"{MessageType.TASK_DELETED_FROM_PANE_FRAME}"); } else { _messenger.Send( new KeyValuePair <string, string>(CurrentTask.ParentTask, CurrentTask.TaskID), $"{MessageType.SUBTASK_DELETED_FROM_PANE_FRAME}"); } var subTasks = GetSubTasksToSave(false, true); subTasks.ForEach(st => st.ParentTask = moveResponse.Result.GoogleTaskID); ShowTaskProgressRing = false; await SaveSubTasksAsync(subTasks, false, true, Enumerable.Empty <TaskItemViewModel>().ToList()); _changedProperties.Clear(); _messenger.Send(false, $"{MessageType.OPEN_PANE}"); _messenger.Send( $"Task sucessfully moved from: {_currentTaskList.Title} to: {SelectedTaskList.Title}", $"{MessageType.SHOW_IN_APP_NOTIFICATION}"); }