Example #1
0
 internal TreeItem(string id, string parent, ref TreeCollection <T> ownerCollection)
 {
     _id              = id;
     _parent          = parent;
     _ownerCollection = ownerCollection;
     _subitems        = new LightCollection <string>();
 }
Example #2
0
        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);
                }
            }
        }
Example #3
0
        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);
        }
Example #4
0
 internal TreeItemCollection(ref TreeCollection <T> ownerCollection, string parent)
     : this(ref ownerCollection, parent, new LightCollection <string>())
 {
 }
Example #5
0
 internal TreeItemCollection(ref TreeCollection <T> ownerCollection, string parent, LightCollection <string> items)
 {
     _parent          = parent;
     _items           = new LightCollection <string>(items);
     _ownerCollection = ownerCollection;
 }