有一个伪装,与你完全一样,他发表了一个博客职位,其典型例子是Quartz.net Console的申请。
The following is a working Quartz.net example that is based against Quartz.net 2.0 (Latest). 这项工作是写出一个文字信息,即“就业”每5名未成年人在青少年中完成。
启动2012年视觉演播室项目。 。 页: 1
Requirements
Download Quartz.NET
assembly using NuGet
. Right click on project, select “Manage Nuget Packages”. Then search for Quartz.NET
. Once found select and install.
using System;
using System.Collections.Generic;
using Quartz;
using Quartz.Impl;
namespace Quartz1
{
class Program
{
static void Main(string[] args)
{
// construct a scheduler factory
ISchedulerFactory schedFact = new StdSchedulerFactory();
// get a scheduler, start the schedular before triggers or anything else
IScheduler sched = schedFact.GetScheduler();
sched.Start();
// create job
IJobDetail job = JobBuilder.Create<SimpleJob>()
.WithIdentity("job1", "group1")
.Build();
// create trigger
ITrigger trigger = TriggerBuilder.Create()
.WithIdentity("trigger1", "group1")
.WithSimpleSchedule(x => x.WithIntervalInSeconds(5).RepeatForever())
.Build();
// Schedule the job using the job and trigger
sched.ScheduleJob(job, trigger);
}
}
/// <summary>
/// SimpleJOb is just a class that implements IJOB interface. It implements just one method, Execute method
/// </summary>
public class SimpleJob : IJob
{
void IJob.Execute(IJobExecutionContext context)
{
//throw new NotImplementedException();
Console.WriteLine("Hello, JOb executed");
}
}
}
Sources