示例#1
0
        protected Prompt GetFreeTextPromptResult(FreeTextPrompt prompt)
        {
            Debug.Assert(prompt != null);

            var result = Sharprompt.Prompt.Input <string>(prompt.Text);

            prompt.Result = result;
            return(prompt);
        }
        protected FreeTextPrompt GetPromptResult(FreeTextPrompt prompt)
        {
            _console.Write(" - (press enter after response)");
            _console.WriteLine();
            _console.Write(">>");
            var origPosn = _console.GetCursorPosition();

            while (true)
            {
                prompt.Result = _console.ReadLine();
                if (!string.IsNullOrWhiteSpace((string)prompt.Result))
                {
                    prompt.Result = ((string)prompt.Result).Trim();
                    break;
                }
                else
                {
                    _console.SetCursorPosition(origPosn);
                }
            }
            _console.SetCursorPosition(origPosn);
            return(prompt);
        }