private void addVehicleBtn_Click(object sender, EventArgs e) { Vehicle vehicle = new Vehicle(); NewVehicleForm newVehicleForm = new NewVehicleForm(vehicle); if (newVehicleForm.ShowDialog() == DialogResult.OK) { rent.AddVehicle(vehicle); vehiclesListBox.Items.Add(vehicle); } }
private void editVehicleBtn_Click(object sender, EventArgs e) { if (!IsSelectedOneVehicle()) { return; } NewVehicleForm newVehicleForm = new NewVehicleForm(rent.RentedVehicles[vehiclesListBox.SelectedIndex]); if (newVehicleForm.ShowDialog() == DialogResult.OK) { vehiclesListBox.Items[selectedVehicleIndex] = rent.RentedVehicles[selectedVehicleIndex]; } }
private void addVehicleBtn_Click(object sender, EventArgs e) { if (!IsSelectedOneRent()) { return; } Vehicle vehicle = new Vehicle(); NewVehicleForm newVehicleForm = new NewVehicleForm(vehicle); if (newVehicleForm.ShowDialog() == DialogResult.OK) { rents[currentListBoxItemIndex].AddVehicle(vehicle); rentsListBox.Items[currentListBoxItemIndex] = rents[currentListBoxItemIndex]; shortInfoListBox.Items[currentListBoxItemIndex] = rents[currentListBoxItemIndex].ToShortString(); } }