C# Timer实现实时监听

private void btnStartNDI_Click(object sender, EventArgs e)
        {
                       
            myTimer1.Tick += new EventHandler(TimerEventProcessor);

            myTimer1.Interval = 1000;
            myTimer1.Start();
            
            while (exitFlag == false)
            {
                Application.DoEvents();
            }
        }

        public void TimerEventProcessor(Object myObject,EventArgs myEventArgs)
        {
            alarmCounter += 1;
            myTimer1.Stop();
            myTimer1.Enabled = true;
        }

 

posted @ 2013-01-21 20:21  louiskoo  阅读(2192)  评论(0编辑  收藏  举报