首页 > 技术文章 > c# 定时器

jhuang-com 2016-12-15 17:31 原文

        private static System.Windows.Threading.DispatcherTimer readDataTimer = null; //用于触发定时器

 

                //倒计时
                readDataTimer = new System.Windows.Threading.DispatcherTimer();
                readDataTimer.Tick += new EventHandler(ShowLayer);
                readDataTimer.Interval = new TimeSpan(0, 0, 0, 2);
                readDataTimer.Start();

 

       private void CountDown(object sender, EventArgs e)
          {

      //写你需要执行的代码

      }

 

推荐阅读