/// <summary> /// create image type card /// </summary> /// <param name="response"></param> /// <returns></returns> private Attachment GetImageCard(Response response) { try { var image = response.Image; Attachment attachment = new Attachment(); if (image.IsAnimated) { var imageCard = new AnimationCard(); if (!string.IsNullOrEmpty(image.Url)) { imageCard.Media = new List <MediaUrl> { new MediaUrl(image.Url) }; } attachment = imageCard.ToAttachment(); } else { var imageCard = new ThumbnailCard(); if (!string.IsNullOrEmpty(image.Url)) { imageCard.Images = new List <CardImage> { new CardImage(image.Url) }; } attachment = imageCard.ToAttachment(); } return(attachment); } catch (Exception ex) { return(null); } }
private static Attachment GetDrA30Infor() { var animationCard = new AnimationCard { Title = @"MiVue™ A30 采用索尼的影像传感器 真实1080P/30fps高画质 F1.8大光圈 7段可调EV值", Subtitle = "2017 MiVue™ 7系列行車記錄器", Image = new ThumbnailUrl { Url = "https://docs.microsoft.com/en-us/bot-framework/media/how-it-works/architecture-resize.png" }, Media = new List <MediaUrl> { new MediaUrl() { Url = "http://www.mio.com.cn/images/product_overview_MiVueA30_front_big_cn.gif" } }, Buttons = new List <CardAction> { new CardAction() { Title = "Learn More", Type = ActionTypes.OpenUrl, Value = "http://www.mio.com.cn/products-MiVue-A30-overview.htm" } } }; return(animationCard.ToAttachment()); }
// Create AdaptiveCard from AnimationCard public static AdaptiveCard CreateAnimationCard(AnimationCard card, string version = "1.0") { var adaptiveCard = new AdaptiveCard(); var body = new AdaptiveContainer() { Items = new List <AdaptiveElement>() }; // Add Image var images = AdaptiveElementBuilder.CreateImage(card.Media, AdaptiveImageSize.Large); if (images != null) { body.Items.Add(images); } // Add Title, SubTitle and Text body.Items.AddRange(AdaptiveElementBuilder.CreateTitle(card.Title, card.Subtitle, card.Text)); // Set Body and Actions adaptiveCard.Body = new List <AdaptiveElement>() { body }; adaptiveCard.Actions = AdaptiveElementBuilder.CreateActions(card.Buttons); adaptiveCard.Version = version; return(adaptiveCard); }
private static Attachment GetDr786Infor() { var animationCard = new AnimationCard { Title = @"#MiVue™ 786 WIFI实时 - 事件影片自动备份 采用索尼的低照度影像传感器 2.7电容式触控屏幕 内建GPS", Subtitle = "2017 MiVue™ 7系列行車記錄器", Image = new ThumbnailUrl { Url = "https://docs.microsoft.com/en-us/bot-framework/media/how-it-works/architecture-resize.png" }, Media = new List <MediaUrl> { new MediaUrl() { Url = "http://www.mio.com.cn/images/product_overview_MiVue786_front_big_cn.gif" } }, Buttons = new List <CardAction> { new CardAction() { Title = "Learn More", Type = ActionTypes.OpenUrl, Value = "http://www.mio.com.cn/products-MiVue-786-overview.htm" } } }; return(animationCard.ToAttachment()); }
public void AnimationCardToAttachmentTest() { var attachments = new List <Attachment>(); var animationCard = new AnimationCard { Title = "Animation Card Title", Subtitle = "Animation Card SubtTitle", Image = new ThumbnailUrl { Url = "https://docs.microsoft.com/en-us/bot-framework/media/how-it-works/architecture-resize.png", }, Media = new List <MediaUrl> { new MediaUrl() { Url = "http://i.giphy.com/Ki55RUbOV5njy.gif", }, }, }; attachments.Add(animationCard.ToAttachment()); Assert.NotEmpty(attachments); Assert.Equal("application/vnd.microsoft.card.animation", attachments[0].ContentType); }
public virtual async Task MessageReceivedAsync(IDialogContext context, IAwaitable <IMessageActivity> result) { var message = await result; var reply = context.MakeMessage(); reply.Attachments = new List <Attachment>(); switch (message.Text.ToLower()) { case "show me a hero card": reply.Text = $"Sample message with a HeroCard attachment"; var heroCardAttachment = new HeroCard { Title = "Sample Hero Card", Text = "Displayed in the DirectLine client" }.ToAttachment(); reply.Attachments.Add(heroCardAttachment); break; case "send me a botframework image": reply.Text = $"Sample message with an Image attachment"; var imageAttachment = new Attachment() { ContentType = "image/png", ContentUrl = "https://docs.microsoft.com/en-us/bot-framework/media/how-it-works/architecture-resize.png", }; reply.Attachments.Add(imageAttachment); break; case "send me a animated card": reply.Text = $"Sample message with Animation Card"; var animatecard = new AnimationCard { Title = "I am First Animation Cards", Text = "Try animation", Media = new List <MediaUrl> { new MediaUrl("http://bestanimations.com/Cartoons/WarnerBros/Taz/funny-taz-animated-gif-4.gif") } //Media = "http://bestanimations.com/Cartoons/WarnerBros/Taz/funny-taz-animated-gif-4.gif", }.ToAttachment(); reply.Attachments.Add(animatecard); break; default: reply.Text = $"You said '{message.Text}'"; break; } await context.PostAsync(reply); context.Wait(this.MessageReceivedAsync); }
public static Attachment GetAnimationCard(string title = null, string subtitle = null, string text = null, ThumbnailUrl animationUrl = null, List <MediaUrl> mediaUrl = null, bool autoLoop = false, bool autoStart = true) { var animationCard = new AnimationCard { Title = title, Subtitle = subtitle, Media = mediaUrl, Autoloop = autoLoop, Autostart = autoStart, }; return(animationCard.ToAttachment()); }
private async Task ProcessIntentAsync(ITurnContext turnContext, string intent, double score, CancellationToken cancellationToken = default(CancellationToken)) { var reply = turnContext.Activity.CreateReply(); reply.Attachments = new List <Attachment>(); AnimationCard animationCard = null; switch (intent) { case "Calendar_Add": animationCard = new AnimationCard { Title = $"Intent: {intent}", Subtitle = $"Score: {score}", Media = new List <MediaUrl> { new MediaUrl() { Url = "https://i.gifer.com/HwZb.gif", }, }, }; reply.Attachments.Add(animationCard.ToAttachment()); break; case "Calendar_Find": animationCard = new AnimationCard { Title = $"Intent: {intent}", Subtitle = $"Score: {score}", Media = new List <MediaUrl> { new MediaUrl() { Url = "https://i.gifer.com/7Knv.gif", }, }, }; reply.Attachments.Add(animationCard.ToAttachment()); break; } await turnContext.SendActivityAsync(reply, cancellationToken); }
private Attachment CreateAnimationCard() { var animationCard = new AnimationCard(); animationCard.Title = "um audio qualquer"; animationCard.Subtitle = "Aqui vai um subtitulo"; animationCard.Autostart = true; animationCard.Autoloop = false; animationCard.Media = new List <MediaUrl> { new MediaUrl("https://media.giphy.com/media/l4pTagD85eAAjkIhy/giphy.gif") }; return(animationCard.ToAttachment()); }
public static void AddAnimationCard(this IMessageActivity messageActivity, MediaUrl mediaUrl, string title = null) { var animationCard = new AnimationCard { Media = new List <MediaUrl> { mediaUrl } }; if (!string.IsNullOrWhiteSpace(title)) { animationCard.Title = title; } messageActivity.Attachments.Add(animationCard.ToAttachment()); }
private Attachment CreateAnimationCard() { var animationCard = new AnimationCard(); animationCard.Title = "Título qualquer"; animationCard.Subtitle = "Subtitulo"; animationCard.Autostart = true; animationCard.Autoloop = false; animationCard.Media = new List <MediaUrl> { new MediaUrl("https://media.giphy.com/media/Wnl8UpbANoaUU/giphy.gif") }; return(animationCard.ToAttachment()); }
private Attachment CreateAnimationCard() { var animationCard = new AnimationCard(); animationCard.Title = "Um gif"; animationCard.Subtitle = "gif 1"; animationCard.Autoloop = false; animationCard.Autostart = true; animationCard.Media = new List <MediaUrl> { new MediaUrl("https://media.giphy.com/media/gZEBpuOkPuydi/giphy.gif") }; return(animationCard.ToAttachment()); }
private Attachment CreateAnimationCard() { var animationCard = new AnimationCard(); animationCard.Title = "Um áudio revelador"; animationCard.Subtitle = "Aqui vai um subtitulo"; animationCard.Autostart = true; animationCard.Autoloop = false; animationCard.Media = new List <MediaUrl> { new MediaUrl("https://img.buzzfeed.com/buzzfeed-static/static/enhanced/webdr06/2013/5/31/10/anigif_enhanced-buzz-3734-1370010471-16.gif") }; return(animationCard.ToAttachment()); }
private Attachment CreateAnimation() { var animationcard = new AnimationCard(); animationcard.Title = "Teste audio"; animationcard.Subtitle = "Sub audio Teste"; animationcard.Autostart = true; animationcard.Autoloop = false; animationcard.Media = new List <MediaUrl> { new MediaUrl("https://media.giphy.com/media/AGOPaltgJ2pBC/giphy.gif") }; return(animationcard.ToAttachment()); }
private Attachment CreateAnimationCard() { var animationcard = new AnimationCard(); animationcard.Title = "Um gif revelador"; animationcard.Subtitle = "Outro titulo"; animationcard.Autostart = true; animationcard.Autoloop = false; animationcard.Media = new List <MediaUrl> { new MediaUrl("http://www.reactiongifs.com/r/hsk.gif") }; return(animationcard.ToAttachment()); }
private Attachment CreateAnimationCard() { var animationCard = new AnimationCard(); animationCard.Title = "Olha o GIF"; animationCard.Subtitle = "Subtitulo do GIPHY.baduntis"; animationCard.Autostart = true; animationCard.Autoloop = false; animationCard.Media = new List <MediaUrl> { new MediaUrl("http://78.media.tumblr.com/4163afe60a01a3a58332e45fc4efe060/tumblr_mw0i4maRMZ1r8bsyso1_250.gif") }; return(animationCard.ToAttachment()); }
private async Task ReplyWithGifAsync(IDialogContext context) { var gifCard = new AnimationCard("We all do love cats", "Subtitle about cats belongs here", "Write something about cats", new ThumbnailUrl("https://encrypted-tbn0.gstatic.com/images?q=tbn:ANd9GcTZqgfFQmgPpaogLWfDzWIgiVLAHPvGFi2VMrBhnrnWhtd4JCYAfg"), new List <MediaUrl>() { new MediaUrl("https://media.giphy.com/media/ziYUNUTpi4SiI/giphy.gif") }); var message = context.MakeMessage(); message.Attachments.Add(gifCard.ToAttachment()); await context.PostAsync(message); context.Wait(MessageReceivedAsync); }
private Attachment CreateAnimationCard() { var animationCard = new AnimationCard(); animationCard.Title = "Cat giphy"; animationCard.Subtitle = "A cute cat giphy"; animationCard.Autostart = true; animationCard.Autoloop = false; animationCard.Media = new List <MediaUrl> { new MediaUrl("https://media.giphy.com/media/2FayVoBQ0oxVel3aM/giphy.gif") }; return(animationCard.ToAttachment()); }
private Attachment CreateAnimationCard() { var animationCard = new AnimationCard(); animationCard.Title = "Uma animacao qualquer"; animationCard.Subtitle = "Subtítulo"; animationCard.Autostart = true; animationCard.Autoloop = false; animationCard.Media = new List <MediaUrl> { new MediaUrl("https://media1.tenor.com/images/efc9f6ce8923eadf351b676f29bf943c/tenor.gif") }; return(animationCard.ToAttachment()); }
//adaptivecards.io private Attachment CreateAnimationCard() { var animationCard = new AnimationCard(); animationCard.Title = "Gif bonitinho"; animationCard.Subtitle = "animation card"; animationCard.Autostart = true; animationCard.Autoloop = false; animationCard.Media = new List <MediaUrl> { new MediaUrl("http://www.gifs.blog.br/imagens/gifs-imagem-gif-animado-1.gif") }; return(animationCard.ToAttachment()); }
private Attachment CreateAnimationCard() { var audioCard = new AnimationCard() { Title = "Um gif fofo", Subtitle = "curtiu né?", Autostart = true, Autoloop = false, Media = new List <MediaUrl>() { new MediaUrl("https://img.buzzfeed.com/buzzfeed-static/static/enhanced/webdr06/2013/5/31/10/anigif_enhanced-buzz-3734-1370010471-16.gif") } }; return(audioCard.ToAttachment()); }
public static AnimationCard GetAnimationCard() { var changeToHLS = new AnimationCard { Title = "Change to HLS", Media = new List <MediaUrl> { new MediaUrl() { Url = "https://media.giphy.com/media/IhOfSZ95jrPHA2sVCC/giphy.gif", }, }, }; return(changeToHLS); }
//5 private static Attachment GetAnimationCard() { var heroCard = new AnimationCard() { Title = "Animation Card", Subtitle = "Может воспроизводить гифки или короткие видеоролики", Media = new List <MediaUrl> { new MediaUrl() { Url = "https://78.media.tumblr.com/584f14d9c738bcdf6fa50017a527d17c/tumblr_oob96eVhMi1vh1yxpo1_500.gif" } } }; return(heroCard.ToAttachment()); }
private Attachment CreateAnimationCard() { var animationCard = new AnimationCard(); animationCard.Title = "animationCard Pega Rex!"; animationCard.Subtitle = "gifizin"; animationCard.Autoloop = false; animationCard.Autostart = true; animationCard.Media = new List <MediaUrl> { new MediaUrl("https://img.buzzfeed.com/buzzfeed-static/static/2014-06/14/15/enhanced/webdr07/anigif_enhanced-30127-1402774426-6.gif") }; return(animationCard.ToAttachment()); }
private Attachment CreateAnimationCard() { var animationCard = new AnimationCard { Title = "Um gif fofo", Subtitle = "Aqui vai um subtítulo", Autostart = true, //comece automaticamente quando for renderizado Autoloop = false, Media = new List <MediaUrl> { new MediaUrl("https://img.buzzfeed.com/buzzfeed-static/static/enhanced/webdr06/2013/5/31/10/anigif_enhanced-buzz-3734-1370010471-16.gif") }, }; return(animationCard.ToAttachment()); }
private Attachment GetAnimationCard() { var animationCard = new AnimationCard { Title = "Animation", Subtitle = "Animation Development", Media = new List <MediaUrl> { new MediaUrl() { Url = "http://i.giphy.com/Ki55RUbOV5njy.gif" } } }; return(animationCard.ToAttachment()); }
private static Attachment GetAnimationCard() { var animationCard = new AnimationCard { Title = "Happy Flash", Subtitle = "Animation Card", Media = new List <MediaUrl> { new MediaUrl() { Url = "https://media.giphy.com/media/3NtY188QaxDdC/giphy.gif" } } }; return(animationCard.ToAttachment()); }
async Task HandleAnimationAsync(IDialogContext context) { string contentUrl = GetBinaryUrl("FlippingBot.gif"); var animationCard = new AnimationCard( "Chatbot Animation", "A Flipping Bot", "Demonstrates how to display a *.gif animation.", media: new List<MediaUrl> { new MediaUrl(contentUrl) }); Activity activity = context.Activity as Activity; Activity reply = activity.CreateReply(); reply.Attachments.Add(animationCard.ToAttachment()); await new ConnectorClient(new Uri(reply.ServiceUrl)) .Conversations .SendToConversationAsync(reply); context.Wait(MessageReceivedAsync); }
private Attachment GetAnimationCard() { var animation = new AnimationCard { Title = "Pelé", Subtitle = "Entortou o goleiro mas perdeu o gol :/", Image = new ThumbnailUrl("https://www.imortaisdofutebol.com/wp-content/uploads/2012/12/pele-1.jpg"), Autostart = true, Autoloop = true, Media = new List <MediaUrl> { new MediaUrl("https://i.makeagif.com/media/5-16-2016/c100k7.gif") } }; return(animation.ToAttachment()); }