예제 #1
0
        private void LoadTreeFromXML(XElement xele, TmTreeView tv)
        {
            TmNode node;
            foreach (XElement xnode in xele.Elements(ThemeListNode.TypeString))
            {
                node = new ThemeListNode();
                node.Load(xnode, false); // Add only the first node
                tv.Add(node);
            }

            foreach (XElement xnode in xele.Elements(CategoryNode.TypeString))
            {
                node = new CategoryNode();
                node.BeginUpdate();
                node.Load(xnode, true); // Add entire branch
                node.UpdateAge();
                node.EndUpdate();
                tv.Add(node);
            }

            foreach (XElement xnode in xele.Elements(ThemeNode.TypeString))
            {
                node = new ThemeNode();
                node.BeginUpdate();
                node.Load(xnode, true); // Add entire branch
                node.UpdateAge();
                node.EndUpdate();
                tv.Add(node);
            }
            tv.TextSortInit((string)xele.Attribute("sortorder"));
        }
예제 #2
0
        private void LoadTreeFromXML(XElement xele, TmTreeView tv)
        {
            TmNode node;
            string themelist = Enum.GetName(typeof(TmNodeType), TmNodeType.ThemeList).ToLower();
            foreach (XElement xnode in xele.Elements(themelist))
            {
                node = new TmNode(TmNodeType.ThemeList);
                node.Load(xnode, false); // Add only the first node
                tv.Add(node);
            }

            string category = Enum.GetName(typeof(TmNodeType), TmNodeType.Category).ToLower();
            foreach (XElement xnode in xele.Elements(category))
            {
                node = new TmNode(TmNodeType.Category);
                node.Load(xnode, true); // Add entire branch
                node.UpdateImageIndex(true);
                tv.Add(node);
            }

            string theme = Enum.GetName(typeof(TmNodeType), TmNodeType.Theme).ToLower();
            foreach (XElement xnode in xele.Elements(theme))
            {
                node = new TmNode(TmNodeType.Theme);
                node.Load(xnode, true); // Add entire branch
                node.UpdateImageIndex(true);
                tv.Add(node);
            }
            tv.TextSortInit((string)xele.Attribute("sortorder"));
        }