projects/wms-framework/src/lib/wcfserviceinvocationsupport/AsyncCompletedEventArgs.ts
Model for the arguments of the AsyncCompleted event
Properties |
|
Methods |
|
Accessors |
constructor(error: Exception, cancelled: boolean, userState: object)
|
||||||||||||||||
Creates an instance of AsyncCompletedEventArgs.
Parameters :
|
Private _cancelled |
Type : boolean
|
Default value : false
|
Private _error |
Type : Exception
|
Default value : null
|
Private _state |
Type : object
|
Default value : null
|
Protected RaiseExceptionIfNecessary |
RaiseExceptionIfNecessary()
|
Raises a user-supplied exception if an asynchronous operation failed.
Returns :
void
|
Cancelled |
getCancelled()
|
Gets a value that indicates whether an asynchronous operation has been canceled.
Returns :
boolean
|
Error |
getError()
|
Gets a value that indicates which error occurred during an asynchronous operation.
Returns :
Exception
|
UserState |
getUserState()
|
Gets the unique identifier for the asynchronous task.
Returns :
object
|
import { Debugger } from '../diagnostics/Debugger';
import { Exception } from '../baseframework/Exceptions';
/**
* Model for the arguments of the AsyncCompleted event
*
* @export
* @class AsyncCompletedEventArgs
* @wType System.ComponentModel.AsyncCompletedEventArgs
*/
export class AsyncCompletedEventArgs {
private _cancelled: boolean = false;
private _error: Exception = null;
private _state: object = null;
/**
* Creates an instance of AsyncCompletedEventArgs.
* @param {Exception} error Any error that occurred during the asynchronous operation.
* @param {boolean} cancelled A value that indicates whether the asynchronous operation was canceled.
* @param {object} userState The optional user-supplied state object that is used to identify the task that raised the Completed event.
* @memberof AsyncCompletedEventArgs
*/
constructor(error: Exception, cancelled: boolean, userState: object) {
this._cancelled = cancelled;
this._error = error;
this._state = userState;
}
/**
* Raises a user-supplied exception if an asynchronous operation failed.
*
* @protected
* @memberof AsyncCompletedEventArgs
*/
protected RaiseExceptionIfNecessary(): void {
if (this.Error != null)
Debugger.Throw(
'Async_ExceptionOccurred: ' + new Error(this.Error.description)
);
if (this.Cancelled) Debugger.Throw('Async_OperationCancelled');
}
/**
* Gets a value that indicates whether an asynchronous operation has been canceled.
*
* @readonly
* @type {boolean}
* @memberof AsyncCompletedEventArgs
*/
public get Cancelled(): boolean {
return this._cancelled;
}
/**
* Gets a value that indicates which error occurred during an asynchronous operation.
*
* @readonly
* @type {Exception}
* @memberof AsyncCompletedEventArgs
*/
public get Error(): Exception {
return this._error;
}
/**
* Gets the unique identifier for the asynchronous task.
*
* @readonly
* @type {object}
* @memberof AsyncCompletedEventArgs
*/
public get UserState(): object {
return this._state;
}
}