using System; using System.Collections.Generic; using System.ComponentModel; using System.Data; using System.Diagnostics; using System.Linq; using System.ServiceProcess; using System.Text; using System.Runtime.InteropServices; using System.Threading; using Quartz; using Quartz.Impl; namespace SiaSun.LMS.WinService { public partial class WMSService : ServiceBase { static ISchedulerFactory schedulerFactory = new StdSchedulerFactory(); static IScheduler scheduler; public WMSService() { InitializeComponent(); } protected override void OnStart(string[] args) { try { ServiceHostGroup.StartAllConfiguredServices(); scheduler = schedulerFactory.GetScheduler(); scheduler.Start(); } catch (Exception ex) { Program.sysLog.Info("服务启动异常。"+ex.Message); } } protected override void OnStop() { try { ServiceHostGroup.CloseAllServices(); scheduler.Shutdown(); } catch (Exception ex) { Program.sysLog.Info("停止服务异常。" + ex.Message); } } } }