public void CreateTask() { IGuiTask taskView = null; try { taskView = GuiFactory.CreateTaskView(window, (IGuiCore)this); if (taskView == null) { return; } } catch (ManagementException ex) { IGuiMessageDialog dialog = MessageFactory.CreateErrorDialog(ex, window); dialog.Title = "Create Task"; dialog.ShowDialog(); return; } Tracker.ActorSource = TaskManager.ActorSource; Tracker.BindTask(); if (taskView.ShowDialog() == (int)Gtk.ResponseType.Ok) { Task newTask = (Task)TaskManager.CreateTask(); if (newTask == null) { return; } if (taskView.ActorPresent) { newTask.ActorID = taskView.ActorID; } else { newTask.ActorPresent = false; } newTask.Description = taskView.Description; newTask.EndTime = taskView.EndTime; newTask.StartTime = taskView.StartTime; newTask.StateID = taskView.StateID; newTask.Priority = taskView.Priority; newTask.Save(); Tracker.TaskSource = TaskManager.TaskSource; Tracker.BindTask(); if (autosave) { SaveProject(); } } }
public void UpdateTaskState(int taskID) { IGuiTask taskView = null; try { taskView = GuiFactory.CreateTaskView(window, (IGuiCore)this, taskID); } catch (ManagementException ex) { IGuiMessageDialog dialog = MessageFactory.CreateErrorDialog(ex, window); dialog.Title = "Change Task State"; dialog.ShowDialog(); return; } if (taskView.ShowDialog() == (int)Gtk.ResponseType.Ok) { Task task = (Task)TaskManager.GetTask(taskID); if (task == null) { return; } if (taskView.ActorPresent) { task.ActorID = taskView.ActorID; } task.Description = taskView.Description; task.EndTime = taskView.EndTime; task.StartTime = taskView.StartTime; task.StateID = taskView.StateID; task.Priority = taskView.Priority; task.Save(); Tracker.TaskSource = TaskManager.TaskSource; Tracker.BindTask(); if (autosave) { SaveProject(); } } }