public static IGuiTask CreateTaskView(Window parent, IGuiCore core, int taskID) { ValidateCore(core); Task task = (Task)core.TaskManager.GetTask(taskID); ViewTaskDialog taskDialog = new ViewTaskDialog(parent, false); if(task == null) { return taskDialog; } if (task.StatePresent) { State state = (State)core.TaskManager.GetTaskState(task.StateID); if(state == null) { return taskDialog; } taskDialog.StateSource = core.TaskManager.GetTaskStateSource(state); if(taskDialog.StateSource == null) { return taskDialog; } taskDialog.BindState(); taskDialog.StateID = task.StateID; } else { taskDialog.StateSource = core.TaskManager.GetInitialTaskStateSource(); if(taskDialog.StateSource == null) { return taskDialog; } taskDialog.BindState(); } taskDialog.Title ="Edit Task"; taskDialog.ActorSource = core.TaskManager.ActorSource; taskDialog.BindActor(); if (task.ActorPresent) { taskDialog.ActorID = task.ActorID; } taskDialog.Description = task.Description; taskDialog.EndTime = task.EndTime; taskDialog.StartTime = task.StartTime; taskDialog.Comment = task.Comment; taskDialog.Priority = task.Priority; return taskDialog; }
public static IGuiTask CreateTaskView(Window parent, IGuiCore core) { ValidateCore(core); ViewTaskDialog taskDialog = new ViewTaskDialog(parent, true); taskDialog.Title ="Create Task"; taskDialog.ActorSource = core.TaskManager.ActorSource; taskDialog.StateSource = core.TaskManager.GetInitialTaskStateSource(); if(taskDialog.StateSource == null) { return taskDialog; } taskDialog.BindActor(); taskDialog.BindState(); return taskDialog; }