testjob.cs 918 B

123456789101112131415161718192021222324252627282930313233343536373839
  1. using System;
  2. using System.Collections.Generic;
  3. using System.Linq;
  4. using System.Text;
  5. using System.Threading.Tasks;
  6. using Quartz;
  7. using System.Diagnostics;
  8. using log4net;
  9. using System.Windows.Forms;
  10. namespace TimeSchedule
  11. {
  12. public class testjob1 : IJob
  13. {
  14. private static readonly ILog Logger = LogManager.GetLogger(typeof(testjob1));
  15. public void Execute(IJobExecutionContext context)
  16. {
  17. //MessageBox.Show("AAA");
  18. Logger.Info("TestJob1测试");
  19. int i = 10;
  20. }
  21. }
  22. //单实例运行
  23. [DisallowConcurrentExecution]
  24. public class testjob2 : IJob
  25. {
  26. private static readonly ILog Logger = LogManager.GetLogger(typeof(testjob2));
  27. public void Execute(IJobExecutionContext context)
  28. {
  29. //MessageBox.Show("BBB");
  30. Logger.Info("TestJob2测试");
  31. int i = 10;
  32. }
  33. }
  34. }