private void OpenForm(int id, string formName) { Form formToOpen = null; Form form = isFormOpen(id, formName); if (form != null) { form.BringToFront(); } else { switch (formName) { case "crewForm": formToOpen = new crewForm((crewForm.CrewNumber)id); formToOpen.Text = "PLT " + id.ToString(); break; case "FormSeatingChart": formToOpen = new FormSeatingChart(id); formToOpen.Text = "PLT " + id.ToString(); break; case "FormVehicle": formToOpen = new FormVehicle(); break; case "Personnel": formToOpen = new Personnel((Personnel.Agency)id); break; case "CampRoster": break; } if (formToOpen != null) { formToOpen.MdiParent = this; formToOpen.Dock = DockStyle.Fill; formToOpen.Show(); } } }
private void OpenHookline(object sender, EventArgs e) { ToolStripMenuItem hookLine = (ToolStripMenuItem)sender; int crew = int.Parse(hookLine.Tag.ToString()); //Console.WriteLine("Open Forms: " + Application.OpenForms.Count); Form form = isFormOpen(crew, "crewForm"); if (form != null) { //DialogResult dialogResult = MessageBox.Show("Hookline for crew " + crew.ToString() + " is already Open!", "Open Form", MessageBoxButtons.OK, MessageBoxIcon.Exclamation); form.BringToFront(); } else { crewForm crewform = new crewForm((crewForm.CrewNumber)crew); crewform.MdiParent = this; crewform.Dock = DockStyle.Fill; crewform.Text = "PLT " + crew.ToString(); crewform.Show(); } }