예제 #1
0
        public async Task PizzaOptions(IDialogContext context, IAwaitable <object> result)
        {
            var message = context.MakeMessage();

            //setting the layout of the attachments to carousel type
            message.AttachmentLayout = AttachmentLayoutTypes.Carousel;

            //getting the current menu
            JObject  data = Utilities.Utilities.LoadJSON("c:\\Users\\Sumit Das\\source\\repos\\Pizzo\\Pizzo\\Resources\\menu.json");
            MenuItem menu = Utilities.Utilities.MapToObject(data);

            //creating a list of message attachments which will be shown in carousel layout
            message.Attachments = AdaptiveCardDialog.CarouselFromArray(menu.veg);
            //posting the adaptive card carousel to the bot
            await context.PostAsync(message);

            //function call to handle button click to add a pizza
            context.Wait(AddPizza);
        }
예제 #2
0
        public async Task StartAsync(IDialogContext context)
        {
            context.PostAsync("Ready to add some toppings?");

            var           message = context.MakeMessage();
            List <AddOn>  userChoice;
            JObject       data = Utilities.Utilities.LoadJSON("C:\\Users\\Arzeena Khan\\source\\repos\\Pizzo\\Pizzo\\Resources\\addons.json");
            AddOnMenuItem menu = Utilities.Utilities.AddOnMapToObject(data);

            if (choice.ToLower() == "yes")
            {
                userChoice = menu.veg;

                message.Attachments = AdaptiveCardDialog.AddOnCarouselFromArray(userChoice);
            }
            //posting the adaptive card carousel to the bot
            await context.PostAsync(message);

            context.Done(this);
        }
예제 #3
0
        public async Task StartAsync(IDialogContext context)
        {
            var message = context.MakeMessage();

            //setting the layout of the attachments to carousel type
            message.AttachmentLayout = AttachmentLayoutTypes.Carousel;

            //getting the current menu
            JObject  data = Utilities.Utilities.LoadJSON("C:\\Users\\Arzeena Khan\\source\\repos\\Pizzo\\Pizzo\\Resources\\menu.json");
            MenuItem menu = Utilities.Utilities.MapToObject(data);

            //getting the users choice
            List <Pizza> userChoice = (choice.ToLower() == "veg") ? menu.veg : menu.nonveg;


            //creating a list of message attachments which will be shown in carousel layout
            message.Attachments = AdaptiveCardDialog.CarouselFromArray(userChoice);
            //posting the adaptive card carousel to the bot
            await context.PostAsync(message);

            //function call to handle button click to add a pizza
            context.Done(context.Activity);
        }