Quartz. Net Study Notes (1)-complete example, quartz.net Study Notes
I. Development Environment
System: Win10
Compiler: VS2013
. Net: 4.5
Quartz version: 2.3.3
Ii. Assembly
Common. Logging. Core. dll
Common. Logging. dll
Quartz. dll
Iii. Project Structure
Namespace QuartzNet. jobs {public class JobGetNowTime: IJob {public void Execute (IJobExecutionContext context) {Console. writeLine (DateTime. now. toString ("yyy-MM-dd hh: mm: ss "));}}}3. Start using the scheduling framework
Namespace QuartzNet {class Program {/// <summary> // the function of the following Program is to output the current time per second, execute 10 times /// </summary> /// <param name = "args"> </param> static void Main (string [] args) {// 1.0 create the scheduling factory ISchedulerFactory factory = new StdSchedulerFactory (); // 2.0 obtain the scheduler instance IScheduler scheduler = factory through the factory. getScheduler (); // 3.0 construct Job IJobDetail job = JobBuilder through JobBuilder. create <JobGetNowTime> (). build (); // 4.0 TriggerBuilder to Build Trigger ISimpleTrigger trigger = (ISimpleTrigger) TriggerBuilder. create (). withSimpleSchedule (a =>. withIntervalInSeconds (1 ). withRepeatCount (10 )). build (); // 5.0 assemble each component <Job, Trigger> scheduler. scheduleJob (job, trigger); // 6.0 start scheduler. start (); Thread. sleep (10000); // 7.0 destroy the built-in Job and Trigger scheduler. shutdown (true); Console. readKey ();}}}4. view results
V. References
Http://blog.csdn.net/chenweitang123/article/details/37777399