2017-07-24 86 views
0

我似乎无法找到任何文档或论坛的答案,使HeroCard点击图像。我希望能够点击图像并按照我使用按钮的方式执行相同的imBack()操作。可点击HeroCard图像

回答

0

这不可能与HeroCard。您可能想要探索允许这样做的AdaptiveCards

+0

这是不幸的。但是AdaptiveCards不能执行'imBack()'操作吗? – Justin

+0

你想实现什么?点击图片后在聊天中发布消息? –

+0

这将是理想的。但是,如果这是不可能的,单击图像后执行任何操作将起作用。 – Justin

0

您可以使用HeroCardTap属性使英雄卡的图像转到该链接。

张贴在C#中的一些示例代码:

using System; 
using System.Threading.Tasks; 
using Microsoft.Bot.Builder.Dialogs; 
using Microsoft.Bot.Connector; 
using System.Collections.Generic; 

namespace Bot_Application2.Dialogs 
{ 
    [Serializable] 
    public class RootDialog : IDialog<object> 
    { 
     public async Task StartAsync(IDialogContext context) 
     { 
      context.Wait(ConversationStartedAsync); 
     } 

     public async Task ConversationStartedAsync(IDialogContext context, IAwaitable<IMessageActivity> argument) 
     { 
      IMessageActivity reply = context.MakeMessage(); 

      HeroCard heroCard = new HeroCard() 
      { 
       Title = "I'm a hero card", 
       Images = new List<CardImage> 
       { 
       new CardImage(url: $"https://www.google.org/assets/static/images/logo_googledotorg-171e7482e5523603fc0eed236dd772d8.svg") 
       }, 
       Tap = new CardAction() 
       { 
        Value = $"https://www.google.co.in/", 
        Type = "openUrl", 
       } 
      }; 

      reply.Attachments = new List<Attachment> 
       { 
        heroCard.ToAttachment() 
       }; 

      await context.PostAsync(reply); 
     } 
    } 
} 

enter image description here