Пример #1
0
        public override void Build(XmlNode xmlNode, IBundle owner)
        {
            ToolStripItem newItem = ToolbarItemBuilder.Build(xmlNode, owner);

            Items.Add(newItem);
            OnItemAdded(newItem);
        }
Пример #2
0
        public override void Build(XmlNode xmlNode, IBundle owner)
        {
            ToolStrip toolStrip = null;

            if (xmlNode.Name == "ToolStrip")
            {
                toolStrip = GetOrCreate(XmlUtility.ReadAttribute(xmlNode, "id"));
            }
            else if (xmlNode.Name == "ToolbarItem")
            {
                //insert to default ToolBar
                toolStrip = GetOrCreate(string.Empty);
                ToolStripItem item = ToolbarItemBuilder.Build(xmlNode, owner);
                ControlUtility.Invoke(toolStrip, () => toolStrip.Items.Add(item));
            }
            if (toolStrip != null)
            {
                List <ToolStripItem> items = ToolbarItemBuilder.Build(xmlNode.ChildNodes, owner);
                ControlUtility.Invoke(toolStrip, () => toolStrip.Items.AddRange(items.ToArray()));
            }
        }