Пример #1
0
        public void Run()
        {
            while (true)
            {
                string command = inputService.ReadCommand();

                try
                {
                    CommandTypes commandType = inputParserService.ParseCommand(command);

                    Arguments arguments = inputService.ReadArguments();

                    WriteMessageToAllOutputServices(calculator.Execute(commandType, arguments).ToString());
                }
                catch
                {
                    WriteMessageToAllOutputServices("Mistake!");
                }
            }
        }
Пример #2
0
        public void Run()
        {
            while (true)
            {
                string command = inputService.ReadCommand();

                try
                {
                    CommandTypes commandType = parsingService.ParseCommand(command);

                    Arguments args = inputService.ReadArguments();

                    outputService.WriteMessage(calculator.Execute(commandType, args).ToString());
                }
                catch
                {
                    outputService.WriteMessage("Mistake!");
                }
            }
        }
        public void Run()
        {
            while (true)
            {
                string command = inputService.ReadCommand();

                try
                {
                    CommandTypes commandType = commandInputParser.ParseCommand(command);

                    Arguments arguments = inputService.ReadArguments();

                    outputService.WriteResult(calculator.Calculate(commandType, arguments).ToString());
                }
                catch (Exception)
                {
                    Console.WriteLine("Mistake!");
                }
            }
        }