DispatcherTimer Class |
Namespace: Windows.UI.Xaml
public class DispatcherTimer
The DispatcherTimer type exposes the following members.
Name | Description | |
---|---|---|
DispatcherTimer |
Initializes a new instance of the DispatcherTimer class.
|
Name | Description | |
---|---|---|
Equals(Object) | (Inherited from Object.) | |
GetHashCode | Serves as a hash function for a particular type. (Inherited from Object.) | |
GetType | Gets the Type of the current instance. (Inherited from Object.) | |
MemberwiseClone | Creates a shallow copy of the current Object. (Inherited from Object.) | |
OnTick |
Raises the Tick event.
| |
Start |
Starts the DispatcherTimer.
| |
Stop |
Stops the DispatcherTimer.
| |
ToString | Returns a string that represents the current object. (Inherited from Object.) |
Name | Description | |
---|---|---|
Interval |
Gets or sets the amount of time between timer ticks.
| |
IsEnabled |
Gets a value that indicates whether the timer is running.
|
DispatcherTimer _dispatcherTimer;
//We create a new instance of DispatcherTimer: _dispatcherTimer = new Dispatchertimer(); //we set the time between each tick of the DispatcherTimer to 100 milliseconds: timer.Interval = new TimeSpan(0, 0, 0, 0, 100); _dispatcherTimer.Tick += DispatcherTimer_Tick; _dispatcherTimer.Start();
void DispatcherTimer_Tick(object sender, object e) { //Some code to execute at each Tick of the DispatcherTimer. }
_dispatcherTimer.Stop();