예제 #1
0
파일: Program.cs 프로젝트: viesl/Training
        static void Main(string[] args)
        {
            Player      player      = new Player();
            PlayCommand PlayCommand = new PlayCommand();

            player.Invoke(PlayCommand);
            StopCommand dvdStopCommand = new StopCommand();

            player.Invoke(dvdStopCommand);
        }
예제 #2
0
        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);
        }