TurnEventHandler Delegate
Definition
Important
Some information relates to prerelease product that may be substantially modified before it’s released. Microsoft makes no warranties, express or implied, with respect to the information provided here.
Turn event handler to do something before or after a turn is run. Returning false from
beforeTurn lets you prevent the turn from running and returning false from afterTurn
lets you prevent the Agents state from being saved.
Returning false from beforeTurn does result in the Agents state being saved which lets you
track the reason why the turn was not processed. It also means you can use beforeTurn as
a way to call into the dialog system. For example, you could use the OAuthPrompt to sign the
user in before allowing the AI system to run.
public delegate System.Threading.Tasks.Task<bool> TurnEventHandler(ITurnContext turnContext, ITurnState turnState, CancellationToken cancellationToken);
type TurnEventHandler = delegate of ITurnContext * ITurnState * CancellationToken -> Task<bool>
Public Delegate Function TurnEventHandler(turnContext As ITurnContext, turnState As ITurnState, cancellationToken As CancellationToken) As Task(Of Boolean)
Parameters
- turnContext
- ITurnContext
A strongly-typed context object for this turn.
- turnState
- ITurnState
The turn state object that stores arbitrary data for this turn.
- cancellationToken
- CancellationToken
A cancellation token that can be used by other objects or threads to receive notice of cancellation.
Return Value
True to continue execution of the current turn. Otherwise, False.