public override void Execute(object parameter) { bool? newTask = null; using (TaskRepository taskRepository = new TaskRepository()) { newTask = taskRepository.Save(_task); } if (newTask == null) { return; } TaskListViewModel taskList = _mainWindow.GetTaskListTabForProject(_task.Project, true); if (newTask.Value) { taskList.Mediator.NotifyColleagues(ViewModelMessages.TaskAdded, _task); } else { taskList.Mediator.NotifyColleagues(ViewModelMessages.TaskAmended, _task); } //now close the tab and take us to the task list for this project. TaskDetailsViewModel taskDetails = _mainWindow.FindTaskDetailsTabForTask(_task); _mainWindow.Tabs.Remove(taskDetails); _mainWindow.SetActiveTab(taskList); }
public override void Execute(object parameter) { Task selectedTask = _mainWindow.GetSelectedTask(); selectedTask.Done = true; bool? saved = null; using (TaskRepository repository = new TaskRepository()) { saved = repository.Save(selectedTask); } if (saved == null) { return; } TaskListViewModel vm = _mainWindow.GetTaskListTabForProject(selectedTask.Project, true); vm.Mediator.NotifyColleagues(ViewModelMessages.TaskCompleted, selectedTask); }