protected override async Task OnContinueDialogAsync()

in sdk/csharp/libraries/microsoft.bot.solutions/Dialogs/ActivityHandlerDialog.cs [61:137]


        protected override async Task<DialogTurnResult> OnContinueDialogAsync(DialogContext innerDc, CancellationToken cancellationToken = default)
        {
            // Check for any interruptions.
            var status = await OnInterruptDialogAsync(innerDc, cancellationToken).ConfigureAwait(false);

            if (status == InterruptionAction.Resume)
            {
                // Interruption message was sent, and the waiting dialog should resume/reprompt.
                await innerDc.RepromptDialogAsync().ConfigureAwait(false);
            }
            else if (status == InterruptionAction.Waiting)
            {
                // Interruption intercepted conversation and is waiting for user to respond.
                return EndOfTurn;
            }
            else if (status == InterruptionAction.End)
            {
                // Interruption ended conversation, and current dialog should end.
                return await innerDc.EndDialogAsync().ConfigureAwait(false);
            }
            else if (status == InterruptionAction.NoAction)
            {
                // No interruption was detected. Process activity normally.
                var activity = innerDc.Context.Activity;

                switch (activity.Type)
                {
                    case ActivityTypes.Message:
                        {
                            // Pass message to waiting child dialog.
                            var result = await innerDc.ContinueDialogAsync().ConfigureAwait(false);

                            if (result.Status == DialogTurnStatus.Empty)
                            {
                                // There was no waiting dialog on the stack, process message normally.
                                await OnMessageActivityAsync(innerDc).ConfigureAwait(false);
                            }

                            break;
                        }

                    case ActivityTypes.Event:
                        {
                            await OnEventActivityAsync(innerDc).ConfigureAwait(false);
                            break;
                        }

                    case ActivityTypes.Invoke:
                        {
                            // Used by Teams for Authentication scenarios.
                            await innerDc.ContinueDialogAsync().ConfigureAwait(false);
                            break;
                        }

                    case ActivityTypes.ConversationUpdate:
                        {
                            await OnMembersAddedAsync(innerDc).ConfigureAwait(false);
                            break;
                        }

                    default:
                        {
                            // All other activity types will be routed here. Custom handling should be added in implementation.
                            await OnUnhandledActivityTypeAsync(innerDc).ConfigureAwait(false);
                            break;
                        }
                }
            }

            if (innerDc.ActiveDialog == null)
            {
                // If the inner dialog stack completed during this turn, this component should be ended.
                return await innerDc.EndDialogAsync().ConfigureAwait(false);
            }

            return EndOfTurn;
        }