SHARE
TWEET

Untitled

a guest Feb 19th, 2019 58 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. public class Global : HttpApplication
  2. {
  3.     public static StdSchedulerFactory SchedulerFactory;
  4.     public static IScheduler Scheduler;
  5.     public static ITrigger ImageTrigger;
  6.  
  7.     protected void Application_Start(object sender, EventArgs e)
  8.     {
  9.         SchedulerFactory = new StdSchedulerFactory();
  10.         Scheduler = SchedulerFactory.GetScheduler();
  11.  
  12.         Scheduler.Start();
  13.  
  14.         ImageTrigger = TriggerBuilder.Create()
  15.                                      .WithIdentity("ImageTrigger", "Group1")
  16.                                      .StartNow()
  17.                                      .WithSimpleSchedule(x => x.RepeatForever().WithIntervalInMinutes(5))
  18.                                      .Build();
  19.  
  20.         var imageJob = JobBuilder.Create<DownloadImages>()
  21.                                      .WithIdentity("DownloadImages" , "Group1")
  22.                                      .Build();
  23.         Scheduler.ScheduleJob(imageJob, ImageTrigger);
  24.     }
  25. ...
  26. }
  27.    
  28. AlertTrigger = TriggerBuilder.Create()
  29.                                      .WithIdentity("AlertTrigger", "Group1")
  30.                                      .StartNow()
  31.                                      .WithCronSchedule("0 0/1 * * * ?")
  32.                                      .Build();
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top