Ejemplo n.º 1
0
        static void Main(string[] args)
        {
            IKernel kernel = new StandardKernel();

            BindDependencies(kernel);

            ////1. MemoryManagement
            //// new MemoryManagement().Start();

            ////2.DesignPattern
            IDesignPattern designPattern = kernel.Get <IDesignPattern>();

            designPattern.RunChainOfResponsibility();
        }
Ejemplo n.º 2
0
        private static bool RunExample(string patternName)
        {
            Console.WriteLine("\nPress 1 to run the example or any key to go to Main Menu!");
            int selectedOption = ReadInputFromConsole();

            if (selectedOption == 1)
            {
                Console.WriteLine("\nCreating instance of pattern and running the example...\n");
                IDesignPattern designPattern = DesignPatternsFactory.GetInstance(patternName);
                designPattern.RunExample();
                Console.WriteLine("");
                return(true);
            }
            return(false);
        }
Ejemplo n.º 3
0
        static void Main(string[] args)
        {
            IDesignPattern DesignPattern = null;

            Console.WriteLine("State");
            DesignPattern = new StateDesignPattern.StateDesignPattern();
            DesignPattern.Run();

            Console.WriteLine("Strategy and Null");
            DesignPattern = new StrategyPattern.StrategyPattern();
            DesignPattern.Run();

            Console.WriteLine("Singleton");
            DesignPattern = new SingletonPattern.SingletonPattern();
            DesignPattern.Run();

            Console.WriteLine("Observer");
            DesignPattern = new ObserverPattern.ObserverPattern();
            DesignPattern.Run();

            Console.WriteLine("Iterator");
            DesignPattern = new IteratorPattern.IteratorPattern();
            DesignPattern.Run();

            Console.WriteLine("Decorator Pattern");
            DesignPattern = new DecoratorPattern.DecoratorPattern();
            DesignPattern.Run();

            Console.WriteLine("Facade Pattern");
            DesignPattern = new FacadePattern.FacadePattern();
            DesignPattern.Run();

            Console.WriteLine("Command Pattern");
            DesignPattern = new CommandPattern.CommandPattern();
            DesignPattern.Run();
        }