我正在尝试替换具有多个CardAction按钮的HeroCard。 我想使用自适应卡,但是,我没有看到任何文档说明如何从自适应卡按钮启用回发。 我看到打开的浏览器,什么没有,但没有回帖。
这是否受支持?
var cardButtons = new List<CardAction>();
var yesAction = new CardAction()
{
Value = "Yes",
Type = "postBack",
Title = "Yes"
};
cardButtons.Add(yesAction);
var noAction = new CardAction()
{
Value = "Nope",
Type = "postBack",
Title = "No, I'll try it"
};
cardButtons.Add(noAction);
var plCard = new HeroCard()
{
Title = $"Are you sure?",
Buttons = cardButtons
};
你试过SubmitAction
吗?
var noAction = new CardAction()
{
Value = "Nope",
Type = SubmitAction.TYPE,
Title = "No, I'll try it"
};
此代码正确呈现,甚至似乎将信息发送回机器人。但仍然无法弄清楚如何在恢复函数上读回数据:
var card = new AdaptiveCard();
card.Body.Add(
new ColumnSet() {
Columns = new List<Column>() {
new Column() {
SelectAction = new SubmitAction() { Data = 3, Title = "Good" },
Items = new List<CardElement>() { new Image() { Url = GeneralStrings.Feedback03 } }
},
new Column() {
SelectAction = new SubmitAction() { Data = 2, Title = "Average" },
Items = new List<CardElement>() { new Image() { Url = GeneralStrings.Feedback02 } }
},
new Column() {
SelectAction = new SubmitAction() { Data = 1, Title = "Bad" },
Items = new List<CardElement>() { new Image() { Url = GeneralStrings.Feedback01 } }
}
}
});
var attachemnt = new Attachment() { ContentType = AdaptiveCard.ContentType, Content = card };
var message = context.MakeMessage();
message.Attachments.Add(attachemnt);
await context.PostAsync(message);
context.Wait<Activity>(this.AfterAskFeedback);