如何使用C#从英雄卡中检索用户响应

时间:2019-06-11 07:31:27

标签: c# botframework

需要获得通过C#单击的英雄卡的价值。

代码在下面

IMessageActivity newPost = context.MakeMessage();
List<CardAction> cardButtons = new List<CardAction>();

CardAction SRButton = new CardAction()
{
    Value = "shared mailbox request",
    Type = "imBack",
    Title = "Create Share Mailbox Request"
}; 

CardAction priorityButton = new CardAction()
{
    Value = "show me priority tickets",
    Type = "imBack",
    Title = "Status on P1 & P2 Incidents"
};

cardButtons.Add(SRButton);                
HeroCard welcomeCard = new HeroCard()
{
    Title = "Hello, I'm your Virtual Assistant. How can I help you?",
    Subtitle = "You can type your request below or ask me about the following",
    Buttons = cardButtons
};              

newPost.Attachments.Add(welcomeCard.ToAttachment());
await context.PostAsync(newPost);
context.Wait(MessageReceivedAsync);
context.Done(new object());
public virtual async Task MessageReceivedAsync(IDialogContext context, IAwaitable<IMessageActivity> result)
{
    var message = await result;

    //InputValues data;
    await context.PostAsync(message);

    if (message.Value != null)
    {
        // Got an Action Submit
        dynamic value = message.Value;
        string submitType = value.Type.ToString();
        if (value != null)
        {
            if (submitType == "Incident")
            {
                var feedbackForm = new FormDialog<FeedbackForm>(new FeedbackForm(), FeedbackForm.BuildForm, FormOptions.PromptInStart, null);
                context.Call<FeedbackForm>(feedbackForm, FeedbackFormCompleteAsync);
            }

        }
    }
}

但是获取异常ReplyToId不能为null。 我在V3中进行此操作,在nodejs中获得了许多此类示例。如果有人做过请让我知道。 谢谢

0 个答案:

没有答案