Example #1
0
 public BehavioralPattern()
 {
     _chainOfResponsibilityDemo = new ChainOfResponsibilityDemo();
     _iteratorDemo = new IteratorDemo();
     _commandDemo  = new CommandDemo();
     _mediatorDemo = new MediatorDemo();
     _mementoDemo  = new MementoDemo();
     _observerDemo = new ObserverDemo();
     _stateDemo    = new StateDemo();
     _strategyDemo = new StrategyDemo();
     _visitorDemo  = new VisitorDemo();
 }
Example #2
0
        static void Main(string[] args)
        {
            Console.WriteLine("Hello World!");
            CompositeDemo.Composite();
            var command = new string[]
            {
                "CreateOrder"
            };

            CommandDemo.RunCommand(command);

            Console.ReadKey();
        }
Example #3
0
        static void Main(string[] args)
        {
            CombinedDemo combined = new CombinedDemo();
            MementoDemo  memento  = new MementoDemo();
            CommandDemo  command  = new CommandDemo();

            bool done = false;

            do
            {
                Console.WriteLine(
                    "Select option:\n 1 for Memento demo \n 2 for Command demo \n 3 for Combined demo \n Q for terminate program\n");
                string function = Console.ReadLine();
                if (string.IsNullOrEmpty(function))
                {
                    continue;
                }

                switch (function[0])
                {
                case '1':
                {
                    memento.demo();
                    break;
                }

                case '2':
                {
                    command.demo();
                    break;
                }

                case '3':
                {
                    combined.demo();
                    break;
                }

                case 'Q':
                case 'q':
                {
                    done = true;
                    break;
                }

                default:
                    break;
                }
            } while (!done);
        }
Example #4
0
 static void Main(string[] args)
 {
     // DecoratorDemo.Demo();
     CommandDemo.Demo();
 }