private async Task HandlerLGEventAsync(DialogContext dialogContext, object sender, EventArgs eventArgs, CancellationToken cancellationToken = default)
        {
            // skip the events that is not LG event or the event path is invalid.
            if (!(eventArgs is LGEventArgs))
            {
                await Task.CompletedTask.ConfigureAwait(false);
            }

            if (eventArgs is BeginTemplateEvaluationArgs || eventArgs is BeginExpressionEvaluationArgs)
            {
                // Send debugger event
                await dialogContext.GetDebugger().StepAsync(dialogContext, sender, DialogEvents.Custom, cancellationToken).ConfigureAwait(false);
            }
            else if (eventArgs is MessageArgs message && dialogContext.GetDebugger() is IDebugger dda)
            {
                // send debugger message
                await dda.OutputAsync(message.Text, sender, message.Text, cancellationToken).ConfigureAwait(false);
            }

            await Task.CompletedTask.ConfigureAwait(false);
        }
Esempio n. 2
0
 /// <summary>
 /// Call into active IDialogDebugger and let it know that we are at given point.
 /// </summary>
 /// <param name="context">The <see cref="DialogContext"/> for the current turn of conversation.</param>
 /// <param name="conditional">Condition to trigger the event.</param>
 /// <param name="dialogEvent">The event being raised.</param>
 /// <param name="cancellationToken">The <see cref="CancellationToken"/> for this task.</param>
 /// <returns>A <see cref="Task"/> representing the asynchronous operation.</returns>
 public static async Task DebuggerStepAsync(this DialogContext context, OnCondition conditional, DialogEvent dialogEvent, CancellationToken cancellationToken)
 {
     await context.GetDebugger().StepAsync(context, conditional, more: dialogEvent?.Name ?? string.Empty, cancellationToken: cancellationToken).ConfigureAwait(false);
 }
 /// <summary>
 /// Call into active IDialogDebugger and let it know that we are at given point in the Recognizer.
 /// </summary>
 /// <param name="context">dialogContext.</param>
 /// <param name="recognizer">recognizer.</param>
 /// <param name="more">label.</param>
 /// <param name="cancellationToken">cancellation token for async operations.</param>
 /// <returns>async task.</returns>
 public static async Task DebuggerStepAsync(this DialogContext context, Recognizer recognizer, string more, CancellationToken cancellationToken)
 {
     await context.GetDebugger().StepAsync(context, recognizer, more, cancellationToken).ConfigureAwait(false);
 }