Time_U8_to_Wang.cs 4.2 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283
  1. using cuidian.Common;
  2. using Quartz;
  3. using Quartz.Impl;
  4. using System;
  5. using System.Collections.Generic;
  6. using System.Linq;
  7. using System.Text;
  8. using System.Threading.Tasks;
  9. using TaskSchedule;
  10. namespace TimeSchedule
  11. {
  12. public class Time_U8_to_Wang
  13. {
  14. public static void GoU8_to_Wang()
  15. {
  16. ISchedulerFactory sf = new StdSchedulerFactory();
  17. IScheduler scheduler = sf.GetScheduler(); //创建调度实例
  18. //创建任务实例
  19. IJobDetail job = JobBuilder.Create<U8_to_Wang>().WithIdentity(new JobKey("job1")).Build();
  20. //创建触发器实例
  21. ITrigger trigger = TriggerBuilder.Create().StartAt(DateTime.Now.AddSeconds(0)).WithCronSchedule(AppSeting.Instance.GetValue("U8_To_Wang")).Build();
  22. scheduler.ScheduleJob(job, trigger); //绑定触发器和任务
  23. scheduler.Start(); //启动监控
  24. }
  25. //public static void GoEndU8_to_Wang()
  26. //{
  27. // ISchedulerFactory sf = new StdSchedulerFactory();
  28. // IScheduler scheduler = sf.GetScheduler(); //创建调度实例
  29. // 创建任务实例
  30. // IJobDetail job = JobBuilder.Create<EndU8_to_Wang>().WithIdentity(new JobKey("job2")).Build();
  31. // 创建触发器实例
  32. // ITrigger trigger = TriggerBuilder.Create().StartAt(DateTime.Now.AddSeconds(0)).WithCronSchedule(AppSeting.Instance.GetValue("U8_To_Wang")).Build();
  33. // scheduler.ScheduleJob(job, trigger); //绑定触发器和任务
  34. // scheduler.Start(); //启动监控
  35. //}
  36. public static void GoWang_to_U8()
  37. {
  38. ISchedulerFactory sf = new StdSchedulerFactory();
  39. IScheduler scheduler = sf.GetScheduler(); //创建调度实例
  40. IJobDetail job = JobBuilder.Create<Wang_to_U8>().WithIdentity(new JobKey("job2")).Build();
  41. //创建触发器实例"0 0 10 * * ? "
  42. ITrigger trigger = TriggerBuilder.Create().StartAt(DateTime.Now.AddSeconds(0)).WithCronSchedule(AppSeting.Instance.GetValue("Wang_To_U8")).Build();
  43. scheduler.ScheduleJob(job, trigger); //绑定触发器和任务
  44. scheduler.Start(); //启动监控
  45. }
  46. //public static void GoWang_to_U8Two()
  47. //{
  48. // ISchedulerFactory sf = new StdSchedulerFactory();
  49. // IScheduler scheduler = sf.GetScheduler(); //创建调度实例
  50. // IJobDetail job = JobBuilder.Create<Wang_to_U8Two>().WithIdentity(new JobKey("job3")).Build();
  51. // //创建触发器实例"0 0 10 * * ? "
  52. // ITrigger trigger = TriggerBuilder.Create().StartAt(DateTime.Now.AddSeconds(0)).WithCronSchedule("0 0 2 * * ? ").Build();
  53. // scheduler.ScheduleJob(job, trigger); //绑定触发器和任务
  54. // scheduler.Start(); //启动监控
  55. //}
  56. //public static void GoWang_to_U8Three()
  57. //{
  58. // ISchedulerFactory sf = new StdSchedulerFactory();
  59. // IScheduler scheduler = sf.GetScheduler(); //创建调度实例
  60. // IJobDetail job = JobBuilder.Create<Wang_to_U8>().WithIdentity(new JobKey("job2")).Build();
  61. // //创建触发器实例"0 0 10 * * ? "
  62. // ITrigger trigger = TriggerBuilder.Create().StartAt(DateTime.Now.AddSeconds(0)).WithCronSchedule("0 0 4 * * ? ").Build();
  63. // scheduler.ScheduleJob(job, trigger); //绑定触发器和任务
  64. // scheduler.Start(); //启动监控
  65. //}
  66. //public static void GoEndWang_to_U8()
  67. //{
  68. // ISchedulerFactory sf = new StdSchedulerFactory();
  69. // IScheduler scheduler = sf.GetScheduler(); //创建调度实例
  70. // //创建任务实例
  71. // IJobDetail job = JobBuilder.Create<EndWang_to_U8>().WithIdentity(new JobKey("job4")).Build();
  72. // //创建触发器实例"0 0 0/4 * * ?"
  73. // ITrigger trigger = TriggerBuilder.Create().StartAt(DateTime.Now.AddSeconds(0)).WithCronSchedule(AppSeting.Instance.GetValue("Wang_To_U8")).Build();
  74. // scheduler.ScheduleJob(job, trigger); //绑定触发器和任务
  75. // scheduler.Start(); //启动监控
  76. //}
  77. }
  78. }