我正在开发一个 .Net Bot Framework 机器人。我有一个登录服务,但它目前对用户来说非常耗时且效率低下。因此,我试图将其转换为自适应卡。我的代码去;
else if (lowerMessage == "test card")
{
var replyMessage = context.MakeMessage();
AdaptiveCard card = new AdaptiveCard();
AdaptiveTextInput usernameInput = new AdaptiveTextInput()
{
Id = "Username"
};
AdaptiveTextInput passwordInput = new AdaptiveTextInput()
{
Id = "Password"
};
card.Body.Add(new AdaptiveContainer()
{
Items = new List<AdaptiveElement>()
{
new AdaptiveColumnSet()
{
Columns = new List<AdaptiveColumn> ()
{
new AdaptiveColumn()
{
Items = new List<AdaptiveElement>()
{
new AdaptiveTextBlock()
{
Text = "Username?"
},
usernameInput,
new AdaptiveTextBlock()
{
Text = "Password?"
},
passwordInput
}
}
}
}
}
});
card.Actions.Add(new AdaptiveSubmitAction()
{
Title = "Submit",
Data = usernameInput.Value + "/" + passwordInput.Value
});
Attachment adAttachment = new Attachment()
{
ContentType = AdaptiveCard.ContentType,
Content = card
};
replyMessage.Attachments = new List<Attachment>()
{
adAttachment
};
//context.Wait(MessageReceivedAsync);
await context.PostAsync(replyMessage);
这将返回一个空引用,我很确定这是因为我没有设置等待或提交的回调。然而,不知道如何做到这一点,而且论坛拖网的日子还没有产生很多结果。
谢谢