[英]Can I prompt the user with carousels instead of buttons in the Bot Framework?
I would like to know if it is possible to have a PromptDialog with carousels instead of buttons. 我想知道是否可以使用带有轮播而不是按钮的PromptDialog。
For example, if I want to prompt the user with choices I can do something like this: 例如,如果要提示用户选择,可以执行以下操作:
public virtual async Task MessageReceivedAsync(IDialogContext context, IAwaitable<IMessageActivity> result)
{
IEnumerable<string> options = new List<string>
{
"First Option",
"Second Option",
"Third Option",
"Fourth Option"
};
PromptDialog.Choice(context, AfterPromptDialogChoice, options, "Choose an option");
}
private async Task AfterPromptDialogChoice(IDialogContext context, IAwaitable<string> result)
{
string input = await result;
await context.PostAsync(input);
context.Wait(this.MessageReceivedAsync);
}
The key here for me is that after the user chooses an option I can handle the choice inside the AfterPromptDialogChoice method. 对我而言,关键是在用户选择一个选项之后,我可以在AfterPromptDialogChoice方法内处理该选择。 What I would like is to prompt the user with a carousel, and when he chooses one one of the carousel items I would like to redirect the flow to an delegate method where I can perform some operations based on the users choice.
我想用一个轮播提示用户,当他选择一个轮播项目时,我想将流程重定向到一个委托方法,我可以根据用户的选择执行一些操作。
I know that using a regular carousel I can use an CardAction to send back the option the user selected, however this option's value (text) will be send again to the bot and won't be related to the user choice. 我知道使用常规的轮播,我可以使用CardAction来发回用户选择的选项,但是该选项的值(文本)将再次发送给机器人,并且与用户的选择无关。 I just would like to have the behavior of the PromptDialog.Choice, but with a carousel to display the options, instead of only buttons Is that possible?
我只是想拥有PromptDialog.Choice的行为,但是有一个轮播显示选项而不是仅显示按钮,这可能吗?
You might have to provide your PromptStyler to the PromptOptions of the PromptChoice. 您可能需要提供您的PromptStyler到PromptOptions的PromptChoice的。
The PromptStyler is the one responsible of applying the proper PromptStyle to the options. PromptStyler是负责将适当的PromptStyle应用于选项的人。
It's something that you would have to explore and see if it will suits all your needs. 您必须进行探索,看看它是否可以满足您的所有需求。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.