Exemplo n.º 1
0
        protected Widget_PromptBase(string Prompt_Message, string Initial_Value = null, PromptInputValidatorDelegate input_validator = null, PromptResultValidatorDelegate result_validator = null, bool Conceal_Input = false) : base(ConsoleWidgetType.Input)
        {
            Set_Message(Prompt_Message);
            Set_Input(Initial_Value ?? string.Empty);
            MaskUserInput = Conceal_Input;

            InputValidator  = input_validator;
            ResultValidator = result_validator;
            UserInputSignal = new ManualResetEventSlim();

            /*taskCancel = new CancellationTokenSource();
             * promptTask = Task.Run(Run_Prompt_Async, taskCancel.Token);*/
        }
Exemplo n.º 2
0
 public Widget_Prompt(string Prompt_Message, string Initial_Value = null, PromptInputValidatorDelegate input_validator = null, PromptResultValidatorDelegate result_validator = null, bool Conceal_Input = false) : base(Prompt_Message, Initial_Value, input_validator, result_validator, Conceal_Input)
 {
 }
Exemplo n.º 3
0
 /// <summary>
 /// Displays a prompt message in the console and then passes any user input to the specified callback handler, repeating the input process whenever the handler returns <c>False</c>
 /// </summary>
 /// <param name="Message">Message to display to the user</param>
 /// <param name="ValidatorCallback">Handler for user input called for each character/key the user inputs, the functions argument contains the full string of user input up to that point, return <c>False</c> to reject a given character.</param>
 /// <param name="concealInput">If <c>TRUE</c> characters the user inputs will show as '*' in the console and logs</param>
 /// <param name="InitialValue">Value to use for the users initial input</param>
 /// <returns>User input string</returns>
 public async Task <string> Prompt(string message, PromptInputValidatorDelegate ValidatorCallback, bool concealInput = false, string InitialValue = null)
 {
     return(await Logger.Prompt(Name, message, ValidatorCallback, concealInput, InitialValue).ConfigureAwait(false));
 }