Пример #1
0
        private UIItem[] ParseItemsOfTab(XElement uiTab)
        {
            List <UIItem> items = new List <UIItem>();
            XElement      root  = uiTab.Element("UIItems");

            if (root == null)
            {
                return(null);
            }
            foreach (XElement itElement in root.Elements())
            {
                string type = itElement.Name.LocalName;
                switch (type)
                {
                case "UICommandGroup":
                    UICommandGroup uig = ParseUICommandGroup(itElement);
                    if (uig != null)
                    {
                        items.Add(uig);
                    }
                    break;
                }
            }
            return(items.Count > 0 ? items.ToArray() : null);
        }
Пример #2
0
        private UICommandGroup ParseUICommandGroup(XElement itElement)
        {
            UICommand[]    cmds     = ParseUICommands(itElement);
            UICommandGroup uig      = new UICommandGroup(itElement.Attribute("name").Value, itElement.Attribute("text").Value, cmds);
            string         provider = null;

            if (itElement.Attribute("provider") != null)
            {
                provider = itElement.Attribute("provider").Value;
            }
            if (provider != null && provider != "assembly:class")
            {
                uig.Provider = provider;
            }
            uig.Visible        = GetBoolAttribute(itElement, "visible");
            uig.AllowCollapsed = GetBoolAttribute(itElement, "allowcollapsed");//AllowCollapsed
            return(uig);
        }