internal TreeItem(string id, string parent, ref TreeCollection <T> ownerCollection) { _id = id; _parent = parent; _ownerCollection = ownerCollection; _subitems = new LightCollection <string>(); }
private static void FromXmlNode(TreeCollection <T> treeCollection, ref TreeItemCollection <T> currentColl, XmlNode xnode, TreeItemXmlReaderDelegate readerDelegate) { XmlNodeList xlist = xnode.SelectNodes("./TreeItem"); for (int i = 0; i < xlist.Count; i++) { XmlNode currentNode = xlist[i]; TreeItem <T> newItem = currentColl.Add(treeCollection.GlobalCollection.CreateFreeKey(), default(T)); readerDelegate(ref newItem, currentNode); if (currentNode.ChildNodes.Count > 0) { TreeItemCollection <T> itemColl = newItem.Subitems; FromXmlNode(treeCollection, ref itemColl, xlist[i], readerDelegate); } } }
public static TreeCollection <T> FromXml(XmlDocument xdoc, TreeItemXmlReaderDelegate readerDelegate) { XmlNodeList xlist = xdoc.SelectNodes("TreeCollection//TreeItem"); TreeCollection <T> treeColl = new TreeCollection <T>(xlist.Count); xlist = xdoc.SelectNodes("TreeCollection/TreeItem"); for (int i = 0; i < xlist.Count; i++) { XmlNode currentNode = xlist[i]; TreeItem <T> newItem = treeColl.Items.Add(treeColl.GlobalCollection.CreateFreeKey(), default(T)); readerDelegate(ref newItem, currentNode); if (currentNode.ChildNodes.Count > 0) { TreeItemCollection <T> currentColl = treeColl.Items; FromXmlNode(treeColl, ref currentColl, xlist[i], readerDelegate); } } return(treeColl); }
internal TreeItemCollection(ref TreeCollection <T> ownerCollection, string parent) : this(ref ownerCollection, parent, new LightCollection <string>()) { }
internal TreeItemCollection(ref TreeCollection <T> ownerCollection, string parent, LightCollection <string> items) { _parent = parent; _items = new LightCollection <string>(items); _ownerCollection = ownerCollection; }