private void button1_Click(object sender, EventArgs e)
        {
            bool fl = false;

            if (comboBox1.SelectedIndex < 0)
            {
                fl = true;
            }
            if (textBox1.Text.Length < 1)
            {
                fl = true;
            }
            //Проверка 2
            if (textBox2.Text.Length < 1)
            {
                fl = true;
            }
            //Проверка 3
            if (textBox3.Text.Length < 1)
            {
                fl = true;
            }
            if (fl)
            {
                MessageBox.Show("Не заполнено, или заполнено неправильно одно или несколько полей!");
                return;
            }
            else
            {
                if (comboBox1.SelectedIndex == 0)
                {
                    int i = int.Parse(textBox2.Text);
                    int j = int.Parse(textBox3.Text);
                    Plane_from_f2 = new PassangerPlane(textBox1.Text, 300, i, 2000, "Passenger", 1000, j);
                }
                if (comboBox1.SelectedIndex == 1)
                {
                    int i = int.Parse(textBox2.Text);
                    int j = int.Parse(textBox3.Text);
                    Plane_from_f2 = new TransportationPlane(textBox1.Text, 300, i, 2000, "Passenger", 1000, j);
                }

                this.Result = DialogResult.OK;
                this.Hide();

                Form1 main = this.Owner as Form1;
                this.onCount += main.ClearPanel;
                onCount();
                this.onCount -= main.ClearPanel;
                if (main != null)
                {
                    main.Show();
                }
            }
        }
        public static Airport CreateAirport()
        {
            PassangerPlane      plane1 = new PassangerPlane();
            PassangerPlane      plane2 = new PassangerPlane("Plane2", 1000, 1, 10000, "Passenger", 555, 55);
            PassangerPlane      plane3 = new PassangerPlane("Plane3", 1000, 2, 10000, "Passenger", 100, 96);
            TransportationPlane plane4 = new TransportationPlane("Plane4", 1000, 3, 10000, "Transport", 2000, 15);


            Airport our_airport = new Airport();

            our_airport.AddPlane(plane1);
            our_airport.AddPlane(plane2);
            our_airport.AddPlane(plane3);
            our_airport.AddPlane(plane4);

            //our_airport.ShowPlanes();
            //Console.WriteLine(our_airport.CountPassangers());

            //our_airport.Show_number_of_planes();

            return(our_airport);
        }
示例#3
0
        public void AddStandartPlane()
        {
            TransportationPlane defoult = new TransportationPlane();

            this.AddPlane(defoult);
        }
示例#4
0
        public void AddPlaneFrom2(string _name, int a1, int a2)
        {
            TransportationPlane defoult = new TransportationPlane(_name, 1000, a1, 2, "Transport", 2000, a2);

            this.AddPlane(defoult);
        }