コード例 #1
0
ファイル: Form1.cs プロジェクト: romangolik/Laba_4
        private void btnAddWarehouse_Click(object sender, EventArgs e)
        {
            Warehouse          newWarehouse       = new Warehouse();
            NewOrEditWarehouse newOrEditWarehouse = new NewOrEditWarehouse(newWarehouse);

            if (newOrEditWarehouse.ShowDialog() == DialogResult.OK)
            {
                listOfWarehouses.Items.Add(newWarehouse.ToString());
                warehouses.Add(newWarehouse);
            }
        }
コード例 #2
0
ファイル: Form1.cs プロジェクト: romangolik/Laba_4
        private void btnEdit_Click(object sender, EventArgs e)
        {
            int index = listOfWarehouses.SelectedIndex;

            if (index == -1)
            {
                index = warehouses.Count - 1;
            }
            NewOrEditWarehouse newOrEditWarehouse = new NewOrEditWarehouse(warehouses[index]);

            File.Delete("store/warehouses/warehouse_" + warehouses[index].Number + ".xml");
            if (newOrEditWarehouse.ShowDialog() == DialogResult.OK)
            {
                listOfWarehouses.Items[index] = warehouses[listOfWarehouses.SelectedIndex].ToString();
            }
        }