Exemple #1
0
 private void button4_Click(object sender, EventArgs e)
 {
     if (listBox1.Items.Count != 0)
     {
         Airlane      airlane = Return.Airlane;
         String       cl      = "";
         _20_65T      sp1     = new _20_65T();
         _65_120T     sp2     = new _65_120T();
         Boing        sp3     = new Boing();
         Airbus       sp4     = new Airbus();
         Bomber       sp5     = new Bomber();
         Intelligence sp6     = new Intelligence();
         if (airlane.Allplane[listBox1.SelectedIndex].GetType() == sp1.GetType() || airlane.Allplane[listBox1.SelectedIndex].GetType() == sp2.GetType())
         {
             cl = "Грузоподъемность";
         }
         if (airlane.Allplane[listBox1.SelectedIndex].GetType() == sp3.GetType() || airlane.Allplane[listBox1.SelectedIndex].GetType() == sp4.GetType())
         {
             cl = "Вместимость";
         }
         if (airlane.Allplane[listBox1.SelectedIndex].GetType() == sp5.GetType() || airlane.Allplane[listBox1.SelectedIndex].GetType() == sp6.GetType())
         {
             cl = "Броня (мм)";
         }
         if (Return.index1.Count != 0)
         {
             Return.index1.RemoveAt(0);
         }
         Return.index1.Add(listBox1.SelectedIndex);
         Form2 f = new Form2(cl);
         f.Show();
     }
 }
Exemple #2
0
        private void button3_Click(object sender, EventArgs e)
        {
            Airlane  airlane = Return.Airlane;
            _65_120T samolet = new _65_120T();

            if (listBox1.Items.Count != 0)
            {
                int    n   = listBox1.SelectedIndex;
                Boing  sp1 = new Boing();
                Airbus sp2 = new Airbus();
                //if (airlane.Allplane[listBox1.SelectedIndex].GetType() == sp1.GetType())
                //{
                //    Boing b = (Boing)(airlane.Allplane[listBox1.SelectedIndex]);
                //    airlane.Capacity = -b.Capacity;
                //}
                //if (airlane.Allplane[listBox1.SelectedIndex].GetType() == sp2.GetType())
                //{
                //    Airbus b = (Airbus)(airlane.Allplane[listBox1.SelectedIndex]);
                //    airlane.Capacity = -b.Capacity;
                //}
                airlane.Allplane.RemoveAt(n);
                label7.Text = "Общая вместимость: " + airlane.Capacity.ToString();
                listBox1.Items.Clear();
                for (int i = 0; i < airlane.Allplane.Count(); i++)
                {
                    listBox1.Items.Add(airlane.Allplane[i].Name.ToString());
                }
                Return.Airlane = airlane;
            }
        }
Exemple #3
0
        private void Form2_Activated(object sender, EventArgs e)
        {
            Airlane      airlane = Return.Airlane;
            int          index1  = Return.index1[Return.index1.Count() - 1];
            _20_65T      sp1     = new _20_65T();
            _65_120T     sp2     = new _65_120T();
            Boing        sp3     = new Boing();
            Airbus       sp4     = new Airbus();
            Bomber       sp5     = new Bomber();
            Intelligence sp6     = new Intelligence();

            if (airlane.Allplane[index1].GetType() == sp1.GetType())
            {
                _20_65T b = (_20_65T)(airlane.Allplane[index1]);
                textBox1.Text = b.Name;
                textBox2.Text = b.Country;
                textBox3.Text = b.Color;
                textBox4.Text = b.Lifting.ToString();
            }
            if (airlane.Allplane[index1].GetType() == sp2.GetType())
            {
                _65_120T b = (_65_120T)(airlane.Allplane[index1]);
                textBox1.Text = b.Name;
                textBox2.Text = b.Country;
                textBox3.Text = b.Color;
                textBox4.Text = b.Lifting.ToString();
            }
            if (airlane.Allplane[index1].GetType() == sp3.GetType())
            {
                Boing b = (Boing)(airlane.Allplane[index1]);
                textBox1.Text = b.Name;
                textBox2.Text = b.Country;
                textBox3.Text = b.Color;
                textBox4.Text = b.Capacity.ToString();
            }
            if (airlane.Allplane[index1].GetType() == sp4.GetType())
            {
                Airbus b = (Airbus)(airlane.Allplane[index1]);
                textBox1.Text = b.Name;
                textBox2.Text = b.Country;
                textBox3.Text = b.Color;
                textBox4.Text = b.Capacity.ToString();
            }
            if (airlane.Allplane[index1].GetType() == sp5.GetType())
            {
                Bomber b = (Bomber)(airlane.Allplane[index1]);
                textBox1.Text = b.Name;
                textBox2.Text = b.Country;
                textBox3.Text = b.Color;
                textBox4.Text = b.Thickness.ToString();
            }
            if (airlane.Allplane[index1].GetType() == sp6.GetType())
            {
                Intelligence b = (Intelligence)(airlane.Allplane[index1]);
                textBox1.Text = b.Name;
                textBox2.Text = b.Country;
                textBox3.Text = b.Color;
                textBox4.Text = b.Thickness.ToString();
            }
        }
