C# Class WebApplications.Utilities.Threading.AsyncTimer

Inheritance: IDisposable
ファイルを表示 Open project: webappsuk/CoreLibraries Class Usage Examples

Public Properties

Property Type Description
MinimumPeriod System.Duration

Public Methods

Method Description
AsyncTimer ( [ callback, System.Duration period = null, System.Duration dueTime = null, System.Duration minimumGap = null, PauseToken pauseToken = default(PauseToken), Action errorHandler = null ) : System

Initializes a new instance of the AsyncTimer class.

AsyncTimer ( [ callback, int period = Timeout.Infinite, int dueTime, int minimumGap, PauseToken pauseToken = default(PauseToken), Action errorHandler = null ) : System

Initializes a new instance of the AsyncTimer class.

AsyncTimer ( [ callback, System.Duration period = null, System.Duration dueTime = null, System.Duration minimumGap = null, PauseToken pauseToken = default(PauseToken), Action errorHandler = null ) : System

Initializes a new instance of the AsyncTimer class.

AsyncTimer ( [ callback, int period = Timeout.Infinite, int dueTime, int minimumGap, PauseToken pauseToken = default(PauseToken), Action errorHandler = null ) : System

Initializes a new instance of the AsyncTimer class.

Change ( System.Duration period = null, System.Duration dueTime = null, System.Duration minimumGap = null ) : void

Changes the specified due time and period.

Change ( int period = null, int dueTime = null, int minimumGap = null ) : void

Changes the specified due time and period.

Dispose ( ) : void

Performs application-defined tasks associated with freeing, releasing, or resetting unmanaged resources.

Private Methods

Method Description
ExecuteAsync ( CancellationToken cancellationToken = default(CancellationToken) ) : Task
TimerTask ( CancellationToken cancellationToken ) : Task

The timer task executes the callback asynchronously after set delays.

Method Details

AsyncTimer() public method

Initializes a new instance of the AsyncTimer class.
public AsyncTimer ( [ callback, System.Duration period = null, System.Duration dueTime = null, System.Duration minimumGap = null, PauseToken pauseToken = default(PauseToken), Action errorHandler = null ) : System
callback [ The asynchronous method to be executed.
period System.Duration The minimum gap between the start of the task invocation and the start of the previous task invocation (defautls to which is equivalent to ).
dueTime System.Duration The due time between the last time the timeouts were changed and the start of the task invocation (defautls to which is equivalent to ).
minimumGap System.Duration The minimum gap between the start of the task invocation and the end of the previous task invocation (defautls to which is equivalent to ).
pauseToken PauseToken The pause token for pasuing the timer.
errorHandler Action The optional error handler.
return System

AsyncTimer() public method

Initializes a new instance of the AsyncTimer class.
public AsyncTimer ( [ callback, int period = Timeout.Infinite, int dueTime, int minimumGap, PauseToken pauseToken = default(PauseToken), Action errorHandler = null ) : System
callback [ The callback.
period int The minimum gap (in milliseconds) between the start of the task invocation and the start of the previous task invocation (defaults to ).
dueTime int The due time (in milliseconds) between the last time the timeouts were changed and the start of the task invocation (defaults to 0ms).
minimumGap int The minimum gap (in milliseconds) between the start of the task invocation and the end of the previous task invocation (defaults to 0ms).
pauseToken PauseToken The pause token for pasuing the timer.
errorHandler Action The optional error handler.
return System

AsyncTimer() public method

Initializes a new instance of the AsyncTimer class.
public AsyncTimer ( [ callback, System.Duration period = null, System.Duration dueTime = null, System.Duration minimumGap = null, PauseToken pauseToken = default(PauseToken), Action errorHandler = null ) : System
callback [ The asynchronous method to be executed.
period System.Duration The minimum gap between the start of the task invocation and the start of the previous task invocation (defautls to which is equivalent to ).
dueTime System.Duration The due time between the last time the timeouts were changed and the start of the task invocation (defautls to which is equivalent to ).
minimumGap System.Duration The minimum gap between the start of the task invocation and the end of the previous task invocation (defautls to which is equivalent to ).
pauseToken PauseToken The pause token for pasuing the timer.
errorHandler Action The optional error handler.
return System

AsyncTimer() public method

Initializes a new instance of the AsyncTimer class.
public AsyncTimer ( [ callback, int period = Timeout.Infinite, int dueTime, int minimumGap, PauseToken pauseToken = default(PauseToken), Action errorHandler = null ) : System
callback [ The callback.
period int The minimum gap (in milliseconds) between the start of the task invocation and the start of the previous task invocation (defaults to ).
dueTime int The due time (in milliseconds) between the last time the timeouts were changed and the start of the task invocation (defaults to 0ms).
minimumGap int The minimum gap (in milliseconds) between the start of the task invocation and the end of the previous task invocation (defaults to 0ms).
pauseToken PauseToken The pause token for pasuing the timer.
errorHandler Action The optional error handler.
return System

Change() public method

Changes the specified due time and period.
public Change ( System.Duration period = null, System.Duration dueTime = null, System.Duration minimumGap = null ) : void
period System.Duration The optional minimum gap between the start of the task invocation and the start of the previous task invocation; use to leave the value unchanged.
dueTime System.Duration The optional due time between the last time the timeouts were changed and the start of the task invocation; use to leave the value unchanged.
minimumGap System.Duration The optional minimum gap between the start of the task invocation and the end of the previous task invocation; use to leave the value unchanged.
return void

Change() public method

Changes the specified due time and period.
public Change ( int period = null, int dueTime = null, int minimumGap = null ) : void
period int The optional minimum gap (in milliseconds) between the start of the task invocation and the start of the previous task invocation; use to leave the value unchanged.
dueTime int The optional due time (in milliseconds) between the last time the timeouts were changed and the start of the task invocation; use to leave the value unchanged.
minimumGap int The optional minimum gap (in milliseconds) between the start of the task invocation and the end of the previous task invocation; use to leave the value unchanged.
return void

Dispose() public method

Performs application-defined tasks associated with freeing, releasing, or resetting unmanaged resources.
public Dispose ( ) : void
return void

Property Details

MinimumPeriod public_oe static_oe property

The minimum period, prevents the timer thrashing too quickly.
public static Duration,System MinimumPeriod
return System.Duration