Skip to content

Commit

Permalink
Merge branch 'ccastro/adaptive-style' of https://github.com/microsoft…
Browse files Browse the repository at this point in the history
…/botbuilder-dotnet into ccastro/adaptive-style
  • Loading branch information
carlosscastro committed May 8, 2020
2 parents ea30297 + 5eb90d3 commit cb9d873
Show file tree
Hide file tree
Showing 4 changed files with 19 additions and 33 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -227,7 +227,7 @@ public class OAuthInput : InputDialog
// increase the turnCount as last step
dc.State.SetValue(TURN_COUNT_PROPERTY, turnCount + 1);
var prompt = await this.OnRenderPromptAsync(dc, inputState, cancellationToken).ConfigureAwait(false);
await dc.Context.SendActivityAsync(prompt).ConfigureAwait(false);
await dc.Context.SendActivityAsync(prompt, cancellationToken).ConfigureAwait(false);
await SendOAuthCardAsync(dc, promptOptions?.Prompt, cancellationToken).ConfigureAwait(false);
return Dialog.EndOfTurn;
}
Expand Down
22 changes: 3 additions & 19 deletions libraries/Microsoft.Bot.Builder.Dialogs/DialogContainer.cs
Original file line number Diff line number Diff line change
Expand Up @@ -47,31 +47,15 @@ protected virtual string GetInternalVersion()
/// CheckForVersionChangeAsync.
/// </summary>
/// <param name="dc">dialog context.</param>
/// <param name="cancellationToken">cancellationToken.</param>
/// <returns>task.</returns>
/// <remarks>
/// Checks to see if a containers child dialogs have changed since the current dialog instance
/// was started.
///
/// This should be called at the start of `beginDialog()`, `continueDialog()`, and `resumeDialog()`.
/// </remarks>
protected virtual Task CheckForVersionChangeAsync(DialogContext dc)
{
return CheckForVersionChangeAsync(dc, default(CancellationToken));
}

/// <summary>
/// CheckForVersionChangeAsync.
/// </summary>
/// <param name="dc">dialog context.</param>
/// <param name="cancellationToken">cancellationToken.</param>
/// <returns>task.</returns>
/// <remarks>
/// Checks to see if a containers child dialogs have changed since the current dialog instance
/// was started.
///
/// This should be called at the start of `beginDialog()`, `continueDialog()`, and `resumeDialog()`.
/// </remarks>
protected virtual async Task CheckForVersionChangeAsync(DialogContext dc, CancellationToken cancellationToken)
protected virtual async Task CheckForVersionChangeAsync(DialogContext dc, CancellationToken cancellationToken = default(CancellationToken))
{
var current = dc.ActiveDialog.Version;
dc.ActiveDialog.Version = this.GetInternalVersion();
Expand All @@ -82,7 +66,7 @@ protected virtual async Task CheckForVersionChangeAsync(DialogContext dc, Cancel
// Give bot an opportunity to handle the change.
// - If bot handles it the changeHash will have been updated as to avoid triggering the
// change again.
var handled = await dc.EmitEventAsync(DialogEvents.VersionChanged, this.Id, true, false).ConfigureAwait(false);
var handled = await dc.EmitEventAsync(DialogEvents.VersionChanged, this.Id, true, false, cancellationToken).ConfigureAwait(false);
if (!handled)
{
// Throw an error for bot to catch
Expand Down
Original file line number Diff line number Diff line change
@@ -1,21 +1,22 @@
{
"$schema": "../../testbot.schema",
"$kind": "Microsoft.AdaptiveDialog",
"triggers": [
{
"$kind": "Microsoft.OnBeginDialog",
"actions": [
{
"$kind": "Microsoft.SendActivity",
"activity": "World"
},
{
"$kind": "Microsoft.EndTurn"
},
{
"$kind": "Microsoft.BeginDialog",
"dialog": "Root.dialog"
}
]
"actions": [
{
"$kind": "Microsoft.SendActivity",
"activity": "World"
},
{
"$kind": "Microsoft.EndTurn"
},
{
"$kind": "Microsoft.BeginDialog",
"dialog": "Root.dialog"
}
]
}
]
}
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
{
"$schema": "../../testbot.schema",
"$kind": "Microsoft.AdaptiveDialog",
"triggers": [
{
Expand Down

0 comments on commit cb9d873

Please sign in to comment.