12345678910111213141516171819202122232425262728293031323334353637383940414243444546 |
- using Quartz;
- using Quartz.Impl;
- using System;
- using System.Collections.Generic;
- using System.Linq;
- using System.Text;
- using Topshelf;
- namespace TimedUpload
- {
- public class ServiceRunner : ServiceControl, ServiceSuspend
- {
- private readonly IScheduler scheduler;
- public ServiceRunner()
- {
- scheduler = StdSchedulerFactory.GetDefaultScheduler();
- }
- public bool Start(HostControl hostControl)
- {
- scheduler.Start();
- return true;
- }
- public bool Stop(HostControl hostControl)
- {
- scheduler.Shutdown(false);
- return true;
- }
- public bool Continue(HostControl hostControl)
- {
- scheduler.ResumeAll();
- return true;
- }
- public bool Pause(HostControl hostControl)
- {
- scheduler.PauseAll();
- return true;
- }
- }
- }
|