Exemplo n.º 1
0
        private static void Main()
        {
            Console.WriteLine("Escolha a operação:");
            Console.WriteLine("------------------------");
            Console.WriteLine("Creational Patterns");
            Console.WriteLine("------------------------");
            Console.WriteLine("1 - Abstract Factory");
            Console.WriteLine("2 - Method Factory");
            Console.WriteLine("3 - Singleton");
            Console.WriteLine("------------------------");
            Console.WriteLine("Structural Patterns");
            Console.WriteLine("------------------------");
            Console.WriteLine("4 - Adapter");
            Console.WriteLine("5 - Facade");
            Console.WriteLine("6 - Composite");
            Console.WriteLine("------------------------");
            Console.WriteLine("Behavioral Patterns");
            Console.WriteLine("------------------------");
            Console.WriteLine("7 - Command");
            Console.WriteLine("8 - Strategy");
            Console.WriteLine("9 - Observer");
            Console.WriteLine("------------------------");

            var opcao = Console.ReadKey();

            Console.WriteLine("");
            Console.WriteLine("------------------------");
            Console.WriteLine("");

            switch (opcao.KeyChar)
            {
            case '1':
                ExecucaoAbstractFactory.Executar();
                break;

            case '2':
                ExecucaoFactoryMethod.Executar();
                break;

            case '3':
                ExecucaoSingleton.Executar();
                break;

            case '4':
                ExecucaoAdapter.Executar();
                break;

            case '5':
                ExecucaoFacade.Executar();
                break;

            case '6':
                ExecucaoComposite.Executar();
                break;

            case '7':
                ExecucaoCommand.Executar();
                break;

            case '8':
                ExecucaoStrategy.Executar();
                break;

            case '9':
                ExecucaoObserver.Executar();
                break;
            }

            Console.ReadKey();
            Console.Clear();
            Main();
        }
Exemplo n.º 2
0
        static void Main(string[] args)
        {
            string option;

            do
            {
                Console.Clear();
                Console.ForegroundColor = ConsoleColor.White;
                Console.WriteLine("#################################################");
                Console.WriteLine("");
                Console.WriteLine("Creational");
                Console.WriteLine("");
                Console.WriteLine("1 - Abstract Factory");
                Console.WriteLine("2 - Factory Method");
                Console.WriteLine("3 - Singleton");
                Console.WriteLine("");
                Console.WriteLine("#################################################");
                Console.WriteLine("");
                Console.WriteLine("Structural");
                Console.WriteLine("");
                Console.WriteLine("4 - Adapter");
                Console.WriteLine("5 - Facade");
                Console.WriteLine("6 - Composite");
                Console.WriteLine("");
                Console.WriteLine("#################################################");
                Console.WriteLine("");
                Console.WriteLine("Behavioral");
                Console.WriteLine("");
                Console.WriteLine("7 - Command");
                Console.WriteLine("8 - Strategy");
                Console.WriteLine("9 - Observer");
                Console.WriteLine("");
                Console.WriteLine("#################################################");
                Console.WriteLine("");
                Console.WriteLine("0 - Sair");
                Console.WriteLine("");

                option = Console.ReadLine();

                Console.WriteLine("");
                Console.ForegroundColor = ConsoleColor.Blue;

                switch (option)
                {
                case "1":
                    ExecucaoAbstractFactory.Executar();
                    break;

                case "2":
                    ExecucaoFactoryMethod.Executar();
                    break;

                case "3":
                    Singleton.Executar();
                    break;

                case "4":
                    ExecucaoAdapter.Executar();
                    break;

                case "5":
                    ExecucaoFacade.Executar();
                    break;

                case "6":
                    ExecucaoComposite.Executar();
                    break;

                case "7":
                    ExecucaoCommand.Executar();
                    break;

                case "8":
                    ExecucaoStrategy.Executar();
                    break;

                case "9":
                    ExecucaoObserver.Executar();
                    break;

                default:
                    Console.WriteLine("Opção indisponível");
                    break;
                }

                if (option != "0")
                {
                    Console.ForegroundColor = ConsoleColor.Yellow;
                    Console.WriteLine("");
                    Console.WriteLine("Pressione qualquer tecla para continuar");
                    Console.WriteLine("");
                    Console.ReadKey();
                }
            } while (option != "0");
        }
Exemplo n.º 3
0
        private static void Main()
        {
            Console.WriteLine(@"_____                                 _     _              _____ ____   ");
            Console.WriteLine(@"|  __ \                               | |   | |            |_   _/ __ \ ");
            Console.WriteLine(@"| |  | | ___  ___  ___ _ ____   _____ | | __| | ___  _ __    | || |  | |");
            Console.WriteLine(@"| |  | |/ _ \/ __|/ _ \ '_ \ \ / / _ \| |/ _` |/ _ \| '__|   | || |  | |");
            Console.WriteLine(@"| |__| |  __/\__ \  __/ | | \ V / (_) | | (_| | (_) | |     _| || |__| |");
            Console.WriteLine(@"|_____/ \___||___/\___|_| |_|\_/ \___/|_|\__,_|\___/|_|    |_____\____/ ");
            Console.WriteLine("\n\nCurso Fundamentos de Arquitetura de Software\n\n");
            Console.WriteLine("Escolha a operação:");
            Console.WriteLine("----------------------------------------------------------------------------");
            Console.WriteLine("Creational Patterns          Structural Patterns         Behavorial Patterns");
            Console.WriteLine("----------------------------------------------------------------------------");
            Console.WriteLine("1 - Abstract Factory         4 - Adapter                 7 - Command");
            Console.WriteLine("2 - Method Factory           5 - Facade                  8 - Strategy");
            Console.WriteLine("3 - Singleton                6 - Composite               9 - Observer");

            var opcao = Console.ReadKey();

            Console.WriteLine("");
            Console.WriteLine("----------------------------------------------------------------------------");
            Console.WriteLine("");

            switch (opcao.KeyChar)
            {
            case '1':
                ExecucaoAbstractFactory.Executar();
                break;

            case '2':
                ExecucaoFactoryMethod.Executar();
                break;

            case '3':
                ExecucaoSingleton.Executar();
                break;

            case '4':
                ExecucaoAdapter.Executar();
                break;

            case '5':
                ExecucaoFacade.Executar();
                break;

            case '6':
                ExecucaoComposite.Executar();
                break;

            case '7':
                ExecucaoCommand.Executar();
                break;

            case '8':
                ExecucaoStrategy.Executar();
                break;

            case '9':
                ExecucaoObserver.Executar();
                break;
            }

            Console.ReadKey();
            Console.Clear();
            Main();
        }