Exemplo n.º 1
0
        static void TestUndoableCommand()
        {
            var history  = new Command.Editor.History();
            var document = new Command.Editor.HtmlDocument();

            document.Content = "Hello World";

            var boldCommand = new BoldCommand(document, history);

            boldCommand.Execute();

            System.Console.WriteLine(document.Content);

            document.Content = "This is Command Pattern";
            boldCommand      = new BoldCommand(document, history);
            boldCommand.Execute();

            System.Console.WriteLine(document.Content);

            var undoCommand = new UndoCommand(history);

            undoCommand.Execute();

            System.Console.WriteLine(document.Content);

            undoCommand.Execute();
            System.Console.WriteLine(document.Content);
        }