using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; using Topshelf; namespace JobApplication { class Program { static void Main(string[] args) { HostFactory.Run(x => { x.Service(s => { s.ConstructUsing(name => new QuartzService()); //开启和关闭 必选项 s.WhenStarted(tc => tc.Start()); s.WhenStopped(tc => tc.Stop()); // optional pause/continue methods if used // 暂停和继续 选填 s.WhenPaused(tc => tc.Pause()); s.WhenContinued(tc => tc.Continue()); //optional, when shutdown is supported //s.WhenShutdown(tc => tc.Shutdown()); }); x.RunAsLocalSystem(); x.SetDescription("同步收银机端结账表数据,固化结账单中移动支付实际银行到账金额");//借助TopSelf将Quartz发布成服务 x.SetDisplayName("同步工具"); x.SetServiceName("JobApplication"); }); } } }