static void Main(string[] args) { Player player = new Player(); PlayCommand PlayCommand = new PlayCommand(); player.Invoke(PlayCommand); StopCommand dvdStopCommand = new StopCommand(); player.Invoke(dvdStopCommand); }
private static void DriveVehicle(IVehicle vehicle, Driver driver) { ICommand powerOnCommand = new PowerOnCommand(vehicle); ICommand powerOffCommand = new PowerOffCommand(vehicle); ICommand driveCommand = new DriveCommand(vehicle); ICommand stopCommand = new StopCommand(vehicle); driver.ExecuteCommand(powerOnCommand); driver.ExecuteCommand(driveCommand); driver.ExecuteCommand(stopCommand); driver.ExecuteCommand(powerOffCommand); }