Exemplo n.º 1
0
        //Avoid coupling the sender of a request to its receiver by giving more than one
        //object chance to handle the request.
        static void Main(string[] _)
        {
            var lamp    = new Lamp();
            var turnOff = new TurnOff(lamp);
            var turnOn  = new TurnOn(lamp);

            var remote = new RemoteControl();

            remote.Submit(turnOff);
            remote.Submit(turnOn);

            Console.ReadKey();
        }
Exemplo n.º 2
0
        static void Main()
        {
            var bulb = new Bulb();

            var turnOn  = new TurnOn(bulb);
            var turnOff = new TurnOff(bulb);

            var remote = new RemoteControl();

            remote.Submit(turnOn);
            remote.Submit(turnOff);

            Console.ReadLine();
        }
Exemplo n.º 3
0
        static void Main(string[] args)
        {
            IDevice bulb = new Bulb();

            ICommand turnOn  = new TurnOn(bulb);
            ICommand turnOff = new TurnOff(bulb);

            RemoteControl remote = new RemoteControl();

            remote.submit(turnOn);
            remote.submit(turnOff);

            System.Console.ReadLine();
        }
Exemplo n.º 4
0
        static void Main(string[] args)
        {
            IDevice bulb = new Bulb();

            var bulbTurnOn  = new TurnOn(bulb);
            var bulbTurnOff = new TurnOff(bulb);

            Remote remote = new Remote();

            remote.Submit(bulbTurnOn);
            //remote.SubmitUndo(bulbTurnOn);
            remote.Submit(bulbTurnOff);

            Console.ReadKey();
        }
Exemplo n.º 5
0
        static void Main(string[] args)
        {
            var bulb = new Bulb();

            var turnOn = new TurnOn(bulb);

            var turnOff = new TurnOff(bulb);

            var remote = new RemoteControl();

            remote.Submit(turnOn);

            remote.Submit(turnOff);

            turnOff.Undo();

            turnOn.Redo();

            Console.ReadKey();
        }