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.
48 lines
1.2 KiB
48 lines
1.2 KiB
using FY.TaskScheduler;
|
|
using Topshelf;
|
|
|
|
namespace SmartCamp.TaskServer.Topshelf
|
|
{
|
|
public class ServiceRunner : ServiceControl, ServiceSuspend
|
|
{
|
|
Job.MyTask task;
|
|
|
|
public ServiceRunner()
|
|
{
|
|
TaskJobManager.Initialize();
|
|
task=new Job.MyTask();
|
|
task.Init();
|
|
//LogManager.WriteInfo("初始化服务");
|
|
}
|
|
|
|
public bool Start(HostControl hostControl)
|
|
{
|
|
TaskJobManager.StartTask();
|
|
//LogManager.WriteInfo("开始服务");
|
|
return true;
|
|
}
|
|
public bool ReStart(HostControl hostControl)
|
|
{
|
|
TaskJobManager.StartTask();
|
|
return true;
|
|
}
|
|
public bool Stop(HostControl hostControl)
|
|
{
|
|
TaskJobManager.StopTask();
|
|
//LogManager.WriteInfo("停止服务");
|
|
return true;
|
|
}
|
|
|
|
public bool Continue(HostControl hostControl)
|
|
{
|
|
TaskJobManager.StartTask();
|
|
return true;
|
|
}
|
|
|
|
public bool Pause(HostControl hostControl)
|
|
{
|
|
TaskJobManager.StopTask();
|
|
return true;
|
|
}
|
|
}
|
|
}
|
|
|