Beispiel #1
0
        public void AddTab(string tabName, Type[] itemTypes)
        {
            ToolboxTab toolboxTab = new ToolboxTab();

            toolboxTab.Name = tabName;

            ToolboxItemCollection toolboxItems = new ToolboxItemCollection();

            for (int i = 0; i < itemTypes.Length; i++)
            {
                ToolboxItem toolboxItem = new ToolboxItem();

                toolboxItem.Type = itemTypes[i];
                toolboxItem.Name = itemTypes[i].Name;
                toolboxItems.Add(toolboxItem);
            }
            toolboxTab.ToolboxItems = toolboxItems;

            m_ToolboxTabCollection.Add(toolboxTab);
        }
Beispiel #2
0
        private ToolboxTabCollection PopulateToolboxTabs(XmlDocument xmlDocument)
        {
            if (xmlDocument == null)
            {
                return(null);
            }

            XmlNode toolboxNode = xmlDocument.FirstChild;

            if (toolboxNode == null)
            {
                return(null);
            }

            XmlNode tabCollectionNode = toolboxNode.FirstChild;

            if (tabCollectionNode == null)
            {
                return(null);
            }

            XmlNodeList tabsNodeList = tabCollectionNode.ChildNodes;

            if (tabsNodeList == null)
            {
                return(null);
            }

            ToolboxTabCollection toolboxTabs = new ToolboxTabCollection();

            foreach (XmlNode tabNode in tabsNodeList)
            {
                if (tabNode == null)
                {
                    continue;
                }

                XmlNode propertiesNode = tabNode.FirstChild;
                if (propertiesNode == null)
                {
                    continue;
                }

                XmlNode nameNode = propertiesNode[Strings.Name];
                if (nameNode == null)
                {
                    continue;
                }

                ToolboxTab toolboxTab = new ToolboxTab();
                toolboxTab.Name = nameNode.InnerXml.ToString();
                PopulateToolboxItems(tabNode, toolboxTab);
                toolboxTabs.Add(toolboxTab);
            }
            if (toolboxTabs.Count == 0)
            {
                return(null);
            }

            return(toolboxTabs);
        }