public virtual IExampleChoice ChooseAndShow(EExample example)
        {
            IExampleChoice choice = null;

            switch (example)
            {
            case EExample.Example_1:
                choice = new Example_1();
                break;

            case EExample.Example_2:
                choice = new Example_2();
                break;

            case EExample.Example_3:
                choice = new Example_3();
                break;

            case EExample.Example_4:
                choice = new Example_4();
                break;

            case EExample.Example_5:
                choice = new Example_5();
                break;

            case EExample.Example_6:
                choice = new Example_6();
                break;

            case EExample.Example_7:
                choice = new Example_7();
                break;

            case EExample.Quit:
            default: break;
            }

            return(choice);
        }
Beispiel #2
0
        public void ChooseAndShow()
        {
            var enumEExampleMemberCount = Enum.GetNames(typeof(EExample)).Length - 1;
            var choosed = true;

            do
            {
                Console.Clear();
                Console.WriteLine($"Example - type your choice number from 1 to {enumEExampleMemberCount} and b if want you to get back");
                var _choice = Console.ReadKey().KeyChar;
                _choice = char.ToLower(_choice);
                Console.WriteLine();
                choosed = true;
                switch (_choice)
                {
                case 'b':
                    break;

                case '1':
                    Example = EExample.Example_1;
                    break;

                case '2':
                    Example = EExample.Example_2;
                    break;

                case '3':
                    Example = EExample.Example_3;
                    break;

                case '4':
                    Example = EExample.Example_4;
                    break;

                case '5':
                    Example = EExample.Example_5;
                    break;

                case '6':
                    Example = EExample.Example_6;
                    break;

                case '7':
                    Example = EExample.Example_7;
                    break;

                default:
                    choosed = false;
                    break;
                }
                if (choosed)
                {
                    break;
                }
            }while (1 == 1);

            ExampleFactory exampleFactory = new ExampleFactory();

            Choice = exampleFactory.ChooseAndShow(Example);
            Choice?.Show();
        }