protected override async Task <DialogTurnResult> EndComponentAsync(DialogContext outerDc, object result, CancellationToken cancellationToken) { var doCancel = (bool)result; if (doCancel) { // If user chose to cancel await _responder.ReplyWith(outerDc.Context, CancelResponses._cancelConfirmed); // Cancel all in outer stack of component i.e. the stack the component belongs to return(await outerDc.CancelAllDialogsAsync()); } else { // else if user chose not to cancel await _responder.ReplyWith(outerDc.Context, CancelResponses._cancelDenied); // End this component. Will trigger reprompt/resume on outer stack return(await outerDc.EndDialogAsync()); } }
private async Task <InterruptionAction> OnCancel(DialogContext dc) { if (dc.ActiveDialog != null && dc.ActiveDialog.Id != nameof(CancelDialog)) { // Don't start restart cancel dialog await dc.BeginDialogAsync(nameof(CancelDialog)); // Signal that the dialog is waiting on user response return(InterruptionAction.StartedDialog); } var view = new CancelResponses(); await view.ReplyWith(dc.Context, CancelResponses.ResponseIds.NothingToCancelMessage); return(InterruptionAction.StartedDialog); }
private async Task <InterruptionAction> OnReset(DialogContext dc) { await _userState.ClearStateAsync(dc.Context); var onboardingState = await _onboardingState.GetAsync(dc.Context); await dc.Context.SendActivityAsync($"The state has been reset.").ConfigureAwait(false); if (dc.ActiveDialog != null && dc.ActiveDialog.Id != nameof(CancelDialog)) { // Don't start restart cancel dialog await dc.CancelAllDialogsAsync(); // Signal that the dialog is waiting on user response return(InterruptionAction.StartedDialog); } var view = new CancelResponses(); await view.ReplyWith(dc.Context, CancelResponses.ResponseIds.NothingToCancelMessage); return(InterruptionAction.StartedDialog); }