无法从 Json 文件中获取自适应卡值

Can not get adaptive card value from Json file

我有以下 Json 文件

{
  "$schema": "http://adaptivecards.io/schemas/adaptive-card.json",
  "type": "AdaptiveCard",
  "version": "1.0",
  "body": [
    {
      "type": "TextBlock",
      "size": "Medium",
      "weight": "Bolder",
      "text": "Customer Information Form",
      "horizontalAlignment": "Center"
    },
    {
      "type": "Input.Text",
      "placeholder": "First Name",
      "style": "text",
      "maxLength": 0,
      "id": "SimpleVal",
      "color": "Red"
    },
    {
      "type": "Input.Text",
      "placeholder": "Last Name",
      "style": "Url",
      "maxLength": 0,
      "id": "UrlVal"
    },
    {
      "type": "Input.Text",
      "placeholder": "Company Name",
      "style": "text",
      "maxLength": 0,
      "id": "companyname",
      "color": "Red"
    },
    {
      "type": "Input.Text",
      "placeholder": "Email",
      "style": "Email",
      "maxLength": 0,
      "id": "EmailVal"
    },
    {
      "type": "Input.ChoiceSet",
      "placeholder": "Country",
      "id": "CompactSelectVal",
      "value": "1",
      "choices": [
        {
          "title": "Country",
          "value": "1"
        },
        {
          "title": "United States",
          "value": "2"
        },
        {
          "title": "Algeria",
          "value": "3"
        }
      ]
    },
    {
      "type": "Input.Text",
      "placeholder": "Phone Number",
      "style": "Tel",
      "maxLength": 0,
      "id": "TelVal"
    }




  ],
  "actions": [
    {
      "type": "Action.Submit",
      "title": "Submit",
      "data": {
        "id": "1234567890"
      }
    }
  ]
}

这是我的机器人输入表单:

当我尝试从 turnContext 检索值时,我得到了空值。请看下面的代码:

protected override async Task OnMessageActivityAsync(ITurnContext<IMessageActivity> turnContext, CancellationToken cancellationToken)
    {
        Random r = new Random();
        var cardAttachment = CreateAdaptiveCardAttachment(_cards[r.Next(_cards.Length)]);

        await turnContext.SendActivityAsync(MessageFactory.Attachment(cardAttachment), cancellationToken);
        await turnContext.SendActivityAsync(MessageFactory.Text("Your Request has submitted. Thank you"), cancellationToken);
    } 

我想我应该从 turnContext activity 中获取价值。但是它看起来是空的。

尝试使用以下代码从自适应卡片中获取价值:

//Captature sumitted value
var txt = turnContext.Activity.Text;
dynamic val = turnContext.Activity.Value;

希望对您有所帮助!