using cuidian.Common; using Quartz; using Quartz.Impl; using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; using TaskSchedule; namespace ConsoleApplication2 { class DemoU8_to_Wang { //测试 public static void aa() { //using (System.IO.StreamWriter sw = new System.IO.StreamWriter("C:\\log.txt", true)) //{ // sw.WriteLine(DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss ") + "aa()."); //} ISchedulerFactory sf = new StdSchedulerFactory(); IScheduler scheduler = sf.GetScheduler(); //创建调度实例 //创建任务实例 IJobDetail job = JobBuilder.Create().WithIdentity(new JobKey("job1")).Build(); //创建触发器实例"0 0 10 * * ? " ITrigger trigger = TriggerBuilder.Create().StartAt(DateTime.Now.AddSeconds(0)).WithCronSchedule(AppSeting.Instance.GetValue("U8_To_Wang")).Build(); scheduler.ScheduleJob(job, trigger); //绑定触发器和任务 scheduler.Start(); //启动监控 } public static void bb() { ISchedulerFactory sf = new StdSchedulerFactory(); IScheduler scheduler = sf.GetScheduler(); //创建调度实例 //创建任务实例 IJobDetail job = JobBuilder.Create().WithIdentity(new JobKey("job3")).Build(); //IJobDetail job = JobBuilder.Create().WithIdentity(new JobKey("job2")).Build(); //创建触发器实例 ITrigger trigger = TriggerBuilder.Create().StartAt(DateTime.Now.AddSeconds(0)).WithCronSchedule(AppSeting.Instance.GetValue("Wang_To_U8")).Build(); scheduler.ScheduleJob(job, trigger); //绑定触发器和任务 scheduler.Start(); //启动监控 } } }