自适应卡下拉-BOT框架

Drop down on adaptive card - BOT framework

为了明智地显示城市假期列表,我正在创建一个自适应卡片。在自适应卡上,将有一个带有城市列表的下拉列表,根据选择,我需要显示所选城市的假期列表。 我无法找到如何从下拉列表中获取选定的值。我尝试了类似下面的方法,但它只给了我第一个值,我在渲染卡时在下拉菜单中选择了这个值-

var card = new AdaptiveCard();

try
{
    card = new AdaptiveCard(new AdaptiveSchemaVersion(1, 0))
    {
        Body =
        {
            new AdaptiveTextBlock("My Holiday List - " + userCity),
            new AdaptiveTextBlock("Please select city:"),

            new AdaptiveChoiceSetInput
            {
                Choices = list,
                Id = "CountryOrganizationCode",
                Style = AdaptiveChoiceInputStyle.Compact,
                Value = "Delhi",
                // IsMultiSelect = false,
            },
        },
    };

    card.Actions = new List<AdaptiveAction>
    {
        new AdaptiveShowCardAction
        {
            Title = "View Holiday List ",
            Type =  "Action.ShowCard",
            Card = new AdaptiveCard(new AdaptiveSchemaVersion(1, 0))
            {
                Body =
                {
                    new AdaptiveTextBlock()
                    {
                        Text = holidaylist.Where(i => i.Key == ((AdaptiveCards.AdaptiveChoiceSetInput)card.Body[2]).Value).FirstOrDefault().Value.ToString(),
                        Wrap = true,
                    },
                },
            },
        },
    };
}

来自我对other question的回答:

You can only extend Adaptive Card functionality if you're using Web Chat so you won't be able to respond to events from this dropdown and you won't be able to modify the card as the user is filling it out. You'll need to have the user select a city and then click the submit button. While Teams does allow message updates and so you could update the card in response to the submit action, it's probably better and easier just to send a whole new card with the holiday list.

这意味着您只能在网络聊天中做您想做的事,即使那样也很困难。由于您需要 Teams 的解决方法,因此您也可以将该解决方法用于网络聊天。

您将无法在 Skype 中使用自适应卡片,因为它不是 supported platforms for Adaptive Cards 之一。 Skype 机器人通常也已弃用,因此我的建议是放弃 Skype 作为频道,而只使用其他两个。