提交自适应卡的空引用

时间:2018-03-19 09:44:02

标签: c# .net botframework adaptive-cards

我正在研究.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);

这是返回一个空引用,我很确定它,因为我没有设置等待或回调提交。然而,不知道如何做到这一点,论坛拖网的日子并没有产生很多结果。

由于

0 个答案:

没有答案