public Task Add(Task parent, String label, String description) { Task newTask = new Task(label, description); _db.Set(newTask); Task directParent = null; if (!AreThereOtherTasks()) { _rootTask.FirstChild = newTask; } else if (parent == null) { directParent = FindLastBrother(_rootTask.FirstChild); directParent.Next = newTask; } else { directParent = FindLastChild(parent); if (directParent == null) { parent.FirstChild = newTask; directParent = parent; } else { directParent.Next = newTask; } } if (directParent != null) _db.Set(directParent); _db.Commit(); return newTask; }
private TreeNode AddTaskToTreeView(TreeNode parentNode, Task task) { TreeNode node = parentNode.Nodes.Add(task.Label); node.Tag = task; return node; }
private void PopulateTaskView(Task rootTask) { ResetTaskView(); TreeNode root = tvTasks.Nodes[0]; root.Tag = rootTask; AddTaskToTreeView(root, new GhostTask()); }
public bool Activate(Task task) { bool needActivation = !_db.Ext().IsActive(task); if (needActivation) { _db.Activate(task, 1); } return needActivation; }
private static Task internalFind(Task searchIn) { Task temp = null; if (searchIn != null) { for (temp = searchIn; temp.Next != null; temp = temp.Next) ; } return temp; }
private static Task FindLastBrother(Task task) { return internalFind(task); }
private static Task FindLastChild(Task parent) { return internalFind(parent.FirstChild); }