public VehicleEditorControl CreateNewEditor(IList <Vehicle> vehicles, IList <Module> modules) { var editor = new TowerTankEditor(); editor.Modules = modules; editor.SaveCommand = new AddNewVehicleCommand(vehicles, editor.ModifiedTowerTank); return(editor); }
public VehicleEditorControl CreateEditor(Vehicle vehicle, IList <Module> modules) { if (!IsValidVehicle(vehicle)) { throw new ArgumentException("Invalid vehicle"); } var editor = new TowerTankEditor(); editor.Modules = modules; TowerTank targetTowerTank = vehicle as TowerTank; editor.TowerTank = targetTowerTank; editor.SaveCommand = new SaveEdittedVehicleCommand <TowerTank>(targetTowerTank, editor.ModifiedTowerTank); return(editor); }