Esempio n. 1
0
 private static void RegisterSynDateService(WindowsServiceItemCollection timerServices)
 {
     try
     {
         const double interval  = 1000;
         var          sendTimer = new WindowsTimer("SendSynDataInterval", interval);
         timerServices.Add(sendTimer, typeof(SysDataToDataBase));
     }
     catch (Exception ex)
     {
         Console.Write(ex);
         WriterLog(ex.ToString(), "error");
     }
 }
Esempio n. 2
0
        static void Main(string[] args)
        {
            try
            {
                AppDomain.CurrentDomain.UnhandledException += new UnhandledExceptionEventHandler(CurrentDomain_UnhandledException);
                var timerServices = new WindowsServiceItemCollection();

                RegisterSendSmsService(timerServices);
                RegisterSynDateService(timerServices);
                WindowsServiceHelper.RunServices(timerServices, WindowsServiceTimerExceptionCallBack);
            }
            catch (Exception ex)
            {
                WriterLog(ex.ToString(), "error");
            }
        }
Esempio n. 3
0
 static void RegisterSendSmsService(WindowsServiceItemCollection timerServices)
 {
     #region 发送短信服务
     try
     {
         const double interval  = 1000;
         var          sendTimer = new WindowsTimer("SendSMSInterval", interval);
         timerServices.Add(sendTimer, typeof(SendSmsCommand));
     }
     catch (Exception ex)
     {
         Console.Write(ex);
         WriterLog(ex.ToString(), "error");
     }
     #endregion
 }