Register
Login
Resources
Docs Blog Datasets Glossary Case Studies Tutorials & Webinars
Product
Data Engine LLMs Platform Enterprise
Pricing Explore
Connect to our Discord channel

SurveyDialog.cs 1.2 KB

You have to be logged in to leave a comment. Sign In
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
  1. using System;
  2. using System.Threading.Tasks;
  3. using Microsoft.Bot.Builder.Dialogs;
  4. namespace startNewDialogWithPrompt
  5. {
  6. [Serializable]
  7. public class SurveyDialog : IDialog<object>
  8. {
  9. public async Task StartAsync(IDialogContext context)
  10. {
  11. PromptDialog.Choice(context, this.AfterSelectOption, new string[] { "Stay in this survey", "Get back to where I was" }, "Hello, you're in the survey dialog. Please pick one of these options");
  12. }
  13. private async Task AfterSelectOption(IDialogContext context, IAwaitable<string> result)
  14. {
  15. if ((await result) == "Get back to where I was")
  16. {
  17. await context.PostAsync("Great, back to the original conversation!");
  18. context.Done(String.Empty); //Finish this dialog
  19. }
  20. else
  21. {
  22. await context.PostAsync("I'm still on the survey until you tell me to stop");
  23. PromptDialog.Choice(context, this.AfterSelectOption, new string[] { "Stay in this survey", "Get back to where I was" }, "Hello, you're in the survey dialog. Please pick one of these options");
  24. }
  25. }
  26. }
  27. }
Tip!

Press p or to see the previous file or, n or to see the next file

Comments

Loading...