Esempio n. 1
0
        static void Main(string[] args)
        {
            Invoker       invoker = new Invoker();
            LightReceiver light   = new LightReceiver();

            invoker.AddCommand(new RedColorCommand(light));
            invoker.AddCommand(new SwitchCommand(light));
            invoker.AddCommand(new SwitchCommand(light));
            invoker.AddCommand(new YellowColorCommand(light));
            invoker.AddCommand(new SwitchCommand(light));
            invoker.AddCommand(new SwitchCommand(light));

            invoker.ExecuteCommands();

            Console.ReadLine();
        }
Esempio n. 2
0
 public SwitchCommand(LightReceiver receiver)
 {
     _receiver = receiver;
 }
Esempio n. 3
0
 public YellowColorCommand(LightReceiver receiver)
 {
     _receiver = receiver;
 }
Esempio n. 4
0
 public RedColorCommand(LightReceiver receiver)
 {
     _receiver = receiver;
 }