コード例 #1
0
        public Field GetUserInput()
        {
            facade.WriteLine(Texts.Intro);
            facade.WriteLine();
            facade.WriteLine(Texts.StartFromSaved);
            var answ = facade.ReadLine().ToLower();

            if (validation.ValidateQuestion(answ))
            {
                field = fileWorker.Load();
                return(field);
            }
            else if (!validation.ValidateQuestion(answ))
            {
                facade.WriteLine(Texts.Param);
                facade.WriteLine(Texts.Height);
                inputHeight = facade.ReadLine();
                facade.WriteLine(Texts.Width);
                inputWidth = facade.ReadLine();

                var validH = validation.ValidateInt(inputHeight);
                var validW = validation.ValidateInt(inputWidth);

                if (validH && validW)
                {
                    field = CreateInputField(inputHeight, inputWidth);
                    return(field);
                }
                else
                {
                    facade.WriteLine(Texts.Error);
                    GetUserInput();
                    return(field);
                }
            }
            return(field);
        }