Example #1
0
        static void Main(string[] args)
        {
            Receiver receiver = new Receiver();
            ICommand cmd      = new PrintCommand(receiver);
            Invoker  invoker  = new Invoker();

            invoker.StoreCommand(cmd);
            invoker.Invoke();
        }
Example #2
0
        static void Main(string[] args)
        {
            Receiver receiver = new Receiver();
            Command  command  = new ConcreteCommand(receiver);
            Invoker  invoker  = new Invoker();

            invoker.StoreCommand(command);
            invoker.ExecuteCommand();

            Console.ReadLine();
        }
Example #3
0
        static void Main(string[] args)
        {
            Command
                c = new ConcreteCommand();

            Receiver
                r = new Receiver();

            c.R = r;

            Invoker
                i = new Invoker();

            i.StoreCommand(c);
            i.ExecuteCommand();
        }