Example #1
0
 /// <summary>
 /// Constructor
 /// </summary>
 /// <param name="columns">
 /// Array of columns
 /// Max: 10
 /// </param>
 /// <param name="imageAspectRatio">
 /// Aspect ratio of the image. Specify one of the following values:
 /// rectangle: 1.51:1
 /// square: 1:1
 /// The default value is rectangle.
 /// </param>
 /// <param name="imageSize">
 /// Size of the image. Specify one of the following values:
 /// cover: The image fills the entire image area.Parts of the image that do not fit in the area are not displayed.
 /// contain: The entire image is displayed in the image area.A background is displayed in the unused areas to the left and right of vertical images and in the areas above and below horizontal images.
 /// The default value is cover.
 /// </param>
 public CarouselTemplate(IList <CarouselColumn> columns        = null,
                         ImageAspectRatioType imageAspectRatio = ImageAspectRatioType.Rectangle, ImageSizeType imageSize = ImageSizeType.Cover)
 {
     Columns          = columns ?? new List <CarouselColumn>();
     ImageAspectRatio = imageAspectRatio;
     ImageSize        = imageSize;
 }
Example #2
0
 public ButtonsTemplate(string text, string thumbnailImageUrl = null, string title = null, IList <ITemplateAction> actions = null,
                        ImageAspectRatioType imageAspectRatio = ImageAspectRatioType.Rectangle, ImageSizeType imageSize = ImageSizeType.Cover, string imageBackgroundColor = "#FFFFFF")
 {
     ThumbnailImageUrl = thumbnailImageUrl;
     Title             = title.Substring(0, Math.Min(title.Length, 40));
     Text                 = (string.IsNullOrEmpty(thumbnailImageUrl) || string.IsNullOrEmpty(title)) ? text.Substring(0, Math.Min(text.Length, 160)) : text.Substring(0, Math.Min(text.Length, 60));
     Actions              = actions ?? new List <ITemplateAction>();
     ImageAspectRatio     = imageAspectRatio;
     ImageSize            = imageSize;
     ImageBackgroundColor = imageBackgroundColor;
 }
 /// <summary>
 /// Constructor
 /// </summary>
 /// <param name="text">
 /// Message text
 /// Max: 160 characters(no image or title)
 /// Max: 60 characters(message with an image or title)
 /// </param>
 /// <param name="thumbnailImageUrl">
 /// Image URL (Max: 1000 characters)
 /// HTTPS
 /// JPEG or PNG
 /// Aspect ratio: 1:1.51
 /// Max width: 1024px
 /// Max: 1 MB
 /// </param>
 /// <param name="title">
 /// Title
 /// Max: 40 characters
 /// </param>
 /// <param name="actions">
 /// Action when tapped
 /// Max: 4
 /// </param>
 /// <param name="imageAspectRatio">
 /// Aspect ratio of the image. Specify one of the following values:
 /// rectangle: 1.51:1
 /// square: 1:1
 /// The default value is rectangle.
 /// </param>
 /// <param name="imageSize">
 /// Size of the image. Specify one of the following values:
 /// cover: The image fills the entire image area.Parts of the image that do not fit in the area are not displayed.
 /// contain: The entire image is displayed in the image area.A background is displayed in the unused areas to the left and right of vertical images and in the areas above and below horizontal images.
 /// The default value is cover.
 /// </param>
 /// <param name="imageBackgroundColor">
 /// Background color of image. Specify a RGB color value. The default value is #FFFFFF (white).
 /// </param>
 /// <param name="defaultAction">
 /// Action when image is tapped; set for the entire image, title, and text area
 /// </param>
 public ButtonsTemplate(string text, string thumbnailImageUrl = null, string title = null, IList <ITemplateAction> actions = null,
                        ImageAspectRatioType imageAspectRatio = ImageAspectRatioType.Rectangle, ImageSizeType imageSize = ImageSizeType.Cover, ColorCode imageBackgroundColor = null,
                        ITemplateAction defaultAction         = null)
 {
     ThumbnailImageUrl = thumbnailImageUrl;
     Title             = title?.Substring(0, Math.Min(title.Length, 40));
     Text = (string.IsNullOrEmpty(thumbnailImageUrl) && string.IsNullOrEmpty(title))
         ? text.Substring(0, Math.Min(text.Length, 160)) : text.Substring(0, Math.Min(text.Length, 60));
     Actions              = actions ?? new List <ITemplateAction>();
     ImageAspectRatio     = imageAspectRatio;
     ImageSize            = imageSize;
     ImageBackgroundColor = imageBackgroundColor ?? ColorCode.White;
     DefaultAction        = defaultAction;
 }
Example #4
0
 public GenericTemplateAttachment(List <GenericElement> elements, ImageAspectRatioType imageAspectRatioType = ImageAspectRatioType.Horizontal)
     : this()
 {
     this.Payload = new GenericTemplatePayload(elements, imageAspectRatioType);
 }
 public GenericTemplatePayload(List <GenericElement> elements, ImageAspectRatioType imageAspectRatioType = ImageAspectRatioType.Horizontal)
     : this()
 {
     this.ImageAspectRatio = imageAspectRatioType.ToString().ToLower();
     this.Elements         = elements;
 }