private void btnNewStorage_Click(object sender, EventArgs e) { AddStorage AS = new AddStorage(this.controler.ListOfStorage); if (AS.ShowDialog() == DialogResult.OK) { controler.ListOfStorage.Add(AS.S); this.UpdateStorageBox(); } }
private void BtnEditStorage_Click(object sender, EventArgs e) { if (StorageBox.SelectedIndex > -1) { StorageUnit s = (StorageUnit)(StorageBox.SelectedItem); AddStorage As = new AddStorage(s); if (As.ShowDialog() == DialogResult.OK) { ((StorageUnit)StorageBox.SelectedItem).Name = As.S.Name; ((StorageUnit)StorageBox.SelectedItem).CapacityInPieces = As.S.CapacityInPieces; ((StorageUnit)StorageBox.SelectedItem).CapsityInWeight = As.S.CapsityInWeight; UpdateStorageBox(); StorageBox.SelectedIndex = -1; StorageBox.SelectedIndex = StorageBox.Items.IndexOf(s); } } }