Exemple #4
0
 private void button2_Click(object sender, EventArgs e)
 {
     if (radioButton1.Checked && textBox2.Text.Length != 0 && textBox3.Text.Length != 0 && textBox4.Text.Length != 0 && textBox5.Text.Length != 0)
     {
         int  res;
         bool isInt = Int32.TryParse(textBox5.Text, out res);
         if (isInt == true)
         {
             Airlane airlane = Return.Airlane;
             _20_65T samolet = new _20_65T();
             samolet.Color     = textBox4.Text;
             samolet.Country   = textBox3.Text;
             samolet.Name      = textBox2.Text;
             samolet.Lifting   = int.Parse(textBox5.Text);
             samolet.Nameclass = "";
             airlane.Allplane.Add(samolet);
             listBox1.Items.Clear();
             for (int i = 0; i < airlane.Allplane.Count(); i++)
             {
                 listBox1.Items.Add(airlane.Allplane[i].Name.ToString());
             }
             Return.Airlane = airlane;
             textBox2.Clear();
             textBox3.Clear();
             textBox4.Clear();
             textBox5.Clear();
         }
     }
     if (radioButton2.Checked && textBox2.Text.Length != 0 && textBox3.Text.Length != 0 && textBox4.Text.Length != 0 && textBox5.Text.Length != 0)
     {
         int  res;
         bool isInt = Int32.TryParse(textBox5.Text, out res);
         if (isInt == true)
         {
             Airlane  airlane = Return.Airlane;
             _65_120T samolet = new _65_120T();
             samolet.Color     = textBox4.Text;
             samolet.Country   = textBox3.Text;
             samolet.Name      = textBox2.Text;
             samolet.Lifting   = int.Parse(textBox5.Text);
             samolet.Nameclass = "";
             airlane.Allplane.Add(samolet);
             listBox1.Items.Clear();
             for (int i = 0; i < airlane.Allplane.Count(); i++)
             {
                 listBox1.Items.Add(airlane.Allplane[i].Name.ToString());
             }
             Return.Airlane = airlane;
             textBox2.Clear();
             textBox3.Clear();
             textBox4.Clear();
             textBox5.Clear();
         }
     }
     if (radioButton3.Checked && textBox2.Text.Length != 0 && textBox3.Text.Length != 0 && textBox4.Text.Length != 0 && textBox5.Text.Length != 0)
     {
         int  res;
         bool isInt = Int32.TryParse(textBox5.Text, out res);
         if (isInt == true)
         {
             Airlane airlane = Return.Airlane;
             Boing   samolet = new Boing();
             samolet.Color     = textBox4.Text;
             samolet.Country   = textBox3.Text;
             samolet.Name      = textBox2.Text;
             samolet.Capacity  = int.Parse(textBox5.Text);
             samolet.Nameclass = "";
             airlane.Allplane.Add(samolet);
             listBox1.Items.Clear();
             airlane.Capacity = samolet.Capacity;
             label7.Text      = "Общая вместимость: " + airlane.Capacity.ToString();
             for (int i = 0; i < airlane.Allplane.Count(); i++)
             {
                 listBox1.Items.Add(airlane.Allplane[i].Name.ToString());
             }
             Return.Airlane = airlane;
             textBox2.Clear();
             textBox3.Clear();
             textBox4.Clear();
             textBox5.Clear();
         }
     }
     if (radioButton4.Checked && textBox2.Text.Length != 0 && textBox3.Text.Length != 0 && textBox4.Text.Length != 0 && textBox5.Text.Length != 0)
     {
         int  res;
         bool isInt = Int32.TryParse(textBox5.Text, out res);
         if (isInt == true)
         {
             Airlane airlane = Return.Airlane;
             Airbus  samolet = new Airbus();
             samolet.Color     = textBox4.Text;
             samolet.Country   = textBox3.Text;
             samolet.Name      = textBox2.Text;
             samolet.Capacity  = int.Parse(textBox5.Text);
             samolet.Nameclass = "";
             airlane.Allplane.Add(samolet);
             listBox1.Items.Clear();
             airlane.Capacity = samolet.Capacity;
             label7.Text      = "Общая вместимость: " + airlane.Capacity.ToString();
             for (int i = 0; i < airlane.Allplane.Count(); i++)
             {
                 listBox1.Items.Add(airlane.Allplane[i].Name.ToString());
             }
             Return.Airlane = airlane;
             textBox2.Clear();
             textBox3.Clear();
             textBox4.Clear();
             textBox5.Clear();
         }
     }
     if (radioButton5.Checked && textBox2.Text.Length != 0 && textBox3.Text.Length != 0 && textBox4.Text.Length != 0 && textBox5.Text.Length != 0)
     {
         int  res;
         bool isInt = Int32.TryParse(textBox5.Text, out res);
         if (isInt == true)
         {
             Airlane airlane = Return.Airlane;
             Bomber  samolet = new Bomber();
             samolet.Color     = textBox4.Text;
             samolet.Country   = textBox3.Text;
             samolet.Name      = textBox2.Text;
             samolet.Thickness = int.Parse(textBox5.Text);
             samolet.Nameclass = "";
             airlane.Allplane.Add(samolet);
             listBox1.Items.Clear();
             for (int i = 0; i < airlane.Allplane.Count(); i++)
             {
                 listBox1.Items.Add(airlane.Allplane[i].Name.ToString());
             }
             Return.Airlane = airlane;
             textBox2.Clear();
             textBox3.Clear();
             textBox4.Clear();
             textBox5.Clear();
         }
     }
     if (radioButton6.Checked && textBox2.Text.Length != 0 && textBox3.Text.Length != 0 && textBox4.Text.Length != 0 && textBox5.Text.Length != 0)
     {
         int  res;
         bool isInt = Int32.TryParse(textBox5.Text, out res);
         if (isInt == true)
         {
             Airlane      airlane = Return.Airlane;
             Intelligence samolet = new Intelligence();
             samolet.Color     = textBox4.Text;
             samolet.Country   = textBox3.Text;
             samolet.Name      = textBox2.Text;
             samolet.Thickness = int.Parse(textBox5.Text);
             samolet.Nameclass = "";
             airlane.Allplane.Add(samolet);
             listBox1.Items.Clear();
             for (int i = 0; i < airlane.Allplane.Count(); i++)
             {
                 listBox1.Items.Add(airlane.Allplane[i].Name.ToString());
             }
             Return.Airlane = airlane;
             textBox2.Clear();
             textBox3.Clear();
             textBox4.Clear();
             textBox5.Clear();
         }
     }
 }
