我想在搜索小部件后询问用户想要使用哪个小部件,这会生成小部件列表。我希望能够单击窗口小部件的名称,然后获取窗口小部件的URL。当我运行以下代码时,我得到invalid need: expected Call, have Poll
。
public async Task SelectAfterSearch(IDialogContext context, List<Widget> widgetlist)
{
PromptDialog.Choice(context, this.OnWidgetSelected, GetListOfWidgets("list"), "Which one do you want more information about?", "Not a valid option", 3);
}
public async Task OnWidgetSelected(IDialogContext context, IAwaitable<Widget> result)
{
var chosen = await result;
await context.PostAsync($"You have chosen {chosen.Name}: {chosen.Url}");
}
答案 0 :(得分:2)
context.Wait
方法结束时,您遗漏了OnWidgetSelected
。
public async Task OnWidgetSelected(IDialogContext context, IAwaitable<Widget> result)
{
var chosen = await result;
await context.PostAsync($"You have chosen {chosen.Name}: {chosen.Url}");
context.Wait(...) // => usually you Wait on the MessageReceived method.
}