如何在Form中间调用对话框? 我想打电话给位置对话框https://github.com/Microsoft/BotBuilder-Location以获取地址。 感谢。
[Serializable]
public class IssueShares
{
[Prompt("Please enter holder name:")]
public string HolderName;
[Prompt("Please enter holder address:")]
**[Call(typeof(AddressDialog))]**
public Address Address;
[Prompt("Enter shares class:")]
public string SharesClass { get; set; }
[Prompt("How many shares your issue?")]
[Describe("Number of shares")]
public int NumberOfShares { get; set; }
}
[Serializable]
public class AddressDialog : IDialog<Address>
{
public Task StartAsync(IDialogContext context)
{
context.Wait(MessageReceived);
return Task.CompletedTask;
}
private async Task MessageReceived(IDialogContext context, IAwaitable<object> result)
{
// some logic
context.Done(address);
}
}
答案 0 :(得分:0)
您期望基于属性声明的解决方案还是可接受的常规代码?
Microsoft提供了作为序列或堆栈调用的Dialog Chaining。
以下SO问题中的接受答案回答了我的问题。
以下是该答案的代码摘录:
var myform = new FormDialog<CreateNewLeadForm>(new CreateNewLeadForm(), CreateNewLeadForm.BuildForm, FormOptions.PromptInStart, null);
context.Call<CreateNewLeadForm>(myform, FormCompleteCallback);
另一个SO问题更广泛地讨论了这个主题: