public purchaseTerminal ( |
||
airline | ||
Résultat | void |
private void btnBuyTerminal_Click(object sender, RoutedEventArgs e) { AirportTerminalMVVM terminal = (AirportTerminalMVVM)((Button)sender).Tag; long price = terminal.Gates * this.Airport.Airport.getTerminalGatePrice() + this.Airport.Airport.getTerminalPrice(); if (price > GameObject.GetInstance().HumanAirline.Money) { WPFMessageBox.Show(Translator.GetInstance().GetString("MessageBox", "2205"), Translator.GetInstance().GetString("MessageBox", "2205", "message"), WPFMessageBoxButtons.Ok); } else { WPFMessageBoxResult result = WPFMessageBox.Show(Translator.GetInstance().GetString("MessageBox", "2211"), string.Format(Translator.GetInstance().GetString("MessageBox", "2211", "message"), price), WPFMessageBoxButtons.YesNo); if (result == WPFMessageBoxResult.Yes) { terminal.purchaseTerminal(GameObject.GetInstance().HumanAirline); AirlineHelpers.AddAirlineInvoice(GameObject.GetInstance().HumanAirline, GameObject.GetInstance().GameTime, Invoice.InvoiceType.Purchases, -price); } } }
public void purchaseTerminal(AirportTerminalMVVM terminal, Airline airline) { terminal.purchaseTerminal(airline); foreach (AirportContract contract in Airport.AirlineContracts) { if (Contracts.FirstOrDefault(c=>c.Contract == contract) == null) Contracts.Add(new ContractMVVM(contract)); } }