Silverlight的DispatcherTimer計時器

摘要:Silverlight的DispatcherTimer計時器

在Silverlight可以改用DispatcherTimer的物件來達成記時的功能,用法跟Windows Form的Timer幾乎相同,如下面的範例:
DispatcherTimer t = new DispatcherTimer();
t.Interval = new TimeSpan(0, 0, 1);
t.Tick += new EventHandler(RefreshData);
t.Start();
.......

private void RefreshData(object sender, EventArgs e)
{         
    //TODO
}