Пример #1
0
        public void Process()
        {
            CommandLineInterface.Write(CLIMessages.WELLCOME_TO_DRAWING_PROGRAM);

            UserCommand userCommand = null;
            Canvas      canvas      = null;

            do
            {
                try
                {
                    CommandLineInterface.Write(CLIMessages.STANDARD_SEPARATOR);
                    userCommand = CommandLineInterface.WaitForUserCommand("Type your command: ");
                    CommandLineInterface.Write(this.GetDrawingProgramAnswerForUserCommand(userCommand, ref canvas));
                }
                catch (DrawingException ex)
                {
                    CommandLineInterface.Write($"Drawing exception: {ex.Message}");
                }
                catch (ShapeException ex)
                {
                    CommandLineInterface.Write($"Shape exception: {ex.Message}");
                }
                catch (ArgumentException ex)
                {
                    CommandLineInterface.Write($"Argument exception: {ex.Message}");
                }
                catch (Exception ex)
                {
                    CommandLineInterface.Write($"Exception: {ex.Message}");
                }
            } while (userCommand != null && userCommand.Command != EnumCommand.Q);

            Console.ReadKey();
        }