private async Task AfterPhoneEnteredPromptForEmail(IDialogContext context, IAwaitable <string> result) { try { var phone = await result; if (phone != null) { _customerInfo.PhoneNumber = phone; await context.PostAsync($"The phone you provided is: {phone}"); var promptEmailDialog = new PromptStringRegex( "Please enter your email address (you can use this to reference your support case later):", EmailRegexPattern, "The value entered is not a valid email email address. Please try again using the following format [email protected]", "You have tried to enter your email too many times. Please try again later.", attempts: 2); context.Call(promptEmailDialog, this.AfterEmailEnteredPromptForPurchaseDate); } else { context.Done(false); } } catch (TooManyAttemptsException) { context.Done(false); } }
public async Task StartAsync(IDialogContext context) { var promptPhoneDialog = new PromptStringRegex( "Please enter your phone number:", PhoneRegexPattern, "The value entered is not phone number. Please try again using the following format (xyz) xyz-wxyz:", "You have tried to enter your phone number many times. Please try again later.", attempts: 2); context.Call(promptPhoneDialog, this.ResumeAfterPhoneEntered); }
private void PromptString(IDialogContext context, string ask, string currentValue, string regexPattern, ResumeAfter <string> resume) { string prompt = string.Format(CultureInfo.CurrentCulture, Resources.SettingsDialog_PrompString, ask); if (!string.IsNullOrEmpty(currentValue)) { prompt = string.Format(CultureInfo.CurrentCulture, Resources.SettingsDialog_PrompString_CurrentValue, ask, currentValue); } string retry = string.Format(CultureInfo.CurrentCulture, Resources.SettingsDialog_PrompString_Retry, ask); var promptString = new PromptStringRegex(prompt, regexPattern, retry); context.Call(promptString, resume); }