Is there anytihng in WP7.5 like NSTimer in iOS where I can set a method to call once, or repeatedly at a set interval.
Many Thanks, -Code
System.Windows.Threading.DispatcherTimer dt = new System.Windows.Threading.DispatcherTimer();
dt.Interval = TimeSpan.FromMilliseconds(500);
dt.Tick +=new EventHandler(dt_Tick);
void dt_Tick(object sender, EventArgs e)
{
//code
}
and
dt.start() ;
dt.stop() ;
Depending on what you're trying to do, you'll want to use:
Timer
, if you want to start a 'simple' background task : http://msdn.microsoft.com/en-us/library/system.threading.timer%28v=vs.95%29.aspx
DispatcherTimer
, if you want to modify the UI: http://msdn.microsoft.com/en-us/library/system.windows.threading.dispatchertimer%28v=vs.95%29.aspx
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.