static void Main(string[] args)
        {
            Document document = new Document();
            ICommand displayCmd = new DisplayCommand(document);
            ICommand redoCmd = new RedoCommand(document);
            ICommand undoCmd = new UndoCommand(document);

            Invoker invoker = new Invoker(displayCmd, redoCmd, undoCmd);
            invoker.Display();
            invoker.Redo();
            invoker.Undo();
        }
Пример #2
0
        static void Main(string[] args)
        {
            // Create receiver, command, and invoker
            Receiver receiver = new Receiver();
            Command command = new ConcreteCommand(receiver);
            Invoker invoker = new Invoker();

            // Set and execute command
            invoker.SetCommand(command);
            invoker.ExecuteCommand();

            // Wait for user
            Console.Read();
        }