public async Task WhoIs(IDialogContext context, LuisResult result) { EntityRecommendation hardwareEntityPerson; string person = ""; if (result.TryFindEntity(EntityPerson, out hardwareEntityPerson)) { person = hardwareEntityPerson.Entity; } Person maker = MakerDataService.GetPerson(person); var message = context.MakeMessage(); if (maker != null) { // Create a new Hero Card showing the person's Name, Title, Location, Photo and a Twitter profile button var heroCard = new HeroCard { Title = maker.Name, Subtitle = maker.Title, Text = $"Location: {maker.Location}", Images = new List <CardImage> { new CardImage(maker.ImageUrl) }, Buttons = new List <CardAction> { new CardAction(ActionTypes.OpenUrl, "Twitter profile", value: maker.TwitterUrl) } }; var attachment = heroCard.ToAttachment(); message.Attachments.Add(attachment); // Set the text to be spoken out loud since we don;t want to just read the Hero Card data message.Speak = $"{maker.Name} is a {maker.Title} based in {maker.Location}."; } else { message.Text = $"I'm sorry. I don't have any information about {person}"; } message.InputHint = InputHints.ExpectingInput; await context.PostAsync(message); context.Wait(this.MessageReceived); }
public async Task BuyHardware(IDialogContext context, LuisResult result) { EntityRecommendation hardwareEntityRecommendation; string hardware = ""; if (result.TryFindEntity(EntityHardwareType, out hardwareEntityRecommendation)) { hardware = hardwareEntityRecommendation.Entity; } string phrase = MakerDataService.GetStore(hardware); var message = context.MakeMessage(); message.Text = phrase; message.Speak = BetterSpokenUrl(phrase); message.InputHint = InputHints.ExpectingInput; await context.PostAsync(message); context.Wait(this.MessageReceived); }