コード例 #1
0
        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();
                }
            }
        }
コード例 #2
0
        private void OpenCampPersonnel(object sender, EventArgs e)
        {
            ToolStripMenuItem agencyPersonnel = (ToolStripMenuItem)sender;
            int crew = int.Parse(agencyPersonnel.Tag.ToString());
            //Console.WriteLine("Open Forms: " + Application.OpenForms.Count);
            Form form = isFormOpen(crew, "Personnel");

            if (form != null)
            {
                //DialogResult dialogResult = MessageBox.Show("Hookline for crew " + crew.ToString() + " is already Open!", "Open Form", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
                form.BringToFront();
            }
            else
            {
                Personnel campPersonnel = new Personnel((Personnel.Agency)crew);
                campPersonnel.MdiParent = this;
                campPersonnel.Dock      = DockStyle.Fill;
                campPersonnel.Show();
            }
        }