Example #1
0
 private Boolean TaskHasIcon(MindMapTaskItem taskItem)
 {
     return((m_TaskIcons != null) &&
            (taskItem != null) &&
            taskItem.IsTask &&
            (taskItem.HasIcon || (m_ShowParentAsFolder && taskItem.IsParent)));
 }
        private Boolean TaskHasIcon(MindMapTaskItem taskItem)
        {
            if ((m_TaskIcons == null) || (taskItem == null) || !taskItem.IsTask)
            {
                return(false);
            }

            return(taskItem.HasIcon || (m_ShowParentAsFolder && taskItem.IsParent));
        }
        private void RebuildTreeView(TaskList tasks)
        {
            // Snapshot the expanded tasks so we can restore them afterwards
            var expandedIDs = GetExpandedItems(RootNode);

            // And the selection
            var selID = UniqueID(SelectedNode);

            Clear();

            if (tasks.GetTaskCount() == 0)
            {
                return;
            }

            BeginUpdate();

            var  task       = tasks.GetFirstTask();
            bool taskIsRoot = !task.GetNextTask().IsValid();             // no siblings

            TreeNode rootNode = null;

            if (taskIsRoot)
            {
                var taskItem = new MindMapTaskItem(task);

                m_Items.Add(taskItem.ID, taskItem);
                rootNode = AddRootNode(taskItem, taskItem.ID);


                // First Child
                AddTaskToTree(task.GetFirstSubtask(), rootNode);
            }
            else
            {
                // There is more than one 'root' task so create a real root parent
                var projName = GetProjectName(tasks);
                rootNode = AddRootNode(new MindMapTaskItem(projName));

                AddTaskToTree(task, rootNode);
            }

            // Restore expanded state
            if (!SetExpandedItems(expandedIDs))
            {
                rootNode.Expand();
            }

            EndUpdate();
            SetSelectedNode(selID);

            if (rootNode != null)
            {
                RefreshNodeFont(rootNode, true);
            }
        }
        private MindMapTaskItem GetRealTaskItem(MindMapTaskItem taskItem)
        {
            if ((taskItem != null) && taskItem.IsReference)
            {
                MindMapTaskItem refItem;

                if (m_Items.TryGetValue(taskItem.ReferenceId, out refItem))
                {
                    return(refItem);
                }
            }

            // all else
            return(taskItem);
        }
        CheckBoxState GetItemCheckboxState(MindMapTaskItem taskItem)
        {
            if (taskItem.IsDone(false))
            {
                return(CheckBoxState.CheckedNormal);
            }

            if (taskItem.HasSomeSubtasksDone)
            {
                return(CheckBoxState.MixedNormal);
            }

            // else
            return(CheckBoxState.UncheckedNormal);
        }
        private bool AddTaskToTree(Task task, TreeNode parent, bool select = false)
        {
            if (!task.IsValid())
            {
                return(true);                // not an error
            }
            var taskID   = task.GetID();
            var taskItem = new MindMapTaskItem(task);

            var node = AddNode(taskItem, parent, taskID);

            if (node == null)
            {
                return(false);
            }

            RefreshItemFont(node, false);

            // First Child
            if (!AddTaskToTree(task.GetFirstSubtask(), node))
            {
                return(false);
            }

            // First Sibling
            if (!AddTaskToTree(task.GetNextTask(), parent))
            {
                return(false);
            }

            m_Items.Add(taskID, taskItem);

            if (select)
            {
                SelectedNode = node;
            }

            return(true);
        }
 public void FixupParentID(MindMapTaskItem parent)
 {
     m_ParentID = parent.ID;
 }