示例#1
0
 void ShowMainTopics(IDialogContext context)
 {
     // Display a dialog box with choices.
     FuzzyPromptDialog <string> .Choice(
         context : context,
         resume : OnMainTopicSelectedAsync,
         promptOptions : FuzzyPromptOptions <string> .Create(
             prompt: ResponseUtterances.GetResponse(ResponseUtterances.ReplyTypes.RootPrompt),
             attempts: 0,
             // The "too many attempts" string is always shown by the choice dialog.
             // See the "PostAsync() call in https://github.com/Microsoft/BotBuilder/blob/4621a4c611889a6ebade4717329f8e6ea62f2f7f/CSharp/Library/Microsoft.Bot.Builder/Dialogs/PromptDialog.cs#L1178
             // This means: using NULL will lead to the defautl string and using empty string will output an empty message. Instead of subclassing
             // the prompt dialog and trying to fix it, let's just use it instead of our own PostAsync() call. It wil always show up because the fuzzy
             // dialog has a retry count of 0.
             tooManyAttempts: ResponseUtterances.GetResponse(ResponseUtterances.ReplyTypes.PickOneOfTheseTopics),
             retry: string.Empty,
             options: MainMenuChoices.Keys.ToArray(),
             validOptions: MainMenuChoices.Keys.Union(AlternativeChoices.Keys).ToArray()));
 }
示例#2
0
        public static void Choice(IDialogContext context, ResumeAfter <T> resume, FuzzyPromptOptions <T> promptOptions)
        {
            var child = new FuzzyPromptDialog <T>(promptOptions);

            context.Call(child, resume);
        }
示例#3
0
 public FuzzyPromptDialog(FuzzyPromptOptions <T> promptOptions)
     : base(promptOptions)
 {
     this.PromptOptions = promptOptions;
 }