定时器实现

 因功能需求,需要在页面显示实时时间

 1 private void OnTimerCallback(Object obj)
 2         {
 3             po_SvrTime = po_SvrTime.AddSeconds(1);
 4 
 5             this.Dispatcher.BeginInvoke(System.Windows.Threading.DispatcherPriority.Normal,
 6 
 7             (System.Threading.ThreadStart)delegate()
 8             {
 9                 //(你的定时处理) 
10                 labSvcTime.Content = po_SvrTime.ToString("HH:mm:ss");
11                 //label4.Content = po_SvrTime.ToString("HH");
12                 //textBox1.Text = po_SvrTime.ToString("mm");
13             });
14         }
View Code
原文地址:https://www.cnblogs.com/aDoc/p/12870674.html