private async void Save(ExtendedVehicle extendedVehicle) { if (extendedVehicle != null) { if (!await this.CheckIfContainsSameName(extendedVehicle)) { try { await this.clientOperationManager.Save(VehiclesMapping.ToVehicle(extendedVehicle)); extendedVehicle.IsItemSaved = true; MessageBox.Show("Vehicle saved successfuly", "Information", MessageBoxButton.OK, MessageBoxImage.Information); } catch (EndpointNotFoundException e) { Trace.WriteLine(e); MessageBox.Show("Error: Connection lost", "Information", MessageBoxButton.OK, MessageBoxImage.Error); } catch (Exception e) { Trace.WriteLine(e); MessageBox.Show("Failed to save vehicle, for extended info watch log", "Information", MessageBoxButton.OK, MessageBoxImage.Warning); } } else { MessageBox.Show("Such vehicle already exists", "Information", MessageBoxButton.OK, MessageBoxImage.Exclamation); } } }
public async void RepairVehicle(ExtendedVehicle extendedVehicle) { if (extendedVehicle != null) { this.CarStation.RepairVehicle(extendedVehicle); if (extendedVehicle.IsItemSaved) { try { await this.clientOperationManager.Repare(VehiclesMapping.ToVehicle(extendedVehicle)); MessageBox.Show("Vehicle Repared successfuly", "Information", MessageBoxButton.OK, MessageBoxImage.Information); } catch (EndpointNotFoundException e) { Trace.WriteLine(e); MessageBox.Show("Error: Connection lost", "Information", MessageBoxButton.OK, MessageBoxImage.Error); } catch (Exception e) { Trace.WriteLine(e); MessageBox.Show("Failed to repare vehicle, for extended info watch log", "Information", MessageBoxButton.OK, MessageBoxImage.Warning); } } } }