Пример #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 OpenSeatingChart(object sender, EventArgs e)
        {
            ToolStripMenuItem seating = (ToolStripMenuItem)sender;
            int  crew = int.Parse(seating.Tag.ToString());
            Form form = isFormOpen(crew, "FormSeatingChart");

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