Esempio n. 1
0
        /// ------------------------------------------------------------------------------------
        /// <summary>
        /// Tells the side bar adapter to setup it's menus so they show up on the application's
        /// view menu. This method should be called after all the tabs and tab items have been
        /// created.
        /// </summary>
        /// <param name="menuAdapter">Menu adapter used by the application.</param>
        /// <param name="insertBeforeItem">Name of the menu item before which the sidebar
        /// menus will be added.</param>
        /// ------------------------------------------------------------------------------------
        public void SetupViewMenuForSideBarTabs(ITMAdapter adapter, string insertBeforeItem)
        {
            TMAdapter dnbAdapter = adapter as TMAdapter;

            if (dnbAdapter == null || dnbAdapter.m_dnbMngr == null)
            {
                // Use this block when the menu adapter isn't one or our DNB ones defined in
                // this assembly. TODO: Need to call AddItem for each subitem in each tab's menu.
                foreach (SideBarTab tab in m_navPane.Items)
                {
                    adapter.AddMenuItem(tab.MenuItemProperties, null, insertBeforeItem);
                }
            }

            // When the menu adapter is one of a type from our assembly, then use it's DNB
            // manager instead of the one instantiated in SetupSideBarsContextMenu. Add the
            // side bar's context menu to the DNB manager and set it to popup for as the
            // side bar's default context menu.
            m_dnbMngr = dnbAdapter.m_dnbMngr;
            m_dnbMngr.ContextMenus.Add(m_contextMenu);
            m_dnbMngr.SetContextMenuEx(m_navPane, "sbcontextmenu");

            // Insert our tab's menus before the specified item.
            foreach (SideBarTab tab in m_navPane.Items)
            {
                dnbAdapter.InsertMenuItem(tab.Menu, insertBeforeItem, false);
                tab.Menu.Visible = true;
            }
        }
Esempio n. 2
0
        private void button1_Click(object sender, System.EventArgs e)
        {
            Bar bar = this.Parent as Bar;

            if (bar == null)
            {
                MessageBox.Show("Control is not on the bar");
            }
            else
            {
                // If reference to DotNetBarManager is needed this is how to get it
                DotNetBarManager  manager  = bar.Owner as DotNetBarManager;
                DockContainerItem dockItem = null;
                if (bar.SelectedDockTab < 0)              // There is only one DockContainerItem on the bar
                {
                    dockItem = bar.Items[0] as DockContainerItem;
                }
                else
                {
                    dockItem = bar.Items[bar.SelectedDockTab] as DockContainerItem;
                }

                MessageBox.Show("Control is on the bar: " + bar.Name + " (" + bar.Text + ") and on DockContainerItem: " + dockItem.Name + " (" + dockItem.Text + ")");
            }
        }
Esempio n. 3
0
        /// ------------------------------------------------------------------------------------
        /// <summary>
        ///
        /// </summary>
        /// ------------------------------------------------------------------------------------
        private void SetupSideBarsContextMenu()
        {
            // Do nothing if the context menu has already been created.
            if (m_contextMenu != null)
            {
                return;
            }

            m_dnbMngr = new DotNetBarManager();

            m_contextMenu = new ButtonItem("sbcontextmenu");

            m_contextMenu.PopupShowing += new EventHandler(HandleSideBarContextMenuShowing);
            m_contextMenu.PopupOpen    +=
                new DotNetBarManager.PopupOpenEventHandler(HandleSideBarContextMenuPopup);

            ButtonItem item = new ButtonItem(kLargeIconModeItem, "Large Icons");

            item.OptionGroup = m_contextMenu.Name;
            item.Click      += new EventHandler(HandleSideBarContextMenuClick);
            m_contextMenu.SubItems.Add(item);

            item             = new ButtonItem(kSmallIconModeItem, "Small Icons");
            item.OptionGroup = m_contextMenu.Name;
            item.Click      += new EventHandler(HandleSideBarContextMenuClick);
            m_contextMenu.SubItems.Add(item);

            item            = new ButtonItem(kHideSideBar, "Hide Side Bar");
            item.BeginGroup = true;
            item.Click     += new EventHandler(HandleSideBarContextMenuClick);
            m_contextMenu.SubItems.Add(item);

            SetContextMenuImages();

            m_dnbMngr.ContextMenus.Add(m_contextMenu);
            m_dnbMngr.SetContextMenuEx(m_navPane, "sbcontextmenu");
        }
