Esempio n. 1
0
        private async Task AirportRange(IDialogContext context, Location storloc)
        {
            string imageurl = await BingQuery.GetImageURL(storloc);

            HeroCard addcard = await CardController.AddressCard(storloc, imageurl);

            Attachment adattach = addcard.ToAttachment();
            var        cmessage = context.MakeMessage();

            cmessage.Attachments.Add(adattach);
            await context.PostAsync(cmessage);

            List <airport> fports = await AirportFind.GetAirportsRange(storloc.Point.GetCoordinate().Latitude, storloc.Point.GetCoordinate().Longitude, 100);

            if (fports.Count > 0)
            {
                await context.PostAsync($"I found {fports.Count} airports: ");

                await CardController.AirportCards(fports, context, storloc);
            }
            else
            {
                List <airport> fportsext = await AirportFind.GetAirportsRange(storloc.Point.GetCoordinate().Latitude, storloc.Point.GetCoordinate().Longitude, 200);

                if (fportsext.Count > 0)
                {
                    await context.PostAsync($"I found {fportsext.Count} airports: ");

                    await CardController.AirportCards(fportsext, context, storloc);
                }
                else
                {
                    await context.PostAsync("Sorry I couldn't find an airport within 200 miles");
                }
            }
        }