CardEx.cs
1 using System;
2 using System.Collections.Generic;
3 using System.Linq;
4 using System.Text;
5 using System.Threading.Tasks;
6 
7 namespace Microsoft.Bot.Connector
8 {
9  public static partial class Extensions
10  {
16  public static Attachment ToAttachment(this HeroCard card)
17  {
18  return CreateAttachment(card, HeroCard.ContentType);
19  }
20 
26  public static Attachment ToAttachment(this ThumbnailCard card)
27  {
28  return CreateAttachment(card, ThumbnailCard.ContentType);
29  }
30 
36  public static Attachment ToAttachment(this SigninCard card)
37  {
38  return CreateAttachment(card, SigninCard.ContentType);
39  }
40 
46  public static Attachment ToAttachment(this ReceiptCard card)
47  {
48  return CreateAttachment(card, ReceiptCard.ContentType);
49  }
50 
56  public static Attachment ToAttachment(this AudioCard card)
57  {
58  return CreateAttachment(card, AudioCard.ContentType);
59  }
60 
61 
67  public static Attachment ToAttachment(this VideoCard card)
68  {
69  return CreateAttachment(card, VideoCard.ContentType);
70  }
71 
77  public static Attachment ToAttachment(this AnimationCard card)
78  {
79  return CreateAttachment(card, AnimationCard.ContentType);
80  }
81 
82  private static Attachment CreateAttachment<T>(T card, string contentType)
83  {
84  return new Attachment
85  {
86  Content = card,
87  ContentType = contentType
88  };
89  }
90  }
91 }
static Attachment ToAttachment(this AudioCard card)
Creates a new attachment from AudioCard.
Definition: CardEx.cs:56
static Attachment ToAttachment(this ThumbnailCard card)
Creates a new attachment from ThumbnailCard.
Definition: CardEx.cs:26
A card representing a request to sign in
static Attachment ToAttachment(this AnimationCard card)
Creates a new attachment from AnimationCard.
Definition: CardEx.cs:77
static Attachment ToAttachment(this SigninCard card)
Creates a new attachment from SigninCard.
Definition: CardEx.cs:36
static Attachment ToAttachment(this VideoCard card)
Creates a new attachment from VideoCard.
Definition: CardEx.cs:67
static Attachment ToAttachment(this HeroCard card)
Creates a new attachment from HeroCard.
Definition: CardEx.cs:16
An animation card (Ex: gif or short video clip)
An attachment within an activity
Definition: Attachment.cs:17
static Attachment ToAttachment(this ReceiptCard card)
Creates a new attachment from ReceiptCard.
Definition: CardEx.cs:46
A Hero card (card with a single, large image)
A thumbnail card (card with a single, small thumbnail image)