Share via


ActivityHandler.OnCommandResultActivityAsync Method

Definition

Invoked when a CommandResult activity is received when the base behavior of OnTurnAsync(ITurnContext, CancellationToken) is used. CommandResult activities can be used to communicate the result of a command execution.

protected virtual System.Threading.Tasks.Task OnCommandResultActivityAsync (Microsoft.Bot.Builder.ITurnContext<Microsoft.Bot.Schema.ICommandResultActivity> turnContext, System.Threading.CancellationToken cancellationToken);
abstract member OnCommandResultActivityAsync : Microsoft.Bot.Builder.ITurnContext<Microsoft.Bot.Schema.ICommandResultActivity> * System.Threading.CancellationToken -> System.Threading.Tasks.Task
override this.OnCommandResultActivityAsync : Microsoft.Bot.Builder.ITurnContext<Microsoft.Bot.Schema.ICommandResultActivity> * System.Threading.CancellationToken -> System.Threading.Tasks.Task
Protected Overridable Function OnCommandResultActivityAsync (turnContext As ITurnContext(Of ICommandResultActivity), cancellationToken As CancellationToken) As Task

Parameters

turnContext
ITurnContext<ICommandResultActivity>

A strongly-typed context object for this turn.

cancellationToken
CancellationToken

A cancellation token that can be used by other objects or threads to receive notice of cancellation.

Returns

A task that represents the work queued to execute.

Remarks

When the OnTurnAsync(ITurnContext, CancellationToken) method receives a CommandResult activity, it calls this method.

In a derived class, override this method to add logic that applies to all comand activities. Add logic to apply before the specific CommandResult-handling logic before the call to the base class OnCommandResultActivityAsync(ITurnContext<ICommandResultActivity>, CancellationToken) method. Add logic to apply after the specific CommandResult-handling logic after the call to the base class OnCommandResultActivityAsync(ITurnContext<ICommandResultActivity>, CancellationToken) method.

CommandResult activities communicate programmatic information from a client or channel to a bot. The meaning of an CommandResult activity is defined by the Name property, which is meaningful within the scope of a channel.

Applies to

See also