private void btnAddDestination_Click(object sender, EventArgs e) { if (lbAerodromi.SelectedIndex != -1) { Form3 add_destination = new Form3(); if (add_destination.ShowDialog() == DialogResult.OK) { Aerodrom temp = (Aerodrom)lbAerodromi.SelectedItem; temp.destinations.Add(add_destination.MyDestination); UpdateDestinations(); } } else { MessageBox.Show("Selektiraj aerodrom!"); } }
private void UpdateDestinations() { lbDestinacie.Items.Clear(); txtMaxPrice.Clear(); txtAvgDistance.Clear(); Aerodrom temp = (Aerodrom)lbAerodromi.SelectedItem; if (temp != null) { foreach (Destination d in temp.destinations) { lbDestinacie.Items.Add(d); } UpdateMaxPriceAndAvgDestination(); } else { lbDestinacie.Items.Clear(); } }
private void btnDodadi_Click(object sender, EventArgs e) { MyAirport = new Aerodrom(txtName.Text, txtCity.Text, txtCode.Text); DialogResult = DialogResult.OK; }