private void AnalyzeMainForm(MechatronicDesignSuiteForm MDSFormIn) { // loop through all windows form controls foreach (Control guiCtrl in MDSFormIn.Controls) { ; } }
/// <summary> /// The PCExeSys Constructor /// - Intended use: to be called by PCExeSysForm during its construction/instantiation /// - Establishes link between execution system and main PC form /// - Calls maininit function of the execution system /// </summary> /// <param name="MDSFormIn"></param> public PCExeSys(MechatronicDesignSuiteForm MDSFormIn) { if (MDSFormIn != null) { LinkedMDSForm = MDSFormIn; } pcExecutionSystemMetaData = PCExeSysMetaData.generateMetaData(); InitializeExecutionSystem(); ToolStripDropDownButton ExeSysMenuItems = null; foreach (Control ctr in LinkedMDSForm.Controls) { if (ctr.GetType() == typeof(MenuStrip)) { LinkedMDSForm.MainMenuStrip = (MenuStrip)ctr; ExeSysMenuItems = new ToolStripDropDownButton("PCExeSys"); LinkedMDSForm.MainMenuStrip.Items.Add(ExeSysMenuItems); ExeSysMenuItems.DropDownItems.Add("Project Explorer", null, viewProjectExplorerToolStripMenuItem_Click); ExeSysMenuItems.DropDownItems.Add("Exception Log", null, viewExceptionLogToolStripMenuItem_Click); ExeSysMenuItems.DropDownItems.Add("Open New Plot Pane", null, viewPlotPaneMenuItem_Click); LinkedMDSForm.MainMenuStrip.Parent = LinkedMDSForm; LinkedMDSForm.MainMenuStrip.Visible = true; LinkedMDSForm.MainMenuStrip.Show(); } else if (ctr.GetType() == typeof(ToolStrip)) { ExeSysMenuItems = new ToolStripDropDownButton("PCExeSys"); ((ToolStrip)ctr).Items.Add(ExeSysMenuItems); ExeSysMenuItems.DropDownItems.Add("Project Explorer", null, viewProjectExplorerToolStripMenuItem_Click); ExeSysMenuItems.DropDownItems.Add("Exception Log", null, viewExceptionLogToolStripMenuItem_Click); ExeSysMenuItems.DropDownItems.Add("Open New Plot Pane", null, viewPlotPaneMenuItem_Click); ((ToolStrip)ctr).Parent = LinkedMDSForm; ((ToolStrip)ctr).Visible = true; ((ToolStrip)ctr).Show(); } } if (ExeSysMenuItems == null) { LinkedMDSForm.MainMenuStrip = new MenuStrip(); LinkedMDSForm.MainMenuStrip.Dock = DockStyle.Top; ExeSysMenuItems = new ToolStripDropDownButton("PCExeSys"); LinkedMDSForm.MainMenuStrip.Items.Add(ExeSysMenuItems); ExeSysMenuItems.DropDownItems.Add("Project Explorer", null, viewProjectExplorerToolStripMenuItem_Click); ExeSysMenuItems.DropDownItems.Add("Exception Log", null, viewExceptionLogToolStripMenuItem_Click); ExeSysMenuItems.DropDownItems.Add("Open New Plot Pane", null, viewPlotPaneMenuItem_Click); LinkedMDSForm.MainMenuStrip.Parent = LinkedMDSForm; LinkedMDSForm.MainMenuStrip.Visible = true; LinkedMDSForm.MainMenuStrip.Show(); } }