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(); }
public GarageDoorOpenCommand(GarageDoor garageDoor) { this.garageDoor = garageDoor; }