public static DialogTurnResult Wait(this DialogContext dc, DialogCommandHandler method) { MethodInfo mi = method.Method; dc.ActiveDialog.State["Handler"] = mi.Name; return(new DialogTurnResult(DialogTurnStatus.Waiting)); }
public static async Task <DialogTurnResult> Wait(this DialogContext dc, DialogCommandHandler method, string dialogName) { MethodInfo mi = method.Method; dc.ActiveDialog.State["Handler"] = mi.Name; await dc.BeginDialogAsync(dialogName); return(new DialogTurnResult(DialogTurnStatus.Waiting)); }
public override async Task <DialogTurnResult> ResumeDialogAsync(DialogContext dc, DialogReason reason, object result = null, CancellationToken cancellationToken = default) { if (dc.ActiveDialog.State.ContainsKey("Handler") && dc.ActiveDialog.State["Handler"] != null) { string methodName = (string)dc.ActiveDialog.State["Handler"]; MethodInfo mi = this.GetType().GetMethod(methodName); DialogCommandHandler Handler = (DialogCommandHandler)Delegate.CreateDelegate(typeof(DialogCommandHandler), this, mi); if (Handler != null) { dc.ActiveDialog.State["Handler"] = null; return(await Handler(dc, result)); } } await dc.Context.SendActivityAsync("No next step defined returning to parent"); return(new DialogTurnResult(DialogTurnStatus.Complete)); }