/// <summary> /// Gets a multi digit response from the user. /// The attempts are set from 'prompt.attempts' property in ads.properties. /// </summary> /// <param name="promptMessage">The name of the file or the phrase string to speak out</param> /// <param name="customHandler">Prompt.ValidationHandler custom answer validator</param> /// <returns></returns> public string CustomValidationPrompt(string promptMessage, Prompt.ValidationHandler customHandler) { var prompt = GetRegularStylePrompt(); prompt.PromptMessage = promptMessage; prompt.OnValidation += customHandler; return(prompt.Ask()); }
/// <summary> /// Gets a multi digit response from the user. /// The attempts are set from 'prompt.attempts' property in ads.properties. /// </summary> /// <param name="promptMessage">The name of the file or the phrase string to speak out</param> /// <param name="validAnswers">A string array of valid answers.</param> /// <returns>A response matching on of the validAnswers[] string</returns> public string RegularPrompt(string promptMessage, string[] validAnswers) { Prompt.ValidationHandler customHandler = delegate(string answer) { if (validAnswers == null) { return(true); } return(validAnswers.Any(s => answer == s)); }; return(CustomValidationPrompt(promptMessage, customHandler)); }