Exemplo n.º 1
0
        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;
        }
Exemplo n.º 2
0
        private TreeNode AddTaskToTreeView(TreeNode parentNode, Task task)
        {
            TreeNode node = parentNode.Nodes.Add(task.Label);
            node.Tag = task;

            return node;
        }
Exemplo n.º 3
0
        private void PopulateTaskView(Task rootTask)
        {
            ResetTaskView();

            TreeNode root = tvTasks.Nodes[0];
            root.Tag = rootTask;
            AddTaskToTreeView(root, new GhostTask());
        }
Exemplo n.º 4
0
 public bool Activate(Task task)
 {
     bool needActivation = !_db.Ext().IsActive(task);
     if (needActivation)
     {
         _db.Activate(task, 1);
     }
     return needActivation;
 }
Exemplo n.º 5
0
        private static Task internalFind(Task searchIn)
        {
            Task temp = null;
            if (searchIn != null)
            {
                for (temp = searchIn; temp.Next != null; temp = temp.Next)
                    ;
            }

            return temp;
        }
Exemplo n.º 6
0
 private static Task FindLastBrother(Task task)
 {
     return internalFind(task);
 }
Exemplo n.º 7
0
 private static Task FindLastChild(Task parent)
 {
     return internalFind(parent.FirstChild);
 }