using Quartz; using Quartz.Impl; using RDIFramework.Utilities; using System; using System.Collections.Generic; using System.Configuration; using System.Data; using System.IO; using System.Linq; using System.Text; using Topshelf; namespace TimedUpload { class Program { static void Main(string[] args) { log4net.Config.XmlConfigurator.ConfigureAndWatch(new FileInfo(AppDomain.CurrentDomain.BaseDirectory + "log4net.config")); try { HostFactory.Run(x => { x.UseLog4Net(); x.Service(); x.SetDescription("wwkj-DABusinessData"); x.SetDisplayName("wwkj-DABusinessData"); x.SetServiceName("wwkj-DABusinessData"); x.EnablePauseAndContinue(); }); //SystemConfig.dbConnectionStr = ConfigurationManager.AppSettings["dbConnection"]; //DataUploadService uploadService = new DataUploadService(); ////uploadService.AddJobTrigger(job, trigger); //uploadService.Start(); } catch (Exception ex) { Console.Write(ex.Message); } } } public class DataUploadService { private readonly IScheduler scheduler; public DataUploadService() { scheduler = StdSchedulerFactory.GetDefaultScheduler(); } public bool Start() { scheduler.Start(); return true; } public bool Stop() { scheduler.Shutdown(false); return true; } public bool Continue() { scheduler.ResumeAll(); return true; } public bool Pause() { scheduler.PauseAll(); return true; } public bool AddJobTrigger(IJobDetail jobDetail, ITrigger trigger) { if (scheduler != null) { scheduler.ScheduleJob(jobDetail, trigger); } return true; } } }