static void Main(string[] args) { Button button = new Button(); Microwave microwave = new Microwave(); button.SetCommand(new MicrowaveCommand(microwave, 3000));//3 секунду подоговреваем еду button.PressButton(); Console.ReadKey(); }
static void Main(string[] args) { Pult pult = new Pult(); TV tv = new TV(); pult.SetCommand(new TVOnCommand(tv)); pult.PressButton(); pult.PressUndo(); Microwave microwave = new Microwave(); pult.SetCommand(new MicrowaveCommand(microwave, 5000)); pult.PressButton(); Console.Read(); }
static void Main(string[] args) { Console.ForegroundColor = ConsoleColor.Green; Console.Title = "Command"; RemoteControl remoteControl = new RemoteControl(); TV tv = new TV(); remoteControl.SetCommand(new TVOnCommand(tv)); remoteControl.PressButton(); remoteControl.PressUndo(); Microwave microwave = new Microwave(); // 5000 - время нагрева пищи remoteControl.SetCommand(new MicrowaveCommand(microwave, 5000)); remoteControl.PressButton(); Console.ReadKey(); }
static void Main(string[] args) { Pult pult = new Pult(); TV tv = new TV(); pult.SetCommand(new TVOnCommand(tv)); pult.PressButton(); pult.PressUndo(); Microwave microwave = new Microwave(); pult.SetCommand(new MicrowaveCommand(microwave, 5000)); pult.PressButton(); MacroCommand macro = new MacroCommand(new List <ICommand>() { new TVOnCommand(tv), new MicrowaveCommand(microwave, 5000) }); pult.SetCommand(macro); pult.PressButton(); }
public MicrowaveCommand(Microwave m, int t) { microwave = m; time = t; }
public MicrowaveCommand(Microwave microwave, int time) { this.microwave = microwave; }
public MicrowaveCommand(Microwave microwave, int time) { m_Microwave = microwave; m_Time = time; }