Example #1
0
        public static void Show()
        {
            var service = new CustomerService();
            var command = new AddCustomerCommand(service);
            var button  = new Button(command);

            button.Click();

            var compositeCommand = new CompositeCommand();

            compositeCommand.Add(new ResizeCommand());
            compositeCommand.Add(new BlackAndWhiteCommand());
            compositeCommand.Execute();

            var history  = new History();
            var document = new HtmlDocument();

            document.Content = "Hello World";
            var boldCommand = new BoldCommand(document, history);

            boldCommand.Execute();
            Console.WriteLine(document.Content);
            var undoCommand = new UndoCommand(history);

            undoCommand.Execute();
            Console.WriteLine(document.Content);
        }
Example #2
0
        public static void Main(string[] args)
        {
            Text     paragraph = new Text();
            ICommand bold      = new BoldCommand(paragraph);
            ICommand unbold    = new UnboldCommand(paragraph);

            RichTextEditorInvoker richTextEditor = new RichTextEditorInvoker();

            richTextEditor.StoreAndExecute(bold);
            richTextEditor.StoreAndExecute(unbold);
        }
Example #3
0
        public static void Main(string[] args)
        {
            Text paragraph = new Text();
            ICommand bold = new BoldCommand(paragraph);
            ICommand unbold = new UnboldCommand(paragraph);

            RichTextEditorInvoker richTextEditor  = new RichTextEditorInvoker();
            richTextEditor.StoreAndExecute(bold);
            richTextEditor.StoreAndExecute(unbold);
        }