Пример #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;
        }
Пример #2
0
        private TreeNode AddTaskToTreeView(TreeNode parentNode, Task task)
        {
            TreeNode node = parentNode.Nodes.Add(task.Label);
            node.Tag = task;

            return node;
        }
Пример #3
0
        private void PopulateTaskView(Task rootTask)
        {
            ResetTaskView();

            TreeNode root = tvTasks.Nodes[0];
            root.Tag = rootTask;
            AddTaskToTreeView(root, new GhostTask());
        }
Пример #4
0
 public bool Activate(Task task)
 {
     bool needActivation = !_db.Ext().IsActive(task);
     if (needActivation)
     {
         _db.Activate(task, 1);
     }
     return needActivation;
 }
Пример #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;
        }
Пример #6
0
 private static Task FindLastBrother(Task task)
 {
     return internalFind(task);
 }
Пример #7
0
 private static Task FindLastChild(Task parent)
 {
     return internalFind(parent.FirstChild);
 }