private void Add(string key) { switch (key) { case "customer": CustomerDialog customerDialog = new CustomerDialog(); MessengerInstance.Send(new Customer(), "customerModel"); MessengerInstance.Send <Window>(customerDialog, "customerView"); customerDialog.ShowDialog(); UpdateCustomerGridView(); break; case "truck": TruckDialog truckDialog = new TruckDialog(); MessengerInstance.Send(new Truck(), "truckModel"); MessengerInstance.Send <Window>(truckDialog, "truckView"); truckDialog.ShowDialog(); UpdateTruckGridView(); break; case "order": OrderDialog orderDialog = new OrderDialog(); MessengerInstance.Send(new Order(), "orderModel"); MessengerInstance.Send <Window>(orderDialog, "orderView"); orderDialog.ShowDialog(); UpdateOrderGridView(); UpdateTruckGridView(); UpdateCargoGridView(); break; case "cargo": CargoDialog cargoDialog = new CargoDialog(); MessengerInstance.Send(new Cargo(), "cargoModel"); MessengerInstance.Send <Window>(cargoDialog, "cargoView"); cargoDialog.ShowDialog(); UpdateCargoGridView(); break; default: break; } }
/// <Summary> /// Cargo button pressed. Pop up the cargo transfer dialog. /// </Summary> /// <param name="sender">The source of the event.</param> /// <param name="e">A <see cref="EventArgs"/> that contains the event data.</param> private void CargoButton_Click(object sender, System.EventArgs e) { try { using (CargoDialog cargoDialog = new CargoDialog(selectedFleet, clientData)) { cargoDialog.ShowDialog(); UpdateCargoMeters(); Invalidate(); } meterCargo.CargoLevels = selectedFleet.Cargo; } catch { Report.Debug("FleetDetail.cs : CargoButton_Click() - Failed to open cargo dialog."); } }
private void ButtonCargo_Click(object sender, EventArgs e) { Fleet fleet = GetSelectedFleetInOrbit(); if (fleet != null) { try { using (CargoDialog cargoDialog = new CargoDialog(fleet, clientState)) { cargoDialog.ShowDialog(); UpdateFields(); } ComboFleetsInOrbit_SelectedIndexChanged(null, null); } catch { Report.Debug("FleetDetail.cs : CargoButton_Click() - Failed to open cargo dialog."); } } }