Interface IAsyncOperationCallbacks
Defines basic callback management tools for IAsyncOperation.
Namespace: UnityFx.Async
Assembly: UnityFx.Async-netstandard2.0.dll
Syntax
public interface IAsyncOperationCallbacks
Methods
| Improve this Doc View SourceAddCompletionCallback(Object, SynchronizationContext)
Adds a completion callback to be executed after the operation has completed. If the operation is completed callback
is invoked
on the syncContext
specified. Throwing an exception from the callback causes unspecified behaviour. The method is not intended
to be used by user code. Do not use if not sure.
Declaration
void AddCompletionCallback(object callback, SynchronizationContext syncContext)
Parameters
Type | Name | Description |
---|---|---|
Object | callback | The callback to be executed when the operation has completed. Can be one of Action, System.Action<T> (with IAsyncOperation argument type), AsyncCallback, IAsyncContinuation or AsyncCompletedEventHandler. |
SynchronizationContext | syncContext | If not null method attempts to marshal the continuation to the synchronization context. Otherwise the callback is invoked on a thread that initiated the operation completion. |
Remarks
The callback
is invoked on a SynchronizationContext specified.
Exceptions
Type | Condition |
---|---|
ArgumentNullException | Thrown if |
ObjectDisposedException | Thrown is the operation has been disposed. |
See Also
| Improve this Doc View SourceAddProgressCallback(Object, SynchronizationContext)
Adds a callback to be executed when the operation progress has changed. If the operation is completed callback
is invoked
on the syncContext
specified. Throwing an exception from the callback might cause unspecified behaviour. The method is not intended
to be used by user code. Do not use if not sure.
Declaration
void AddProgressCallback(object callback, SynchronizationContext syncContext)
Parameters
Type | Name | Description |
---|---|---|
Object | callback | The callback to be executed when the operation progress has changed. |
SynchronizationContext | syncContext | If not null method attempts to marshal the continuation to the synchronization context. Otherwise the callback is invoked on a thread that initiated the operation. |
Remarks
The callback
is invoked on a SynchronizationContext specified.
Exceptions
Type | Condition |
---|---|
ArgumentNullException | Thrown if |
ObjectDisposedException | Thrown is the operation has been disposed. |
See Also
| Improve this Doc View SourceRemoveCallback(Object)
Removes an existing completion/progress callback.
Declaration
bool RemoveCallback(object callback)
Parameters
Type | Name | Description |
---|---|---|
Object | callback | The callback to remove. Can be null. |
Returns
Type | Description |
---|---|
Boolean | Returns true if |
See Also
Events
| Improve this Doc View SourceCompleted
Raised when the operation is completed.
Declaration
event AsyncCompletedEventHandler Completed
Event Type
Type | Description |
---|---|
AsyncCompletedEventHandler |
Remarks
The event handler is invoked on a thread that registered it (if it has a SynchronizationContext attached). If the operation is already completed the event handler is called synchronously. Throwing an exception from the event handler might cause unspecified behaviour.
Exceptions
Type | Condition |
---|---|
ArgumentNullException | Thrown if the delegate being registered is null. |
ObjectDisposedException | Thrown is the operation has been disposed. |
See Also
| Improve this Doc View SourceProgressChanged
Raised when the operation progress is changed.
Declaration
event ProgressChangedEventHandler ProgressChanged
Event Type
Type | Description |
---|---|
ProgressChangedEventHandler |
Remarks
The event handler is invoked on a thread that registered it (if it has a SynchronizationContext attached). If the operation is already completed the event handler is called synchronously. Throwing an exception from the event handler might cause unspecified behaviour.
Exceptions
Type | Condition |
---|---|
ArgumentNullException | Thrown if the delegate being registered is null. |
ObjectDisposedException | Thrown is the operation has been disposed. |