Quartz is opensymphony Open source organization in the Job scheduling field another open-source project, Quartz.net is the transplant version of Quartz. Quartz can be used to create a simple or complex program that runs 10, hundreds, or even tens of thousands of jobs.
Official website Tutorial: http://www.quartz-scheduler.net/documentation/index.html
Advantages:
1. Full, start time, interval, number, end time can be specified.
2. Convenient. There is no need to consider a variety of threading issues.
Download:
Install-package Quartz
Development:
1.job 2.trigger 3.scheduler
Job: A task item that defines what to do
Implement the Ijob interface. There is only one way.
class Samplejob:ijob { publicvoid Execute (ijobexecutioncontext context) { File.appendalltext ( "D:\\1.txt" "good"); } }
Trigger: Trigger that defines how many times to execute .
Constructor: Public Simpletriggerimpl (string name, String group, DateTimeOffset STARTTIMEUTC, DateTimeOffset? ENDTIMEUTC, int RepeatCount, TimeSpan repeatinterval);
The ctor can be used to invoke a new trigger
Scheduler: Scheduler, scheduling triggers and tasks to combine
var New stdschedulerfactory (); var sched = Factory. Getscheduler ();
Perform:
A. Wrap the ijob into Ijobdetail, through the public Jobdetailimpl (string name, Type jobType);
B. Call the IScheduler interface scheduling method: DateTimeOffset schedulejob (Ijobdetail jobdetail, Itrigger Trigger);
C. Call the IScheduler interface Start method: void Start (), or void startdelayed (TimeSpan delay);
Stop it:
Call IScheduler interface Start method: void Shutdown ();
code Download: Click to download
Microsoft Windows Services (3) Use quartz.net timed tasks