How to call dialog in the middle of Form? I would like to call Location dialog https://github.com/Microsoft/BotBuilder-Location to get address. Thanks.
[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);
}
}
Are you expecting a solution based on an attribute declaration or is regular code acceptable?
Microsoft offers Dialog Chaining invoked as a sequence or a stack.
The accepted answer in the follow SO question answers your question I think.
Here is the code extract from that answer:
var myform = new FormDialog<CreateNewLeadForm>(new CreateNewLeadForm(), CreateNewLeadForm.BuildForm, FormOptions.PromptInStart, null);
context.Call<CreateNewLeadForm>(myform, FormCompleteCallback);
Another SO question discusses the subject in more general:
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.