Esempio n. 4
0
        /// <summary>
        /// Sets the visible property of DockContainerItem and hides the bar if the given item is the last visible item on the bar.
        /// It will also automatically display the bar if bar is not visible.
        /// </summary>
        /// <param name="item">DockContainerItem to set visibility for.</param>
        /// <param name="visible">Indicates the visibility of the item</param>
        private void SetDockContainerVisible(DevComponents.DotNetBar.DockContainerItem item, bool visible)
        {
            if (item == null || item.Visible == visible)
            {
                return;
            }

            int visibleCount = 0;

            DevComponents.DotNetBar.Bar containerBar = item.ContainerControl as DevComponents.DotNetBar.Bar;
            if (containerBar == null)
            {
                // If bar has not been assigned yet just set the visible property and exit
                item.Visible = visible;
                return;
            }

            DotNetBarManager manager = containerBar.Owner as DotNetBarManager;

            if (manager != null)
            {
                manager.SuspendLayout = true;
            }

            try
            {
                foreach (DevComponents.DotNetBar.BaseItem dockItem in containerBar.Items)
                {
                    if (dockItem.Visible)
                    {
                        visibleCount++;
                    }
                }

                if (visible)
                {
                    item.Visible = true;
                    if (!containerBar.AutoHide && !containerBar.Visible && visibleCount <= 1)
                    {
                        containerBar.Visible = true;
                        if (containerBar.Tag == null)
                        {
                            containerBar.Tag = "";
                        }
                        if (containerBar.Tag.ToString() == "autohide")
                        {
                            containerBar.AutoHide = true;
                        }
                    }
                }
                else
                {
                    item.Visible = false;
                    if (visibleCount == 1)
                    {
                        // Remember auto-hide setting
                        if (containerBar.AutoHide)
                        {
                            containerBar.AutoHide = false;
                            containerBar.Tag      = "autohide";
                        }
                        else
                        {
                            containerBar.Tag = "";
                        }

                        containerBar.Visible = false;
                    }
                }
            }
            finally
            {
                if (manager != null)
                {
                    manager.SuspendLayout = false;
                }
                else
                {
                    containerBar.RecalcLayout();
                }
            }
        }
Esempio n. 5
0
        /// <summary>
        /// Overrides method to create the toolbars, but witout the items on them,
        /// which are handled elsewhere.
        /// </summary>
        /// <param name="groupCollection">Collection of toolbar definitions to create.</param>
        public override void CreateUIForChoiceGroupCollection(ChoiceGroupCollection groupCollection)
        {
            m_choiceGroupCollection = groupCollection;
            DotNetBarManager manager = (DotNetBarManager)m_mediator.PropertyTable.GetValue("DotNetBarManager");
//			manager.SaveLayout("testLayout.xml");

            // If the menubar has already been added, remove it,
            // and re-add it after adding the toolbars, or it won't be at the top.
            Bar menuBar = null;

            foreach (Bar bar in manager.Bars)
            {
                if (bar.MenuBar)
                {
                    menuBar  = bar;
                    bar.Name = "menubar";                  //there may be some better place to put this, but I couldn't quickly find where the menubar is created.
                    manager.Bars.Remove(menuBar);
                    break;
                }
            }



            // Create new Bars.
            foreach (ChoiceGroup group in groupCollection)
            {
                Bar toolbar = new Bar(group.Id);
                toolbar.Name    = group.Id;
                toolbar.CanHide = true;
                if (m_mediator.PropertyTable.GetBoolProperty("UseOffice2003Style", false))
                {
                    Manager.Style                = eDotNetBarStyle.Office2003;
                    toolbar.ThemeAware           = false;
                    toolbar.Style                = eDotNetBarStyle.Office2003;
                    toolbar.ItemsContainer.Style = eDotNetBarStyle.Office2003;
                    toolbar.GrabHandleStyle      = eGrabHandleStyle.Office2003;
                }
                else
                {
                    toolbar.Style = eDotNetBarStyle.OfficeXP;
                    toolbar.ItemsContainer.Style = eDotNetBarStyle.OfficeXP;
                    toolbar.GrabHandleStyle      = eGrabHandleStyle.StripeFlat;
                }
                toolbar.WrapItemsDock  = true;
                toolbar.WrapItemsFloat = false;
                toolbar.Tag            = group;
                toolbar.CanCustomize   = false;
                toolbar.CanUndock      = false;
                group.ReferenceWidget  = toolbar;
                group.OnDisplay(null, null);                 // Ensure the toolbar has its items added.
                manager.Bars.Add(toolbar);
                toolbar.DockSide = eDockSide.Top;
            }

            // Re-add the menu bar
            if (menuBar != null)
            {
                manager.Bars.Add(menuBar);;
                menuBar.DockSide = eDockSide.Top;
            }

            DepersistLayout();
        }
