You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
59 lines
1.3 KiB
59 lines
1.3 KiB
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);
|
|
}
|
|
}
|
|
|
|
|
|
}
|
|
}
|