Esempio n. 1
0
        public VehicleEditorControl CreateNewEditor(IList <Vehicle> vehicles, IList <Module> modules)
        {
            var editor = new TankDestroyerEditor();

            editor.Modules = modules;

            editor.SaveCommand = new AddNewVehicleCommand(vehicles, editor.ModifiedTankDestroyer);

            return(editor);
        }
Esempio n. 2
0
        public VehicleEditorControl CreateEditor(Vehicle vehicle, IList <Module> modules)
        {
            if (!IsValidVehicle(vehicle))
            {
                throw new ArgumentException("Invalid vehicle");
            }

            var editor = new TankDestroyerEditor();

            editor.Modules = modules;

            TankDestroyer targetTankDestroyer = vehicle as TankDestroyer;

            editor.TankDestroyer = targetTankDestroyer;
            editor.SaveCommand   = new SaveEdittedVehicleCommand <TankDestroyer>(targetTankDestroyer, editor.ModifiedTankDestroyer);

            return(editor);
        }