private void MainBar_DockTabChange(object sender, DevComponents.DotNetBar.DockTabChangeEventArgs e) { TreeTSI.Nodes.Clear(); propertyGrid.SelectedObject = null; if (e.NewTab.GetType() == typeof(XmlDockContainer)) { XmlDockContainer SelectXmlDockContainer = (XmlDockContainer)e.NewTab; SelectXmlDockContainer.Reload(); treeTSIMenuStrip.Enabled = false; } else if (e.NewTab.GetType() == typeof(DDSDockContainer)) { DDSDockContainer SelectDDSDockContainer = (DDSDockContainer)e.NewTab; SelectDDSDockContainer.Reload(); treeTSIMenuStrip.Enabled = false; } else if (e.NewTab.GetType() == typeof(TSIDockContainer)) { TSIDockContainer SelectTSIDockContainer = (TSIDockContainer)e.NewTab; SelectTSIDockContainer.Reload(); tabControl.SelectedTab = tabPageTSI; treeTSIMenuStrip.Enabled = true; } else { treeTSIMenuStrip.Enabled = false; } if (e.OldTab.GetType() == typeof(ICustomControl)) //avoid error with "about tab" which isn't a ICustomControl { ICustomControl oldDock = (ICustomControl)e.OldTab; oldDock.Save(); } }
private void saveToolStripMenuItem_Click(object sender, EventArgs e) { if (this.MainBar.SelectedDockTab >= 0) { if (MainBar.Items[MainBar.SelectedDockTab].GetType() == typeof(ICustomControl)) //avoid error with "about tab" which isn't a ICustomControl { ICustomControl selectedDockContainer = (ICustomControl)MainBar.Items[MainBar.SelectedDockTab]; selectedDockContainer.Save(); } } }
private void closeToolStripMenuItem_Click(object sender, EventArgs e) { if (this.MainBar.SelectedDockTab >= 0) { Type type = MainBar.Items[MainBar.SelectedDockTab].GetType(); if (MainBar.Items[MainBar.SelectedDockTab].GetType().Equals(typeof(ICustomControl))) //avoid error with "about tab" which isn't a ICustomControl { ICustomControl selectedDockContainer = (ICustomControl)MainBar.Items[MainBar.SelectedDockTab]; selectedDockContainer.Save(); this.MainBar.Items.RemoveAt(this.MainBar.SelectedDockTab); } } }