CommandPattern 1.0.0
This package contains a collection of classes and interfaces to allow for quick and consistent implementation of the command pattern across projects.
Public Member Functions | Properties | Events | List of all members
SadSapphicGames.CommandPattern.IAsyncCommand Interface Referenceabstract

This Interface of the AsyncCommand abstract class, It is strongly recommended you use the AsyncCommand class rather than implement this yourself unless you are very familiar with asynchronous programming
More...

Inheritance diagram for SadSapphicGames.CommandPattern.IAsyncCommand:
SadSapphicGames.CommandPattern.ICommand SadSapphicGames.CommandPattern.AsyncCommand

Public Member Functions

abstract Task ExecuteAsync ()
 This is where the logic of executing the command should be placed for an AsyncCommand, Execute should just store the return in CommandTask and setup the OnTaskCompleted method. Remember to make this method async as that isn't considered part of its signature. More...
 
- Public Member Functions inherited from SadSapphicGames.CommandPattern.ICommand
abstract void Execute ()
 Executes the function of the command More...
 

Properties

Task CommandTask [get]
 This should get the asynchronous task returned by ExecuteAsync after it reaches its first await More...
 
CancellationToken CancellationToken [get, set]
 This can be used to Cancel the task after it has been started. More...
 

Events

Action OnTaskCompleted
 This event should be invoked when CommandTask is successfully completed.
 
Action OnTaskCanceled
 This event should be invoked when CommandTask is cancelled.
 
Action< Exception > OnTaskFaulted
 This event should be invoked when CommandTask throws an exception
 
Action OnAnyTaskEnd
 This event should be invoked when any of the above three are
 

Detailed Description

This Interface of the AsyncCommand abstract class, It is strongly recommended you use the AsyncCommand class rather than implement this yourself unless you are very familiar with asynchronous programming

Member Function Documentation

◆ ExecuteAsync()

abstract Task SadSapphicGames.CommandPattern.IAsyncCommand.ExecuteAsync ( )
pure virtual

This is where the logic of executing the command should be placed for an AsyncCommand, Execute should just store the return in CommandTask and setup the OnTaskCompleted method. Remember to make this method async as that isn't considered part of its signature.

Returns
The Task representing the completion of the method after it reaches its first await statement

Implemented in SadSapphicGames.CommandPattern.AsyncCommand.

Property Documentation

◆ CancellationToken

CancellationToken SadSapphicGames.CommandPattern.IAsyncCommand.CancellationToken
getset

This can be used to Cancel the task after it has been started.

Implemented in SadSapphicGames.CommandPattern.AsyncCommand.

◆ CommandTask

Task SadSapphicGames.CommandPattern.IAsyncCommand.CommandTask
get

This should get the asynchronous task returned by ExecuteAsync after it reaches its first await

Implemented in SadSapphicGames.CommandPattern.AsyncCommand.


The documentation for this interface was generated from the following file: