forked from microsoft/BotBuilder-Samples
-
Notifications
You must be signed in to change notification settings - Fork 1
/
CreateNewConversationDialog.cs
33 lines (27 loc) · 1.02 KB
/
CreateNewConversationDialog.cs
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
31
32
33
namespace CreateNewConversationBot
{
using System;
using System.Threading.Tasks;
using Microsoft.Bot.Builder.Dialogs;
using Microsoft.Bot.Builder.Internals.Fibers;
using Microsoft.Bot.Connector;
[Serializable]
public class CreateNewConversationDialog : IDialog<object>
{
private readonly ISurveyService surveyService;
public CreateNewConversationDialog(ISurveyService surveyService)
{
SetField.NotNull(out this.surveyService, nameof(surveyService), surveyService);
}
public async Task StartAsync(IDialogContext context)
{
context.Wait(this.MessageReceivedAsync);
}
public virtual async Task MessageReceivedAsync(IDialogContext context, IAwaitable<IMessageActivity> result)
{
await context.PostAsync("You've been invited to a survey! It will start in a few seconds...");
await this.surveyService.QueueSurveyAsync();
context.Wait(this.MessageReceivedAsync);
}
}
}