static void Main() { RemoteControl remote = new RemoteControl(); Lights lights = new Lights(); ICommand command1 = new TurnLightsOn(lights); ICommand command2 = new TurnLightsOff(lights); remote.SetButton(0, command1); remote.PressButton(0); remote.SetButton(0, command2); remote.PressButton(0); Console.ReadLine(); }
private static void Main(string[] args) { Console.ForegroundColor = ConsoleColor.Green; Console.Title = "Command"; var remoteControl = new RemoteControl(); var tv = new TV(); remoteControl.SetCommand(new TVOnCommand(tv)); remoteControl.PressButton(); remoteControl.PressUndo(); var microwave = new Microwave.Microwave(); // 5000 - время нагрева пищи remoteControl.SetCommand(new MicrowaveCommand(microwave, 5000)); remoteControl.PressButton(); Console.ReadKey(); }