//------------------------------------------------------------------------------------ /// <summary> /// Given a treeID for this product's feature tree, returns the full path for that /// tree node. /// </summary> //------------------------------------------------------------------------------------ public virtual string GetTreePath(int treeID, ProductTreeFormat treeFormat) { DatastoreItemList storeItemList = GetStoreItemList(); if (storeItemList != null) { ProductStudio.PsCoreTreeTypeEnum treeType = ProductStudio.PsCoreTreeTypeEnum.psCoreTreeTypeProduct; ProductStudio.Node rootNode = storeItemList.Datastore.get_RootNodeEx(treeType); ProductStudio.Node currNode = rootNode.FindNodeInSubtree(treeID); List <string> nodeNames = new List <string>(); while (currNode != null && currNode.ID > 1) { nodeNames.Insert(0, currNode.Name); currNode = currNode.Parent; } string fullPath = treeFormat == ProductTreeFormat.IncludeProduct ? StoreID.Name : ""; foreach (string name in nodeNames) { fullPath += "\\" + name; } return(fullPath); } return(null); }
//------------------------------------------------------------------------------------ /// <summary> /// Returns the root node of the Product Tree for this product. /// </summary> //------------------------------------------------------------------------------------ public Node GetProductTreeRootNode() { DatastoreItemList storeItemList = GetStoreItemList(); if (storeItemList != null) { ProductStudio.PsCoreTreeTypeEnum treeType = ProductStudio.PsCoreTreeTypeEnum.psCoreTreeTypeProduct; return(storeItemList.Datastore.get_RootNodeEx(treeType)); } return(null); }
//------------------------------------------------------------------------------------ /// <summary> /// Returns the complete product tree for the current product. The root will have /// parent id = -200. The returned tree is a depth-first representation of the product /// hierarchy. /// </summary> //------------------------------------------------------------------------------------ public virtual void PopulateTree(TreeView treeView, int startingTreeID) { DatastoreItemList storeItemList = GetStoreItemList(); if (storeItemList != null) { ProductStudio.PsCoreTreeTypeEnum treeType = ProductStudio.PsCoreTreeTypeEnum.psCoreTreeTypeProduct; ProductStudio.Node rootNode = storeItemList.Datastore.get_RootNodeEx(treeType); ProductAreaTree tree = new ProductAreaTree(rootNode); tree.PopulateTree(treeView, startingTreeID); } }