Пример #1
0
        private void button1_Click(object sender, EventArgs e)
        {
            if (comboBox1.Text != "" && comboBox2.Text != "" && comboBox3.Text != "")
            {
                New_Cat = new Ecip_Category();
                New_Model = new Ecip_Model();
                New_Size = new Ecip_Size();

                New_Size.Name = comboBox3.Text;
                New_Model.Name = comboBox2.Text;
                New_Model.Size.Add(New_Size);
                New_Cat.Name = comboBox1.Text;
                New_Cat.Model.Add(New_Model);

                MessageBox.Show("Новая экипировка\nуспешно добавлена", "", MessageBoxButtons.OK, MessageBoxIcon.Information);
                this.DialogResult = DialogResult.OK;
            }
            else
            {
                MessageBox.Show("Заполните все поля!", "", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
        }
Пример #2
0
        private void Load_equip()
        {
            if (File.Exists("Equipment_Base.bin"))
            {
                FileStream fs = new FileStream("Equipment_Base.bin", FileMode.Open);
                BinaryReader br = new BinaryReader(fs);

                int Category_kol = br.ReadInt32();
                for (int i = 0; i < Category_kol; i++)
                {
                    Ecip_Category New_Category = new Ecip_Category();
                    New_Category.Name = br.ReadString();
                    int Models_kol = br.ReadInt32();
                    for (int j = 0; j < Models_kol; j++)
                    {
                        Ecip_Model New_Model = new Ecip_Model();
                        New_Model.Name = br.ReadString();
                        int Size_kol = br.ReadInt32();
                        for (int k = 0; k < Size_kol; k++)
                        {
                            Ecip_Size New_Size = new Ecip_Size();
                            New_Size.Name = br.ReadString();
                            New_Size.arend = br.ReadBoolean();
                            if (New_Size.arend)
                            {
                                New_Size.Room = br.ReadInt32();
                                DateTime New_from = new DateTime(br.ReadInt32(), br.ReadInt32(), br.ReadInt32(), br.ReadInt32(), br.ReadInt32(), 0);
                                New_Size.Time_from = New_from;
                                DateTime New_to = new DateTime(br.ReadInt32(), br.ReadInt32(), br.ReadInt32(), br.ReadInt32(), br.ReadInt32(), 0);
                                New_Size.Time_to = New_to;
                            }
                            New_Model.Size.Add(New_Size);
                        }
                        New_Category.Model.Add(New_Model);
                    }
                    Equips.Add(New_Category);
                    listBox1.Items.Add(Equips[i].Name);
                }
                br.Close();
                fs.Close();
                listBox1.ClearSelected();
            }
        }