麦田

不积跬步无以至千里.

  博客园 :: 首页 :: 博问 :: 闪存 :: 新随笔 :: 联系 :: 订阅 订阅 :: 管理 ::
定时器事件代码 
static void Main(string[] args)
{
         Method();
         #region 定时器事件 
         Timer aTimer = new Timer();
         aTimer.Elapsed += new ElapsedEventHandler(TimedEvent);
         aTimer.Interval = seconds * 1000;    //配置文件中配置的秒数
         aTimer.Enabled = true;
         #endregion
         string strLine;
         do
         {
              strLine = Console.ReadLine();
         } while (strLine != null && strLine != "exit");

}  
private static void TimedEvent(object source, ElapsedEventArgs e)
{
    Method();
}

 

posted on 2012-12-14 21:09  一些记录  阅读(3850)  评论(1)    收藏  举报