2017-08-14 1 views
0

Wie Dialog in der Mitte des Formulars aufrufen? Ich möchte den Standort-Dialog https://github.com/Microsoft/BotBuilder-Location aufrufen, um die Adresse zu erhalten. Danke.Wie Aufruf Dialog von FormFlow

[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

Dies ist nicht ein Feature. – JasonSowers

Antwort

0

Erwarten Sie eine Lösung basierend auf einer Attributdeklaration oder ist normaler Code akzeptabel?

Microsoft bietet Dialogfeld Chaining aufgerufen als eine Sequenz oder einen Stapel.

Die akzeptierte Antwort in der folgenden SO Frage beantwortet Ihre Frage, die ich denke. Hier

Calling Forms from Dialogs

ist der Code Auszug aus dieser Antwort:

var myform = new FormDialog<CreateNewLeadForm>(new CreateNewLeadForm(), CreateNewLeadForm.BuildForm, FormOptions.PromptInStart, null); 

context.Call<CreateNewLeadForm>(myform, FormCompleteCallback); 

Eine andere Frage SO diskutiert das Thema in allgemeinen:

Handling multiple dialogs in Microsoft bot framework

+0

danke. Das erste Codebeispiel zeigt, wie Sie das Formular aus Dialog aufrufen. Ich muss Dialog von Form aufrufen. Attributbasierte Lösung ist nur mein Vorschlag – Ma3yTa

Verwandte Themen