C# Class WinRTXamlToolkit.Tools.BackgroundTimer

A timer that raises the Tick events on a background thread, similar to ThreadPoolTimer, but with API compatible with DispatcherTimer.
It was written in response to this SO question: Controlled non UI timer in metro app (.NET) (http://stackoverflow.com/questions/10493253/controlled-non-ui-timer-in-metro-app-net). The purpose was to have ticks on a background thread and have the same API as the DispatcherTimer. It also has an option to self adjust a bit to have an average frequency closer to what you would expect given the configured Interval. That said I was not aware of the ThreadPoolTimer, so it is possible it makes more sense to use that one. It is a bit strange that the two timers we get have different APIs though, so perhaps that is one case where using the BackgroundTimer makes a little bit of sense.
Inheritance: IDisposable
Afficher le fichier Open project: xyzzer/WinRTXamlToolkit Class Usage Examples

Méthodes publiques

Méthode Description
BackgroundTimer ( ) : System

Initializes a new instance of the BackgroundTimer class.

Dispose ( ) : void

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

Start ( ) : void

Starts the BackgroundTimer.

Stop ( ) : void

Stops the BackgroundTimer. Waits for it to stop before returning.

StopNonBlocking ( ) : void

Stops the BackgroundTimer - non blocking.

Private Methods

Méthode Description
Run ( ) : void
RunAdjusted ( ) : void

Method Details

BackgroundTimer() public méthode

Initializes a new instance of the BackgroundTimer class.
public BackgroundTimer ( ) : System
Résultat System

Dispose() public méthode

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

Start() public méthode

Starts the BackgroundTimer.
public Start ( ) : void
Résultat void

Stop() public méthode

Stops the BackgroundTimer. Waits for it to stop before returning.
public Stop ( ) : void
Résultat void

StopNonBlocking() public méthode

Stops the BackgroundTimer - non blocking.
public StopNonBlocking ( ) : void
Résultat void