Ejemplo n.º 1
0
        /// <summary>
        /// Adds a project tree node as a child of another project tree node
        /// </summary>
        /// <param name="node">The project node to add as a child of another node</param>
        /// <param name="parent">The parent node to child the first node</param>
        /// <param name="operation">The operation to perform</param>
        protected void InternalSetParent(ProjectTreeNode node, NestedProjectTreeNode parent, SetParentOperation operation)
        {
            if (operation == SetParentOperation.Add)
            {
                if (node.parentNode != parent)
                {
                    throw new ArgumentException(@"The provided node is not a child of this node", nameof(node));
                }
            }
            else
            {
                if (node.parentNode != null)
                {
                    throw new ArgumentException(@"Cannot add as a child a node that is already parented by another node", nameof(node));
                }
            }

            node.parentNode = parent;
        }
Ejemplo n.º 2
0
 /// <summary>
 /// Initializes a new instance of the ProjectTree class
 /// </summary>
 public ProjectTree()
 {
     _rootNode = new NestedProjectTreeNode();
 }