Guest User

Untitled

a guest
Dec 7th, 2017
84
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.24 KB | None | 0 0
  1. return Task.CompletedTask;
  2. }
  3. public virtual async Task MessageReceivedAsync(IDialogContext context, IAwaitable<IMessageActivity> result)
  4. {
  5. var reply = context.MakeMessage();
  6.  
  7. reply.AttachmentLayout = AttachmentLayoutTypes.Carousel;
  8. reply.Attachments = GetCardsAttachments();
  9.  
  10. await context.PostAsync(reply);
  11.  
  12. context.Wait(this.MessageReceivedAsync);
  13. }
  14.  
  15. private static IList<Attachment> GetCardsAttachments()
  16. {
  17. return new List<Attachment>()
  18. {
  19. GetHeroCard(
  20. "Add a webpage",
  21. "",
  22. "",
  23. new CardImage(url: "https://cdn.dribbble.com/users/22691/screenshots/1958250/attachments/340010/Button_800x600.gif?sz=328"),
  24. new CardAction(ActionTypes.ImBack, "Add a webpage", value: "Add a webpage")),
  25. GetHeroCard(
  26. "delete a webpage",
  27. "",
  28. "",
  29. new CardImage(url: "https://cdn.dribbble.com/users/22691/screenshots/1958250/attachments/340010/Button_800x600.gif?sz=328"),
  30. new CardAction(ActionTypes.ImBack, "delete a webpage", value: "delete a webpage")),
  31. GetHeroCard(
  32. "Display help",
  33. "",
  34. "",
  35. new CardImage(url: "https://cdn.dribbble.com/users/22691/screenshots/1958250/attachments/340010/Button_800x600.gif?sz=328"),
  36. new CardAction(ActionTypes.ImBack, "Display help", value: "Display help")),
  37. GetHeroCard(
  38. "etc",
  39. "",
  40. "",
  41. new CardImage(url: "https://cdn.dribbble.com/users/22691/screenshots/1958250/attachments/340010/Button_800x600.gif?sz=328"),
  42. new CardAction(ActionTypes.ImBack, "etc", value: "etc")),
  43.  
  44. };
  45. }
  46.  
  47. private static Attachment GetHeroCard(string title, string subtitle, string text, CardImage cardImage, CardAction cardAction)
  48. {
  49. var heroCard = new HeroCard
  50. {
  51. Title = title,
  52. Subtitle = subtitle,
  53. Text = text,
  54. Images = new List<CardImage>() { cardImage },
  55. Buttons = new List<CardAction>() { cardAction },
  56. };
  57.  
  58. return heroCard.ToAttachment();
  59. }
Add Comment
Please, Sign In to add comment