Пример #1
0
        private IList <IRequestParser> ReadCommands()
        {
            var commands = new List <IRequestParser>();

            var currentLine = inputOutputProvider.Read();

            while (!string.IsNullOrEmpty(currentLine))
            {
                IRequestParser currentCommand = this.dealershipFactory.CreateRequestParser(currentLine);
                commands.Add(currentCommand);
                currentLine = inputOutputProvider.Read();
            }

            return(commands);
        }
Пример #2
0
        public void Run()
        {
            createRandomDoors();
            string rules = phraseProvider.GetPhrase("Rules");

            rules = rules.Replace("@ExitCode", _settings.ExitString);
            rules = rules.Replace("@ExitDoor", _settings.ExitDoorNumber.ToString());
            inputOutputProvider.Write(rules);
            inputOutputProvider.Write(showCurrentLevel());
            string key        = "";
            int    pickedDoor = 0;

            while (!key.ToLower().Equals(_settings.ExitString))
            {
                key = inputOutputProvider.Read();
                bool isNumeric = int.TryParse(key, out pickedDoor);
                if (isNumeric)
                {
                    inputOutputProvider.Write(pickDoor(pickedDoor));
                }
                else if (!key.ToLower().Equals(_settings.ExitString))
                {
                    inputOutputProvider.Write(phraseProvider.GetPhrase("IncorrectInput"));
                }
            }
        }
Пример #3
0
        public void Run()
        {
            string key             = "";
            string exitCode        = settings.ExitString.ToLower();
            Draw   drawOnDashboard = board.DrawBoard;

            while (key.ToLower() != exitCode)
            {
                board.Clear();
                drawOnDashboard.Invoke(board);
                key = inputOutputProvider.Read();
                switch (key)
                {
                case "1":
                    drawOnDashboard += figureProvider.DrawDot;
                    break;

                case "2":
                    drawOnDashboard += figureProvider.DrawHorizontalLine;
                    break;

                case "3":
                    drawOnDashboard += figureProvider.DrawVerticalLine;
                    break;

                case "4":
                    drawOnDashboard += figureProvider.DrawSinus;
                    break;

                case "5":
                    drawOnDashboard = board.DrawBoard;
                    break;
                }
            }
        }