我尝试修改以下示例: ChoiceFlow Dialog Sample
我有一个从ComponentDialog派生的带有WaterfallSteps的类。 掌握了足够的信息后,我将开始一个新对话框(TroubleshootingDialog)。
故障排除对话框结束时(通过调用EndDialogAsync结束),我想分析在子对话框中收集的数据并采取适当的措施。
为此,我尝试覆盖ResumeDialogAsync,但是在子对话框结束时不会触发。
public class ProductFlowDialog : ComponentDialog
In constructor:
var guidedWaterfall = new WaterfallStep[]
{
LoadChoiceFlowItems,
PromptChoice,
ActOnPromptResult,
};
public async Task<DialogTurnResult> PromptChoice(WaterfallStepContext sc, CancellationToken cancellationToken)
{
if ( something)
{
}
else
{
// Here we have enough information to start new dialog.
var result = await sc.ReplaceDialogAsync("TroubleshootingDialog", wOptions);
return result;
}
public override Task<DialogTurnResult> ResumeDialogAsync(DialogContext outerDc, DialogReason reason, object result = null, CancellationToken cancellationToken = default(CancellationToken))
{
// Do something
}
}