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.
54 lines
1.2 KiB
54 lines
1.2 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;
|
|
|
|
|
|
namespace QMHTIS.HisService
|
|
{
|
|
partial class HisService : ServiceBase
|
|
{
|
|
public HisService()
|
|
{
|
|
InitializeComponent();
|
|
}
|
|
private static ServiceManager _manager = null;
|
|
protected override void OnStart(string[] args)
|
|
{
|
|
// TODO: 在此处添加代码以启动服务。
|
|
try
|
|
{
|
|
|
|
//System.Threading.Thread.Sleep(20000);
|
|
|
|
//定义服务管理者
|
|
_manager = new ServiceManager();
|
|
|
|
//启动服务
|
|
_manager.Start();
|
|
|
|
//Console.ReadLine();
|
|
|
|
//停止服务
|
|
//_manager.Stop();
|
|
}
|
|
catch (Exception ex)
|
|
{
|
|
|
|
//停止服务
|
|
_manager.Stop();
|
|
|
|
Console.WriteLine(ex.Message);
|
|
}
|
|
}
|
|
|
|
protected override void OnStop()
|
|
{
|
|
// TODO: 在此处添加代码以执行停止服务所需的关闭操作。
|
|
}
|
|
}
|
|
}
|
|
|