Example #1
0
        public async static Task ShowClosestStores(IDialogContext context)
        {
            //simulate user position
            Random r = new Random();

            Double[] coords = new Double[] {
                r.NextDouble() * 180 - 90,
                     r.NextDouble() * 180 - 90
            };

            List <Store> stores = StoreController.getClosesStores(coords);

            var reply = context.MakeMessage();

            reply.AttachmentLayout = AttachmentLayoutTypes.Carousel;
            List <Attachment> attachments = new List <Attachment>();

            for (var i = 0; i < stores.Count() && i <= N_STORES_MAX; i++)
            {
                attachments.Add(StoreCard.GetStoreCard(stores[i]).ToAttachment());
            }

            reply.Attachments = attachments;

            await Interactions.SendMessage(context, Interactions.getClosesStore(), 0, 2000);

            await context.PostAsync(reply);
        }