コード例 #1
0
        public TaskTreeNodeViewModel(Task task, ITreeNodeContainerViewModel parent)
        {
            if (task == null)
            {
                throw new ArgumentNullException("task");
            }

            _task   = task;
            _parent = parent;
        }
コード例 #2
0
        /// <summary>
        /// add the task and missing ancestors back into the tree
        /// </summary>
        /// <param name="selectedTaskVM"></param>
        void AddTaskToTree(TaskViewModel selectedTaskVM)
        {
            ITreeNodeViewModel          child  = _removedNodes[selectedTaskVM];
            ITreeNodeContainerViewModel parent = child.Parent;
            bool inParentCollection            = parent.ChildNodes.Contains(child);

            while (parent != null && !inParentCollection)
            {
                parent.ChildNodes.Add(child);
                parent.ChildNodes.OrderBy(n => n.Title);
                SelectedNode = child;
                child        = parent;
                parent       = child.Parent;
                if (parent != null)
                {
                    inParentCollection = parent.ChildNodes.Contains(child);
                }
            }
        }
コード例 #3
0
        /// <summary>
        /// Remove the node and any empty ancestors from the tree
        /// </summary>
        void RemoveTaskFromTree(TaskTreeNodeViewModel taskNodeVM, TaskViewModel taskVM)
        {
            ITreeNodeContainerViewModel parent = taskNodeVM.Parent;

            if (parent != null)
            {
                _removedNodes.Add(taskVM, taskNodeVM);
                parent.ChildNodes.Remove(taskNodeVM);
                while (parent != null && parent.ChildNodes.Count == 0)
                {
                    ITreeNodeContainerViewModel child = parent;
                    parent = child.Parent;
                    if (parent != null)
                    {
                        parent.ChildNodes.Remove(child);
                    }
                }
            }
        }
コード例 #4
0
        public GoalTreeNodeViewModel(Goal goal, GoalData goalData, ITreeNodeContainerViewModel parent)
        {
            if (goal == null)
            {
                throw new ArgumentNullException("goal");
            }

            _goal = goal;

            List <Project> childProjects = goalData.GetChildProjectsContainingInactiveTasks(goal.GoalId);

            using (ProjectData pData = new ProjectData())
            {
                foreach (Project childProject in childProjects)
                {
                    _childNodes.Add(new ProjectTreeNodeViewModel(childProject, pData, this));
                }
            }

            _parent = parent;
        }
コード例 #5
0
        public ProjectTreeNodeViewModel(Project project, ProjectData projectData, ITreeNodeContainerViewModel parent)
        {
            if (project == null)
            {
                throw new ArgumentNullException("project");
            }

            _project = project;

            List <Task> childTasks = projectData.GetChildTasks(project.ProjectId);

            foreach (Task childTask in childTasks)
            {
                if (!childTask.IsActive)
                {
                    _childNodes.Add(new TaskTreeNodeViewModel(childTask, this));
                }
            }

            _parent = parent;
        }
コード例 #6
0
        public UnassignedTreeNodeViewModel(TaskData taskData, ProjectData projectData, ITreeNodeContainerViewModel parent)
        {
            if (taskData == null)
            {
                throw new ArgumentNullException("task data");
            }

            List <Project> unassignedProjects = projectData.GetUnassignedProjectsContainingInactiveTasks();

            foreach (Project unassignedProject in unassignedProjects)
            {
                _childNodes.Add(new ProjectTreeNodeViewModel(unassignedProject, projectData, this));
            }

            List <Task> unassignedTasks = taskData.GetUnassignedInactiveTasks();

            foreach (Task unassignedTask in unassignedTasks)
            {
                _childNodes.Add(new TaskTreeNodeViewModel(unassignedTask, this));
            }

            _parent = parent;
        }