コード例 #1
0
        private async Task <DialogTurnResult> GetUsersCountryStepAsync(WaterfallStepContext stepContext, CancellationToken cancellationToken)
        {
            if (stepContext.Context.Activity.Text != null)
            {
                stepContext.Context.Activity.Text = null;
                return(await stepContext.NextAsync(cancellationToken));
            }

            await stepContext.Context.SendActivityAsync(
                MessageFactory.Text("Please select a valid country from the list and hit the 'Submit' button"),
                cancellationToken);

            var cardAttachment = CountryCard.Create();
            var reply          = stepContext.Context.Activity.CreateReply();

            reply.Attachments = new List <Attachment> {
                cardAttachment
            };
            await stepContext.Context.SendActivityAsync(reply, cancellationToken);

            return(await stepContext.PromptAsync(Constants.CountryPrompt,
                                                 new PromptOptions
            {
                Prompt = new Activity
                {
                    Text = string.Empty,
                    Type = ActivityTypes.Message,
                }
            },
                                                 cancellationToken));
        }
コード例 #2
0
        //first Step
        private async Task <DialogTurnResult> GetUsersCountryStepAsync(WaterfallStepContext stepContext, CancellationToken cancellationToken)
        {
            var cardAttachment = CountryCard.Create();
            var reply          = stepContext.Context.Activity.CreateReply();

            reply.Attachments = new List <Attachment> {
                cardAttachment
            };
            await stepContext.Context.SendActivityAsync(reply, cancellationToken);

            return(await stepContext.PromptAsync("country",
                                                 new PromptOptions
            {
                Prompt = new Activity
                {
                    Text = string.Empty,
                    Type = ActivityTypes.Message,
                }
            },
                                                 cancellationToken));
        }