C# Класс 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.
Наследование: IDisposable
Показать файл Открыть проект Примеры использования класса

Открытые методы

Метод Описание
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.

Приватные методы

Метод Описание
Run ( ) : void
RunAdjusted ( ) : void

Описание методов

BackgroundTimer() публичный Метод

Initializes a new instance of the BackgroundTimer class.
public BackgroundTimer ( ) : System
Результат System

Dispose() публичный Метод

Performs application-defined tasks associated with freeing, releasing, or resetting unmanaged resources.
public Dispose ( ) : void
Результат void

Start() публичный Метод

Starts the BackgroundTimer.
public Start ( ) : void
Результат void

Stop() публичный Метод

Stops the BackgroundTimer. Waits for it to stop before returning.
public Stop ( ) : void
Результат void

StopNonBlocking() публичный Метод

Stops the BackgroundTimer - non blocking.
public StopNonBlocking ( ) : void
Результат void