static void Main22(string[] args) { TV tv = new TV(); // receiver ICommand tvOnCommand = new TVOnCommand(tv); // concrete command RemoteControl remoteControl = new RemoteControl(); // invoker remoteControl.SetCommand(tvOnCommand); remoteControl.PressButton(); remoteControl.PressButtonUndo(); Console.ReadKey(); Microwave microwave = new Microwave(); ICommand microwaveCommand = new MicrowaveCommand(microwave); remoteControl.SetCommand(microwaveCommand); remoteControl.PressButton(); remoteControl.PressButtonUndo(); ICommand simpleCommand = new SimpleCommand(microwave.StartCooking); simpleCommand.Execute(); }
public MicrowaveCommand(Microwave microwave) { _microwave = microwave; }