private async Task MessageReceivedAsync(IDialogContext context, IAwaitable <object> result)
        {
            var activity = await result as Activity;

            if (activity.Text == "pizza")
            {
                var formDialog = new Microsoft.Bot.Builder.FormFlow.FormDialog <Models.Pizza>(new Models.Pizza());

                await context.PostAsync($"Please tell me how you would like your pizza.");

                await context.Forward(formDialog, PizzaFormComplete, activity);
            }
            else
            {
                await DefaultMessageReceivedAsync(context, result);
            }
        }
Exemplo n.º 2
0
        public async Task PizzaOrder(IDialogContext context, Microsoft.Bot.Builder.Luis.Models.LuisResult result)
        {
            var pizza = new Models.Pizza();

            Newtonsoft.Json.Linq.JArray dateTimeEntity = result.Entities?.FirstOrDefault(e => e.Type == "builtin.datetimeV2.datetime")?.Resolution.FirstOrDefault().Value as Newtonsoft.Json.Linq.JArray;
            if (dateTimeEntity != null)
            {
                DateTime dateTime = dateTimeEntity.First.Value <DateTime>("value");

                pizza.Time = dateTime.TimeOfDay.ToString(@"hh\:mm");
            }

            var formDialog = new Microsoft.Bot.Builder.FormFlow.FormDialog <Models.Pizza>(pizza);

            await context.PostAsync($"Please tell me how you would like your pizza.");

            await context.Forward(formDialog, PizzaFormComplete, context.MakeMessage());
        }