Example #1
0
        static void Main(string[] args)
        {
            Console.WriteLine("Escolha a operação\n");
            Console.WriteLine("Criational Patterns\n");
            Console.WriteLine("1- AbtrasctFactory");
            Console.WriteLine("2 - Method Factory");
            Console.WriteLine("Singleton\n");
            Console.WriteLine("Structural Patterns\n");
            Console.WriteLine("4 = Adapter");
            Console.WriteLine("5 - Facade\n");
            Console.WriteLine("Behavioral Patterns");
            Console.WriteLine("6 - Command");
            Console.WriteLine("7 - Strategy");
            Console.WriteLine("8 - Observer\n");

            var opc = Console.ReadKey();

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

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

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

            case '4':
                ExecucaoAdapter.Executar();
                break;
            }
        }
        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 - Factory Method");
            Console.WriteLine("3 - Singleton");
            Console.WriteLine("------------------------");
            Console.WriteLine("Structural Patterns");
            Console.WriteLine("------------------------");
            Console.WriteLine("4 - Adapter");
            Console.WriteLine("5 - Facade");
            Console.WriteLine("------------------------");
            Console.WriteLine("Behavioral Patterns");
            Console.WriteLine("------------------------");
            Console.WriteLine("6 - Command");
            Console.WriteLine("7 - Strategy");
            Console.WriteLine("8 - Observer");
            Console.WriteLine("------------------------");

            var opcao = Console.ReadKey();

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

            switch (opcao.KeyChar)
            {
            case '1':
                ExecucaoAbstractFactory.Executar();
                break;
            }
        }
        static void Main(string[] args)
        {
            Console.WriteLine("Bem vindo(a) à cozinha do Alexandre!");
            Console.WriteLine("************************************");
            Console.WriteLine("MENU");
            Console.WriteLine("1 - Abstract Factory");
            Console.WriteLine("2 - Factory Method");
            Console.WriteLine("3 - Singleton");

            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':
                Singleton.Singleton.Executar();
                break;

            default:
                break;
            }
        }
Example #4
0
        static void Main(string[] args)
        {
            while (true)
            {
                Console.WriteLine("Escolha uma opção:");
                Console.WriteLine("");
                Console.WriteLine("1: Abstract Factory:");
                Console.WriteLine("2: Factory Method:");
                Console.WriteLine("3: Singleton:");
                Console.WriteLine("------------------------");
                Console.WriteLine("4: Adapter:");
                Console.WriteLine("5: Facade:");
                Console.WriteLine("1: Composite:");
                Console.WriteLine("------------------------");
                Console.WriteLine("7: Command:");
                Console.WriteLine("8: Observer:");
                Console.WriteLine("9: Strategy:");
                var key = Console.ReadKey();

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

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

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

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

                case '\u001b':
                    Environment.Exit(0);
                    break;

                default:
                    continue;
                }
            }
        }
Example #5
0
        static void Main(string[] args)
        {
            Console.WriteLine("Digite o ID do pattern à executar:");
            Console.WriteLine("----------------------------------");
            Console.WriteLine("0 - Factory Method");
            Console.WriteLine("1 - Abstract Factory");
            Console.WriteLine("----------------------------------");
            Console.WriteLine("2 - Observer");

            var id = Convert.ToInt32(Console.ReadLine());

            switch (id)
            {
            case 0:
                Console.Clear();
                Console.WriteLine("");
                ExecucaoFactoryMethod.Executar();
                break;

            case 1:
                Console.Clear();
                Console.WriteLine("");
                ExecucaoAbstractFactory.Executar();
                break;

            case 2:
                Console.Clear();
                Console.WriteLine("");
                ExecucaoObserver.Executar();
                break;

            default:
                Console.WriteLine("Pattern não encontrado!");
                break;
            }
        }
Example #6
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");
        }
Example #7
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();
        }