Exemple #1
0
        static void Main(string[] args)
        {
            dl = new DealEvent();
            SentMsg    sm = new SentMsg(dl);
            SendWeChat sw = new SendWeChat(dl);

            dt    = new DateTime[3];
            dt[0] = DateTime.Now.AddSeconds(5);
            dt[1] = DateTime.Now.AddSeconds(10);
            dt[2] = DateTime.Now.AddSeconds(15);

            mt[0] = "123"; mt[1] = "456"; mt[2] = "123";
            ut[0] = "啦啦"; ut[1] = "卡卡"; ut[2] = "嘻嘻";

            aTimer = new System.Timers.Timer(10000);

            //注册计时器的事件
            aTimer.Elapsed += new ElapsedEventHandler(OnTimedEvent);

            //设置时间间隔为1秒(1000毫秒),覆盖构造函数设置的间隔
            aTimer.Interval = 1000;

            //设置是执行一次(false)还是一直执行(true),默认为true
            aTimer.AutoReset = true;

            //开始计时
            aTimer.Enabled = true;
            Console.WriteLine("按任意键退出程序。");
            Console.ReadLine();
        }
Exemple #2
0
 public SentMsg(DealEvent dl)
 {
     dl.dealMsg += SentOndMsg;
 }
Exemple #3
0
 public SendWeChat(DealEvent dl)
 {
     dl.dealMsg += SentOndWeChat;
 }