예제 #1
0
        static void Main(string[] args)
        {
            SimpleRemoteControl remote = new SimpleRemoteControl();                     // Инициатор (Официантка)

            Light          light   = new Light();                                       // Получатель (Повар)
            LightOnCommand lightOn = new LightOnCommand(light);                         // Команда (Заказ)

            remote.SetCommand(lightOn);
            remote.ButtonWasPressed();

            GarageDoor            garageDoor = new GarageDoor();
            GarageDoorOpenCommand garageOpen = new GarageDoorOpenCommand(garageDoor);

            remote.SetCommand(garageOpen);
            remote.ButtonWasPressed();

            Console.ReadKey();
        }
예제 #2
0
 public GarageDoorOpenCommand(GarageDoor garageDoor)
 {
     this.garageDoor = garageDoor;
 }