예제 #1
0
        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);
        }
예제 #2
0
        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);
        }