我在Bot Framework SDK V3中有问题。 选择答案后,漫游器会回复,并且漫游器会要求再次评分。 这里是截图。 而这里是我的代码:
private const string fiverate = "★★★★★";
private const string fourrate = "★★★★";
private const string threerate = "★★★";
private const string tworate = "★★";
private const string Onerate = "★";
public async Task ShowRating(IDialogContext context)
{
PromptDialog.Choice(context,this.OnOptionRating, new List<string>() { fiverate,fourrate,threerate,tworate,Onerate }," "," ",3);
}
private async Task OnOptionRating(IDialogContext context, IAwaitable<string> result)
{
try
{
string optionSelected = await result;
switch (optionSelected)
{
case fiverate:
await context.PostAsync("Five Star");
context.Done(String.Empty);
break;
case fourrate:
await context.PostAsync("Four Star");
context.Done(String.Empty);
break;
case threerate:
await context.PostAsync("Three Star");
context.Done(String.Empty);
break;
case tworate:
await context.PostAsync("Two Star");
context.Done(String.Empty);
break;
case Onerate:
await context.PostAsync("One Star");
context.Done(String.Empty);
break;
}
}
catch (TooManyAttemptsException ex)
{
await context.PostAsync($"Ooops! Too many attemps :(. But don't worry, I'm handling that exception and you can try again!");
context.Wait(this.MessageReceivedAsync);
}
}
有什么更好的解决方案吗?我从Stack Overflow引用了很多示例,但仍然找不到解决方案。
谢谢。
答案 0 :(得分:0)
我换了瀑布模型。它解决了我的问题。谢谢。