private void btnRemoveLuggage_Click(object sender, RoutedEventArgs e) { if (lbxLuggage.SelectedItem != null) { L = (Luggage)lbxLuggage.SelectedItem; luggage.Remove(L); lbxLuggage.Items.Refresh(); } }
//METHODS //Adds luggage to list public void AddLuggage(Luggage l) { //Evaluates if weight is higher than 0 if (l.Weight > 0) { //Adds luggage to list luggage.Add(l); } }
//EVENT HANDLERS private void btnAddPassenger_Click(object sender, RoutedEventArgs e) { int result; int.TryParse(tbxLuggage.Text, out result); Luggage luggage = new Luggage(result); newPassenger = new Passenger(tbxTicketNumber.Text, tbxFirstName.Text, tbxLastName.Text, luggage); Close(); }
//CONSTRUCTORS public Passenger(string ticketNumber, string firstName, string lastName, Luggage l) { TicketNumber = ticketNumber; FirstName = firstName; LastName = lastName; //Evaluates if weight is larger than 0 if (l.Weight > 0) { //Adds luggage to list luggage.Add(l); } }
//Removes luggage from list public void RemoveLuggage(Luggage l) { //Removes luggage from list luggage.Remove(l); }