Cyberiafreak

"Fortunate are those who take the first steps.” ― Paulo Coelho

What is DispatcherTimer in WPF?

For WPF applications,
there is a new type of timer that utilizes the Dispatcher—the DispatcherTimer class. Like other timers, the DispatcherTimer class supports specifying an interval between ticks as well as the code to run when the timer’s event fires. You can see a fairly pedestrian use of the DispatcherTimer.
_timer = new DispatcherTimer();
_timer.Interval = TimeSpan.FromMilliseconds(2000); 
_timer.Tick += new EventHandler(delegate(object s, EventArgs a) 
{ 
    statusText.Text = string.Format(
        "Timer Ticked:  {0}ms", Environment.TickCount); 
});
_timer.Start();
src: http://msdn.microsoft.com/en-us/magazine/cc163328.aspx

 


Advertisements

July 13, 2011 - Posted by | Uncategorized

No comments yet.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: