现在的位置: 首页 > 综合 > 正文

可在WP7中运行的定时器

2013年12月11日 ⁄ 综合 ⁄ 共 405字 ⁄ 字号 评论关闭
        public void StartTimer()
        {
            //新建并启动定时器
            System.Windows.Threading.DispatcherTimer myDispatcherTimer = new System.Windows.Threading.DispatcherTimer();
            myDispatcherTimer.Interval = new TimeSpan(0, 0, 0, 0, 100); // 100 Milliseconds 
            myDispatcherTimer.Tick += new EventHandler(Each_Tick);
            myDispatcherTimer.Start();
        }

响应定时事件

 // Raised every 100 miliseconds while the DispatcherTimer is active.
        public void Each_Tick(object o, EventArgs sender)
        {
..........
        }

抱歉!评论已关闭.