Exemple #5
0
        private void button1_Click(object sender, EventArgs e)
        {
            Airlane airlane = Return.Airlane;
            int     index1  = Return.index1[Return.index1.Count() - 1];

            if (textBox2.Text.Length != 0 && textBox3.Text.Length != 0 && textBox4.Text.Length != 0 && textBox1.Text.Length != 0)
            {
                int  res;
                bool isInt = Int32.TryParse(textBox4.Text, out res);
                if (isInt == true)
                {
                    _20_65T      sp1 = new _20_65T();
                    _65_120T     sp2 = new _65_120T();
                    Boing        sp3 = new Boing();
                    Airbus       sp4 = new Airbus();
                    Bomber       sp5 = new Bomber();
                    Intelligence sp6 = new Intelligence();
                    if (airlane.Allplane[index1].GetType() == sp1.GetType())
                    {
                        _20_65T b = (_20_65T)(airlane.Allplane[index1]);
                        b.Name      = textBox1.Text;
                        b.Country   = textBox2.Text;
                        b.Color     = textBox3.Text;
                        b.Lifting   = int.Parse(textBox4.Text);
                        b.Nameclass = "";
                        airlane.Allplane.RemoveAt(index1);
                        airlane.Allplane.Add(b);
                        Return.Airlane = airlane;
                        this.Close();
                    }
                    if (airlane.Allplane[index1].GetType() == sp2.GetType())
                    {
                        _65_120T b = (_65_120T)(airlane.Allplane[index1]);
                        b.Name      = textBox1.Text;
                        b.Country   = textBox2.Text;
                        b.Color     = textBox3.Text;
                        b.Lifting   = int.Parse(textBox4.Text);
                        b.Nameclass = "";
                        airlane.Allplane.RemoveAt(index1);
                        airlane.Allplane.Add(b);
                        Return.Airlane = airlane;
                        this.Close();
                    }
                    if (airlane.Allplane[index1].GetType() == sp3.GetType())
                    {
                        Boing b = (Boing)(airlane.Allplane[index1]);
                        b.Name           = textBox1.Text;
                        b.Country        = textBox2.Text;
                        b.Color          = textBox3.Text;
                        b.Nameclass      = "";
                        airlane.Capacity = -b.Capacity;
                        b.Capacity       = int.Parse(textBox4.Text);
                        airlane.Capacity = b.Capacity;
                        airlane.Allplane.RemoveAt(index1);
                        airlane.Allplane.Add(b);
                        Return.Airlane = airlane;
                        this.Close();
                    }
                    if (airlane.Allplane[index1].GetType() == sp4.GetType())
                    {
                        Airbus b = (Airbus)(airlane.Allplane[index1]);
                        b.Name           = textBox1.Text;
                        b.Country        = textBox2.Text;
                        b.Color          = textBox3.Text;
                        b.Nameclass      = "";
                        airlane.Capacity = -b.Capacity;
                        b.Capacity       = int.Parse(textBox4.Text);
                        airlane.Capacity = b.Capacity;
                        airlane.Allplane.RemoveAt(index1);
                        airlane.Allplane.Add(b);
                        Return.Airlane = airlane;
                        this.Close();
                    }
                    if (airlane.Allplane[index1].GetType() == sp5.GetType())
                    {
                        Bomber b = (Bomber)(airlane.Allplane[index1]);
                        b.Name      = textBox1.Text;
                        b.Country   = textBox2.Text;
                        b.Color     = textBox3.Text;
                        b.Thickness = int.Parse(textBox4.Text);
                        b.Nameclass = "";
                        airlane.Allplane.RemoveAt(index1);
                        airlane.Allplane.Add(b);
                        Return.Airlane = airlane;
                        this.Close();
                    }
                    if (airlane.Allplane[index1].GetType() == sp6.GetType())
                    {
                        Intelligence b = (Intelligence)(airlane.Allplane[index1]);
                        b.Name      = textBox1.Text;
                        b.Country   = textBox2.Text;
                        b.Color     = textBox3.Text;
                        b.Thickness = int.Parse(textBox4.Text);
                        b.Nameclass = "";
                        airlane.Allplane.RemoveAt(index1);
                        airlane.Allplane.Add(b);
                        Return.Airlane = airlane;
                        this.Close();
                    }
                }
            }
        }