Exemple #1
0
        private static async Task <DialogTurnResult> WaterfallStep3(DialogContext dc, WaterfallStepContext stepContext, CancellationToken cancellationToken)
        {
            var value = (int)stepContext.Result;
            await dc.Context.SendActivityAsync(MessageFactory.Text($"Bot received the number '{value}'."), cancellationToken);

            return(await dc.EndAsync(cancellationToken));
        }
Exemple #2
0
        private static async Task <DialogTurnResult> WaterfallStep3(DialogContext dc, WaterfallStepContext stepContext)
        {
            var value = (int)stepContext.Result;
            await dc.Context.SendActivityAsync($"Bot received the number '{value}'.");

            return(await dc.EndAsync());
        }
Exemple #3
0
        private static async Task <DialogTurnResult> WaterfallStep1(DialogContext dc, WaterfallStepContext stepContext)
        {
            // we are only interested in Message activities - any other type of activity we will immediately complete teh waterfall
            if (dc.Context.Activity.Type != ActivityTypes.Message)
            {
                return(await dc.EndAsync());
            }

            // this prompt will not continue until we receive a number
            return(await dc.PromptAsync("number", new PromptOptions { Prompt = MessageFactory.Text("Enter a number.") }));
        }
Exemple #4
0
        public override async Task <DialogTurnResult> DialogBeginAsync(DialogContext dialogContext, Object options = null, CancellationToken cancellationToken = default(CancellationToken))
        {
            // Get the conversation state from the turn context
            if (dialogContext.Context.Activity?.Type == ActivityTypes.Message)
            {
                IMessageActivity activity = dialogContext.Context.Activity.AsMessageActivity();
                var state = await this.StateProperty.GetAsync(dialogContext.Context, () => new RivescriptState());

                this.rsEngine.setUservars(activity.From.Id, state);

                var reply = this.rsEngine.reply(activity.From.Id, activity.Text);

                // send reply if matched
                if (reply != NO_MATCH)
                {
                    await dialogContext.Context.SendActivityAsync(reply);
                }
                return(await dialogContext.EndAsync(reply));
            }
            return(await dialogContext.EndAsync());
        }
        private static async Task <DialogTurnResult> Waterfall2_Step3(DialogContext dc, WaterfallStepContext stepContext, CancellationToken cancellationToken)
        {
            if (stepContext.Values != null)
            {
                var numberResult = (int)stepContext.Result;
                await dc.Context.SendActivityAsync($"Thanks for '{numberResult}'");
            }
            await dc.Context.SendActivityAsync("step3");

            return(await dc.EndAsync(new Dictionary <string, object> {
                { "Value", "All Done!" }
            }));
        }
        private static async Task Waterfall2_Step3(DialogContext dc, object args, SkipStepFunction next)
        {
            if (args != null)
            {
                var numberResult = (NumberResult <int>)args;
                await dc.Context.SendActivityAsync($"Thanks for '{numberResult.Value}'");
            }
            await dc.Context.SendActivityAsync("step3");

            await dc.EndAsync(new Dictionary <string, object> {
                { "Value", "All Done!" }
            });
        }
        private static async Task <DialogTurnResult> Waterfall5_Step2(DialogContext dc, WaterfallStepContext stepContext, CancellationToken cancellationToken)
        {
            await dc.Context.SendActivityAsync(MessageFactory.Text("step2.2"), cancellationToken);

            return(await dc.EndAsync(cancellationToken));
        }
Exemple #8
0
        private static async Task <DialogTurnResult> Waterfall5_Step2(DialogContext dc, WaterfallStepContext stepContext)
        {
            await dc.Context.SendActivityAsync("step2.2");

            return(await dc.EndAsync());
        }
        private static async Task Waterfall5_Step2(DialogContext dc, object args, SkipStepFunction next)
        {
            await dc.Context.SendActivityAsync("step2.2");

            await dc.EndAsync();
        }