Ejemplo n.º 1
0
        private void PolygonParamsMenu()
        {
            Console.WriteLine("Polygon parameters menu:\n" +
                              "Perimeter - 1\n" +
                              "Area - 2\n" +
                              "Apexes amount - 3\n" +
                              "Save figure - 4\n" +
                              "Back - b");

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

            Console.WriteLine();

            try
            {
                switch (input)
                {
                case "1":
                    Console.Clear();
                    ConsoleView.ColorizeSuccess($"Perimeter : {_interactor.GetPerimeter()}");
                    Console.WriteLine();

                    break;

                case "2":
                    Console.Clear();
                    ConsoleView.ColorizeSuccess($"Area : {_interactor.GetArea()}");
                    Console.WriteLine();

                    break;

                case "3":
                    Console.Clear();
                    ConsoleView.ColorizeSuccess($"Apexes : {_interactor.GetApexes()}");
                    Console.WriteLine();

                    break;

                case "4":
                    Console.WriteLine("Enter the figure name : ");
                    string name = Console.ReadLine();
                    Console.Clear();

                    if (_interactor.SavePolygon(name))
                    {
                        ConsoleView.ColorizeInfo("Polygon was successfully saved");
                        Console.WriteLine();
                    }

                    break;

                case "b":
                    Console.Clear();

                    return;
                }
            }
            catch (Exception e)
            {
                Console.Clear();
                ConsoleView.ColorizeError(e.Message);
                Console.WriteLine();
            }

            PolygonParamsMenu();
        }