Example #1
0
        static void Main(string[] args)
        {
            Button    button    = new Button();
            Microwave microwave = new Microwave();

            button.SetCommand(new MicrowaveCommand(microwave, 3000));//3 секунду подоговреваем еду
            button.PressButton();

            Console.ReadKey();
        }
Example #2
0
        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();
        }
Example #3
0
        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();
        }
Example #4
0
        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();
        }
Example #5
0
 public MicrowaveCommand(Microwave m, int t)
 {
     microwave = m;
     time      = t;
 }
Example #6
0
 public MicrowaveCommand(Microwave microwave, int time)
 {
     this.microwave = microwave;
 }
Example #7
0
 public MicrowaveCommand(Microwave microwave, int time)
 {
     m_Microwave = microwave;
     m_Time      = time;
 }