Exemple #1
0
        private Figure PolyhedronChoosingMenu()
        {
            Console.WriteLine("Polyhedron choosing menu:\n" +
                              "Create from current polygon - 1\n" +
                              "Create from saved polygon - 2\n" +
                              "Back - b");

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

            Console.WriteLine();

            Figure figure = null;

            switch (input.ToLower())
            {
            case "1":
                if (_interactor.GetFigure() is Polygon)
                {
                    figure = _interactor.GetFigure();
                    Console.Clear();

                    return(figure);
                }

                Console.Clear();
                ConsoleView.ColorizeError("There is no current polygon");
                Console.WriteLine();

                break;

            case "2":
                Console.Write("Enter the polygon name: ");
                string name = Console.ReadLine();
                Console.WriteLine();

                Console.Clear();
                figure = _interactor.LoadPolygon(name);

                if (figure != null)
                {
                    return(figure);
                }

                break;

            case "b":
                Console.Clear();

                return(null);
            }

            return(PolyhedronChoosingMenu());
        }