Starting a FormFlow Dialog From Another Dialog

时间:2016-04-15 11:04:46

标签: c# dialog botframework formflow

I have bot consisting of a main LuisDialog and two other dialogs. When I get a certain LuisIntent I start one of the other dialogs (which is the sample Echo Bot) and when I end that dialog it returns to the main LuisDialog no problem.

When I get the LuisIntent to start the other dialog, which is a FormFlow dialog, it does happyily start the dialog, but the user has to enter something before the dialog runs. So the user enters 'order a sandwich' and then has to enter anything else before getting the first message in the dialog.

Does anyone know who to start a FormFlow, or indeed any, Dialog and jump straight into it without waiting for the user to enter anything? The code I'm using to start the sandwich dialog is as follows:

    internal static IFormDialog<SandwichBot.SandwichOrder> MakeRootDialog()
    {


        return FormDialog.FromForm(SandwichBot.SandwichOrder.BuildForm);
    }

    [LuisIntent("OrderSandwich")]
    public async Task StartSandwichOrder(IDialogContext context, LuisResult result)
    {
        IFormDialog<SandwichBot.SandwichOrder> tmp = MakeRootDialog();
        context.Call(tmp, SandwichOrderComplete);
    }

1 个答案:

答案 0 :(得分:3)

好的,排序。在制作表单时我错过了FormOptions。所以,MakeRootDialog应该是

        internal static IFormDialog<SandwichBot.SandwichOrder> MakeRootDialog()
    {
        return FormDialog.FromForm(SandwichBot.SandwichOrder.BuildForm,options: FormOptions.PromptInStart);
    }