private void CreateTestWorkTree()
        {
            workTree = new Tree();
            // First branch
            TreeNode rootNode_1 = new TreeNode(workTree, null);
            workTree.RootNodes.Add(rootNode_1);
            TreeNode childNode_1_1 = new TreeNode(workTree, rootNode_1);
            TreeNode childNode_1_2 = new TreeNode(workTree, rootNode_1);
            rootNode_1.ChildNodes.Add(childNode_1_1);
            rootNode_1.ChildNodes.Add(childNode_1_2);

            // Second branch
            TreeNode rootNode_2 = new TreeNode(workTree, null);
            workTree.RootNodes.Add(rootNode_2);
            TreeNode childNode_2_1 = new TreeNode(workTree, rootNode_2);
            TreeNode childNode_2_2 = new TreeNode(workTree, rootNode_2);
            rootNode_2.ChildNodes.Add(childNode_2_1);
            rootNode_2.ChildNodes.Add(childNode_2_2);

            // Third branch
            TreeNode rootNode_3 = new TreeNode(workTree, null);
            workTree.RootNodes.Add(rootNode_3);
            TreeNode childNode_3_1 = new TreeNode(workTree, rootNode_3);
            TreeNode childNode_3_2 = new TreeNode(workTree, rootNode_3);
            rootNode_3.ChildNodes.Add(childNode_3_1);
            rootNode_3.ChildNodes.Add(childNode_3_2);
        }
 public TreeNode(Tree ownerTree, TreeNode ownerNode, int nodeCode, string nodeHeader)
     : this(ownerTree, ownerNode)
 {
     header = nodeHeader;
     internalCode = nodeCode;
     SetGlobalNodeCode();
 }
 public int LoadRootNodes()
 {
     TreeNode newRootNode;
     foreach (TreeNode sourceRootNode in workTree.RootNodes) {
         newRootNode = new TreeNode(tree, null, sourceRootNode.InternalCode, sourceRootNode.Header);
         tree.RootNodes.Add(newRootNode);
     }
     return tree.RootNodes.Count;
 }
 /// <summary>
 /// .ctor
 /// </summary>
 /// <param name="ownerTree">owner tree object</param>
 /// <param name="ownerNode">ownre node object</param>
 public TreeNode(Tree ownerTree, TreeNode ownerNode)
 {
     this.ownerTree = ownerTree;
     this.ownerNode = ownerNode;
     childNodes = new TreeNodeCollection();
     internalCode = GetDefaultNodeCode();
     SetGlobalNodeCode();
     header = String.Format("Node #{0}", internalCode);
 }
 public int LoadChildNodes(TreeNode parentNode)
 {
     if (parentNode == null) return 0;
     parentNode.ChildNodes.Clear();
     if (parentNode.InternalCode == 1) {
         TreeNode childNode = new TreeNode(tree, parentNode, 1, "Child node 1");
         parentNode.ChildNodes.Add(childNode);
         childNode = new TreeNode(tree, parentNode, 2, "Child node 2");
         parentNode.ChildNodes.Add(childNode);
         childNode = new TreeNode(tree, parentNode, 3, "Child node 3");
         parentNode.ChildNodes.Add(childNode);
     }
     return parentNode.ChildNodes.Count;
 }
 public void Add(TreeNode item)
 {
     items.Add(item);
 }
 public TreeNodeViewModel(TreeNode currentNode, ITreeService treeService)
 {
     // TODO: Complete member initialization
     this.currentNode = currentNode;
     this.treeService = treeService;
 }
 public TreeNode(Tree ownerTree, TreeNode ownerNode, string nodeHeader)
     : this(ownerTree, ownerNode)
 {
     header = nodeHeader;
 }