c# - 自适应卡片中的轮播

标签 c# botframework chatbot

请指导我在 MS bot 框架中创建轮播自适应卡片。我正在使用 .Net sdk。我尝试使用自适应卡设计器进行设计,但无法做到。

最佳答案

你的问题不够具体,我无法理解你在哪里遇到了问题,但我可以给你一个创建卡片轮播的基本大纲。我的代码是 nodejs,但它应该足够相似,可以给你一个想法。

您将需要 CardFactory 和 MessageFactory 来首先生成卡片,然后是 Carousel(它将卡片数组作为输入)。

// First create an empty array for your carousel
var cardArray = [];

// Populate the array with your cards (can use any method, I used a for loop)
for (var idx = 0; idx < dataForCards.length; idx++) {
   // Create the adaptive card
   var adaptiveCard = CardFactory.adaptiveCard({

   // YOUR CARD DEFINITION HERE

   });
   // Push the card to the array for the carousel
   cardArray.push(adaptiveCard);
}
// Send the array as a carousel
await step.context.sendActivity(MessageFactory.carousel(cardArray));

关于c# - 自适应卡片中的轮播,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/59684839/

相关文章:

c# - 如何在 Microsoft Chatbot .Net Core 2.0 中使用自适应卡来实现 Luis Intent

c# - 路由 Microsoft LUIS 请求和机器人框架 - 最好在企业引用应用程序中

amazon-web-services - 将 AWS Lex 与 Skype 集成

c# - 解决方案之间的记录错误

c# - WP7——在我的计算机上查找isolatedStorage文件

c# - 检测字符串是否有小数

Android Espresso 等待文本出现

c# - 如何在 C# 中将值作为 url 传递

botframework - Skype 群组对话中的机器人

android - Facebook 聊天机器人 : Animated GIFs in Generic Templates