Esempio n. 6
0
		private bool HasFloatingBars(DotNetBarManager manager)
		{
			bool bRet=false;
			foreach(Bar bar in manager.Bars)
			{
				if(bar.DockSide==eDockSide.None && !bar.AutoHide)
				{
					bRet=true;
					break;
				}
			}
			return bRet;
		}
Esempio n. 7
0
 private void InitializeComponent()
 {
     this.components          = new Container();
     this.mdiClient1          = new MdiClient();
     this.timer_send          = new System.Windows.Forms.Timer(this.components);
     this.NetBarManager       = new DotNetBarManager(this.components);
     this.dockSite4           = new DockSite();
     this.bar1                = new Bar();
     this.panelDockContainer1 = new PanelDockContainer();
     this.syslogbox           = new TextBox();
     this.panelDockContainer2 = new PanelDockContainer();
     this.dockContainerItem1  = new DockContainerItem();
     this.dockContainerItem2  = new DockContainerItem();
     this.dockSite1           = new DockSite();
     this.dockSite2           = new DockSite();
     this.dockSite8           = new DockSite();
     this.dockSite5           = new DockSite();
     this.dockSite6           = new DockSite();
     this.dockSite7           = new DockSite();
     this.dockSite3           = new DockSite();
     this.tabStrip1           = new TabStrip();
     this.dockSite4.SuspendLayout();
     this.bar1.BeginInit();
     this.bar1.SuspendLayout();
     this.panelDockContainer1.SuspendLayout();
     base.SuspendLayout();
     this.mdiClient1.BackColor = Color.FromArgb(0xc2, 0xd9, 0xf7);
     this.mdiClient1.Dock      = DockStyle.Fill;
     this.mdiClient1.Location  = new Point(0, 0x1a);
     this.mdiClient1.Name      = "mdiClient1";
     this.mdiClient1.Size      = new Size(0x265, 0x109);
     this.mdiClient1.TabIndex  = 0x19;
     this.timer_send.Enabled   = true;
     this.timer_send.Interval  = 0x1388;
     this.timer_send.Tick     += new EventHandler(this.timer_send_Tick);
     this.NetBarManager.AutoDispatchShortcuts.Add(eShortcut.F1);
     this.NetBarManager.AutoDispatchShortcuts.Add(eShortcut.CtrlC);
     this.NetBarManager.AutoDispatchShortcuts.Add(eShortcut.CtrlA);
     this.NetBarManager.AutoDispatchShortcuts.Add(eShortcut.CtrlV);
     this.NetBarManager.AutoDispatchShortcuts.Add(eShortcut.CtrlX);
     this.NetBarManager.AutoDispatchShortcuts.Add(eShortcut.CtrlZ);
     this.NetBarManager.AutoDispatchShortcuts.Add(eShortcut.CtrlY);
     this.NetBarManager.AutoDispatchShortcuts.Add(eShortcut.Del);
     this.NetBarManager.AutoDispatchShortcuts.Add(eShortcut.Ins);
     this.NetBarManager.BottomDockSite     = this.dockSite4;
     this.NetBarManager.DefinitionName     = "";
     this.NetBarManager.EnableFullSizeDock = false;
     this.NetBarManager.LeftDockSite       = this.dockSite1;
     this.NetBarManager.ParentForm         = this;
     this.NetBarManager.RightDockSite      = this.dockSite2;
     this.NetBarManager.Style = eDotNetBarStyle.Office2007;
     this.NetBarManager.ToolbarBottomDockSite = this.dockSite8;
     this.NetBarManager.ToolbarLeftDockSite   = this.dockSite5;
     this.NetBarManager.ToolbarRightDockSite  = this.dockSite6;
     this.NetBarManager.ToolbarTopDockSite    = this.dockSite7;
     this.NetBarManager.TopDockSite           = this.dockSite3;
     this.dockSite4.Controls.Add(this.bar1);
     this.dockSite4.Dock = DockStyle.Bottom;
     this.dockSite4.DocumentDockContainer = new DocumentDockContainer(new DocumentBaseContainer[] { new DocumentBarContainer(this.bar1, 0x265, 0x8f) }, eOrientation.Vertical);
     this.dockSite4.Location         = new Point(0, 0x123);
     this.dockSite4.Name             = "dockSite4";
     this.dockSite4.Size             = new Size(0x265, 0x92);
     this.dockSite4.TabIndex         = 0x1d;
     this.dockSite4.TabStop          = false;
     this.bar1.AccessibleDescription = "DotNetBar Bar (bar1)";
     this.bar1.AccessibleName        = "DotNetBar Bar";
     this.bar1.AutoSyncBarCaption    = true;
     this.bar1.CloseSingleTab        = true;
     this.bar1.Controls.Add(this.panelDockContainer1);
     this.bar1.Controls.Add(this.panelDockContainer2);
     this.bar1.GrabHandleStyle = eGrabHandleStyle.Caption;
     this.bar1.Items.AddRange(new BaseItem[] { this.dockContainerItem1, this.dockContainerItem2 });
     this.bar1.LayoutType      = eLayoutType.DockContainer;
     this.bar1.Location        = new Point(0, 3);
     this.bar1.Name            = "bar1";
     this.bar1.SelectedDockTab = 0;
     this.bar1.Size            = new Size(0x265, 0x8f);
     this.bar1.Stretch         = true;
     this.bar1.Style           = eDotNetBarStyle.Office2007;
     this.bar1.TabIndex        = 0;
     this.bar1.TabStop         = false;
     this.bar1.Text            = "日志";
     this.panelDockContainer1.ColorSchemeStyle = eDotNetBarStyle.Office2007;
     this.panelDockContainer1.Controls.Add(this.syslogbox);
     this.panelDockContainer1.Location        = new Point(3, 0x17);
     this.panelDockContainer1.Name            = "panelDockContainer1";
     this.panelDockContainer1.Size            = new Size(0x25f, 0x5c);
     this.panelDockContainer1.Style.Alignment = StringAlignment.Center;
     this.panelDockContainer1.Style.BackColor1.ColorSchemePart  = eColorSchemePart.BarBackground;
     this.panelDockContainer1.Style.BackColor2.ColorSchemePart  = eColorSchemePart.BarBackground2;
     this.panelDockContainer1.Style.BorderColor.ColorSchemePart = eColorSchemePart.BarDockedBorder;
     this.panelDockContainer1.Style.ForeColor.ColorSchemePart   = eColorSchemePart.ItemText;
     this.panelDockContainer1.Style.GradientAngle = 90;
     this.panelDockContainer1.TabIndex            = 0;
     this.syslogbox.Dock       = DockStyle.Fill;
     this.syslogbox.Location   = new Point(0, 0);
     this.syslogbox.Multiline  = true;
     this.syslogbox.Name       = "syslogbox";
     this.syslogbox.ScrollBars = ScrollBars.Vertical;
     this.syslogbox.Size       = new Size(0x25f, 0x5c);
     this.syslogbox.TabIndex   = 0;
     this.panelDockContainer2.ColorSchemeStyle = eDotNetBarStyle.Office2007;
     this.panelDockContainer2.Location         = new Point(3, 0x17);
     this.panelDockContainer2.Name             = "panelDockContainer2";
     this.panelDockContainer2.Size             = new Size(0x25f, 0x5c);
     this.panelDockContainer2.Style.Alignment  = StringAlignment.Center;
     this.panelDockContainer2.Style.BackColor1.ColorSchemePart  = eColorSchemePart.BarBackground;
     this.panelDockContainer2.Style.BackColor2.ColorSchemePart  = eColorSchemePart.BarBackground2;
     this.panelDockContainer2.Style.BorderColor.ColorSchemePart = eColorSchemePart.BarDockedBorder;
     this.panelDockContainer2.Style.ForeColor.ColorSchemePart   = eColorSchemePart.ItemText;
     this.panelDockContainer2.Style.GradientAngle = 90;
     this.panelDockContainer2.TabIndex            = 2;
     this.dockContainerItem1.Control          = this.panelDockContainer1;
     this.dockContainerItem1.Name             = "dockContainerItem1";
     this.dockContainerItem1.Text             = "日志";
     this.dockContainerItem2.Control          = this.panelDockContainer2;
     this.dockContainerItem2.Name             = "dockContainerItem2";
     this.dockContainerItem2.Text             = "系统";
     this.dockSite1.Dock                      = DockStyle.Left;
     this.dockSite1.DocumentDockContainer     = new DocumentDockContainer();
     this.dockSite1.Location                  = new Point(0, 0);
     this.dockSite1.Name                      = "dockSite1";
     this.dockSite1.Size                      = new Size(0, 0x123);
     this.dockSite1.TabIndex                  = 0x1a;
     this.dockSite1.TabStop                   = false;
     this.dockSite2.Dock                      = DockStyle.Right;
     this.dockSite2.DocumentDockContainer     = new DocumentDockContainer();
     this.dockSite2.Location                  = new Point(0x265, 0);
     this.dockSite2.Name                      = "dockSite2";
     this.dockSite2.Size                      = new Size(0, 0x123);
     this.dockSite2.TabIndex                  = 0x1b;
     this.dockSite2.TabStop                   = false;
     this.dockSite8.Dock                      = DockStyle.Bottom;
     this.dockSite8.Location                  = new Point(0, 0x1b5);
     this.dockSite8.Name                      = "dockSite8";
     this.dockSite8.Size                      = new Size(0x265, 0);
     this.dockSite8.TabIndex                  = 0x21;
     this.dockSite8.TabStop                   = false;
     this.dockSite5.Dock                      = DockStyle.Left;
     this.dockSite5.Location                  = new Point(0, 0);
     this.dockSite5.Name                      = "dockSite5";
     this.dockSite5.Size                      = new Size(0, 0x1b5);
     this.dockSite5.TabIndex                  = 30;
     this.dockSite5.TabStop                   = false;
     this.dockSite6.Dock                      = DockStyle.Right;
     this.dockSite6.Location                  = new Point(0x265, 0);
     this.dockSite6.Name                      = "dockSite6";
     this.dockSite6.Size                      = new Size(0, 0x1b5);
     this.dockSite6.TabIndex                  = 0x1f;
     this.dockSite6.TabStop                   = false;
     this.dockSite7.Dock                      = DockStyle.Top;
     this.dockSite7.Location                  = new Point(0, 0);
     this.dockSite7.Name                      = "dockSite7";
     this.dockSite7.Size                      = new Size(0x265, 0);
     this.dockSite7.TabIndex                  = 0x20;
     this.dockSite7.TabStop                   = false;
     this.dockSite3.Dock                      = DockStyle.Top;
     this.dockSite3.DocumentDockContainer     = new DocumentDockContainer();
     this.dockSite3.Location                  = new Point(0, 0);
     this.dockSite3.Name                      = "dockSite3";
     this.dockSite3.Size                      = new Size(0x265, 0);
     this.dockSite3.TabIndex                  = 0x1c;
     this.dockSite3.TabStop                   = false;
     this.tabStrip1.AutoSelectAttachedControl = true;
     this.tabStrip1.CanReorderTabs            = true;
     this.tabStrip1.CloseButtonVisible        = false;
     this.tabStrip1.Dock                      = DockStyle.Top;
     this.tabStrip1.Location                  = new Point(0, 0);
     this.tabStrip1.MdiTabbedDocuments        = true;
     this.tabStrip1.Name                      = "tabStrip1";
     this.tabStrip1.SelectedTab               = null;
     this.tabStrip1.SelectedTabFont           = new Font("Microsoft Sans Serif", 8.25f, FontStyle.Bold, GraphicsUnit.Point, 0);
     this.tabStrip1.Size                      = new Size(0x265, 0x1a);
     this.tabStrip1.Style                     = eTabStripStyle.Office2007Document;
     this.tabStrip1.TabAlignment              = eTabStripAlignment.Top;
     this.tabStrip1.TabIndex                  = 0x22;
     this.tabStrip1.TabLayoutType             = eTabLayoutType.MultilineWithNavigationBox;
     this.tabStrip1.Text                      = "tabStrip1";
     base.AutoScaleDimensions                 = new SizeF(6f, 12f);
     base.ClientSize = new Size(0x265, 0x1b5);
     base.Controls.Add(this.tabStrip1);
     base.Controls.Add(this.dockSite2);
     base.Controls.Add(this.dockSite1);
     base.Controls.Add(this.dockSite3);
     base.Controls.Add(this.dockSite4);
     base.Controls.Add(this.dockSite5);
     base.Controls.Add(this.dockSite6);
     base.Controls.Add(this.dockSite7);
     base.Controls.Add(this.dockSite8);
     base.Controls.Add(this.mdiClient1);
     base.IsMdiContainer = true;
     base.Name           = "main";
     this.Text           = "anyEncoder编码器";
     base.FormClosed    += new FormClosedEventHandler(this.main_FormClosed);
     base.Load          += new EventHandler(this.main_Load);
     this.dockSite4.ResumeLayout(false);
     this.bar1.EndInit();
     this.bar1.ResumeLayout(false);
     this.panelDockContainer1.ResumeLayout(false);
     this.panelDockContainer1.PerformLayout();
     base.ResumeLayout(false);
 }
        private XmlDocument LoadDefinition(DotNetBarManager manager)
        {
            string path = DesignTimeDte.GetDefinitionPath(manager.DefinitionName, manager.Site);
            if (path != null && path != "")
            {
                if (!path.EndsWith("\\"))
                    path += "\\";
                if (System.IO.File.Exists(path + manager.DefinitionName))
                {
                    XmlDocument doc = new XmlDocument();
                    doc.Load(path + manager.DefinitionName);
                    return doc;
                }
                else
                {
                    MessageBox.Show("Could not import. DotNetBar definition file not found: " + path + manager.DefinitionName, "Import Routine", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                }
            }
            else
                MessageBox.Show("Could not find DotNetBarManager path. Import aborted.", "Import Routine", MessageBoxButtons.OK, MessageBoxIcon.Error);

            return null;
        }
        private void ImportDefinition(DotNetBarManager manager)
        {
            IDesignerHost dh = this.GetService(typeof(IDesignerHost)) as IDesignerHost;
            if (manager.DefinitionName == "" || dh==null) return;

            XmlDocument def = LoadDefinition(manager);
            if (def == null) return;

            IComponentChangeService cc = this.GetService(typeof(IComponentChangeService)) as IComponentChangeService;

            if (manager.ToolbarTopDockSite == null)
                SetupToolbarDockSites();

            manager.SuspendLayout = true;

            try
            {
                if(manager.TopDockSite!=null && manager.TopDockSite.DocumentDockContainer == null)
                    manager.TopDockSite.DocumentDockContainer = new DocumentDockContainer();
                if (manager.BottomDockSite != null && manager.BottomDockSite.DocumentDockContainer == null)
                    manager.BottomDockSite.DocumentDockContainer = new DocumentDockContainer();
                if (manager.LeftDockSite != null && manager.LeftDockSite.DocumentDockContainer == null)
                    manager.LeftDockSite.DocumentDockContainer = new DocumentDockContainer();
                if (manager.RightDockSite != null && manager.RightDockSite.DocumentDockContainer == null)
                    manager.RightDockSite.DocumentDockContainer = new DocumentDockContainer();

                System.Xml.XmlElement xmlDotNetBar = def.FirstChild as System.Xml.XmlElement;

                // Creates serialization context
                ItemSerializationContext context = new ItemSerializationContext();
                context.Serializer = manager;
                context.HasDeserializeItemHandlers = false;
                context.HasSerializeItemHandlers = false;
                context._DesignerHost = dh;

                // Load bars first 
                foreach (System.Xml.XmlElement xmlElem in xmlDotNetBar.ChildNodes)
                {
                    if (xmlElem.Name == "bars")
                    {
                        foreach (System.Xml.XmlElement xmlBar in xmlElem.ChildNodes)
                        {
                            Bar bar = null;
                            string name = xmlBar.GetAttribute("name");
                            try
                            {
                                bar = dh.CreateComponent(typeof(Bar), name) as Bar;
                            }
                            catch { }
                            if(bar==null)
                                bar = dh.CreateComponent(typeof(Bar)) as Bar;

                            manager.Bars.Add(bar);

                            bar.Deserialize(xmlBar, context);

                            if (bar.LayoutType == eLayoutType.DockContainer)
                            {
                                // Create dock panels for the bar
                                foreach (BaseItem item in bar.Items)
                                {
                                    if (!(item is DockContainerItem)) continue;
                                    DockContainerItem dc = item as DockContainerItem;
                                    PanelDockContainer panel = dh.CreateComponent(typeof(PanelDockContainer)) as PanelDockContainer;
                                    bar.Controls.Add(panel);
                                    panel.ColorSchemeStyle = bar.Style;
                                    panel.ApplyLabelStyle();
                                    dc.Control = panel;
                                }
                            }
                        }
                    }
                }

                // Context menus loading
                foreach (System.Xml.XmlElement xmlElem in xmlDotNetBar.ChildNodes)
                {
                    if (xmlElem.Name == "popups")
                    {
                        ContextMenuBar contextBar = null;
                        Control parent = manager.ParentForm;
                        if (parent == null) parent = manager.ParentUserControl;
                        if (parent == null)
                            parent = dh.RootComponent as System.Windows.Forms.Control;

                        if (parent != null)
                        {
                            if (xmlElem.ChildNodes.Count > 0)
                            {
                                contextBar = dh.CreateComponent(typeof(ContextMenuBar)) as ContextMenuBar;
                                parent.Controls.Add(contextBar);
                                contextBar.BringToFront();
                                contextBar.Style = manager.Style;
                                contextBar.Size = new Size(150, 26);
                            }

                            foreach (System.Xml.XmlElement xmlItem in xmlElem.ChildNodes)
                            {
                                BaseItem objItem = context.CreateItemFromXml(xmlItem);
                                if (objItem == null)
                                    MessageBox.Show("Invalid Item in file found (" + Helpers.GetItemErrorInfo(xmlItem) + ").");
                                // Do not change this order. Item should be Deserialized first and then added to the items
                                // collection. See GlobalItem property for performace reasons...
                                context.ItemXmlElement = xmlItem;
                                objItem.Deserialize(context);
                                if (!objItem.Visible) objItem.Visible = true;
                                if (objItem.Text == "" || objItem.Text == null) objItem.Text = objItem.Name;
                                if (objItem is ButtonItem) ((ButtonItem)objItem).AutoExpandOnClick = true;
                                contextBar.Items.Add(objItem);
                            }
                            if (contextBar != null)
                                contextBar.RecalcLayout();
                            if (cc != null && contextBar != null)
                            {
                                cc.OnComponentChanged(contextBar, TypeDescriptor.GetProperties(contextBar)["Items"], null, null);
                                cc.OnComponentChanged(contextBar, null, null, null);
                            }
                        }
                    }
                }

                if (cc != null)
                {
                    cc.OnComponentChanged(manager, null, null, null);
                    if (manager.TopDockSite != null)
                        cc.OnComponentChanged(manager.TopDockSite, null, null, null);
                    if (manager.BottomDockSite != null)
                        cc.OnComponentChanged(manager.BottomDockSite, null, null, null);
                    if (manager.LeftDockSite != null)
                        cc.OnComponentChanged(manager.LeftDockSite, null, null, null);
                    if (manager.RightDockSite != null)
                        cc.OnComponentChanged(manager.RightDockSite, null, null, null);

                    if (manager.ToolbarTopDockSite != null)
                        cc.OnComponentChanged(manager.ToolbarTopDockSite, null, null, null);
                    if (manager.BottomDockSite != null)
                        cc.OnComponentChanged(manager.ToolbarBottomDockSite, null, null, null);
                    if (manager.ToolbarLeftDockSite != null)
                        cc.OnComponentChanged(manager.ToolbarLeftDockSite, null, null, null);
                    if (manager.ToolbarRightDockSite != null)
                        cc.OnComponentChanged(manager.ToolbarRightDockSite, null, null, null);
                }
            }
            finally
            {
                manager.SuspendLayout = false;
            }

            foreach (Bar bar in manager.Bars)
            {
                if (bar.LayoutType != eLayoutType.DockContainer)
                    continue;

                DockContainerItem dc = bar.SelectedDockContainerItem;
                if (dc != null && dc.Control != null)
                {
                    if (bar.Controls.IndexOf(dc.Control) > 0)
                    {
                        if (cc != null)
                            cc.OnComponentChanging(bar, TypeDescriptor.GetProperties(bar)["Controls"]);
                        bar.Controls.SetChildIndex(dc.Control, 0);
                        if (cc != null)
                            cc.OnComponentChanged(bar, TypeDescriptor.GetProperties(bar)["Controls"], null, null);
                    }
                }
            }

            //// Load items for customization i.e. categories etc.
            //foreach (System.Xml.XmlElement xmlElem in xmlDotNetBar.ChildNodes)
            //{
            //    if (xmlElem.Name == "items")
            //    {
            //        foreach (System.Xml.XmlElement xmlItem in xmlElem.ChildNodes)
            //        {
            //            BaseItem objItem = BarFunctions.CreateItemFromXml(xmlItem, dh);
            //            if (objItem == null)
            //                MessageBox.Show("Invalid Item in file found (" + BarFunctions.GetItemErrorInfo(xmlItem) + ").");
            //            // Do not change this order. Item should be Deserialized first and then added to the items
            //            // collection. See GlobalItem property for performace reasons...
            //            context.ItemXmlElement = xmlItem;
            //            objItem.Deserialize(context);
            //            manager.Items.Add(objItem);
            //        }
            //    }
            //}
        }
Esempio n. 10
0
 internal static void smethod_1(DotNetBarManager dotNetBarManager_2)
 {
     Main.dotNetBarManager_0 = dotNetBarManager_2;
 }
Esempio n. 11
0
 internal virtual void vmethod_21(DotNetBarManager dotNetBarManager_2)
 {
     dotNetBarManager_1 = dotNetBarManager_2;
 }