コード例 #1
0
        protected TrueFalsePrompt GetPromptResult(TrueFalsePrompt prompt)
        {
            _console.Write(" - (y/n)");
            _console.WriteLine();
            _console.Write(">>");

            bool?result = null;

            while (result == null)
            {
                var keypressed = _console.ReadKey();
                switch (keypressed.Key)
                {
                case ConsoleKey.Y:
                    result = true;
                    break;

                case ConsoleKey.N:
                    result = false;
                    break;
                }
            }

            prompt.Result = result;
            return(prompt);
        }
コード例 #2
0
        protected Prompt GetTrueFalsePromptResult(TrueFalsePrompt prompt)
        {
            Debug.Assert(prompt != null);
            var result = Sharprompt.Prompt.Confirm(prompt.Text, prompt.DefaultValue);

            prompt.Result = result;
            return(prompt);
        }