Пример #1
0
        private void PolyhedronCreationMenu()
        {
            Figure polygon = PolyhedronChoosingMenu();

            if (polygon == null || polygon is Polygon == false)
            {
                CreateFigureMenu();

                return;
            }

            Console.WriteLine("Polyhedron creation menu:\n" +
                              "Choose a polyhedron to create\n" +
                              "Cube - 1\n" +
                              "Parallelepiped - 2\n" +
                              "Prism - 3\n" +
                              "Pyramid - 4\n" +
                              "Back - b\n");

            Console.Write("Input: ");
            string input = Console.ReadLine();

            Console.WriteLine();

            Figure figure = null;
            double height = 0;

            switch (input)
            {
            case "1":
                Console.Clear();

                figure = _interactor.CreatePolyhedron("cube", (Polygon)polygon);

                break;

            case "2":
                Console.Write("Enter the height : ");
                height = Double.Parse(Console.ReadLine());
                Console.WriteLine();

                Console.Clear();

                figure = _interactor.CreatePolyhedron("parallelepiped", (Polygon)polygon, height);

                break;

            case "3":
                Console.Write("Enter the height : ");
                height = Double.Parse(Console.ReadLine());
                Console.WriteLine();

                Console.Clear();

                figure = _interactor.CreatePolyhedron("prism", (Polygon)polygon, height);

                break;

            case "4":
                Console.Write("Enter the height : ");
                height = Double.Parse(Console.ReadLine());
                Console.WriteLine();

                Console.Clear();

                figure = _interactor.CreatePolyhedron("pyramid", (Polygon)polygon, height);

                break;

            case "b":
                Console.Clear();

                return;
            }

            if (figure != null)
            {
                _interactor.SetFigure(figure);
                PolyhedronParamsMenu();
            }
            else
            {
                PolyhedronCreationMenu(); // #TODO Create a new line
            }
        }