Zeitplan mit ScheduleJobs aufrufen

Ich habe versucht, herauszufinden, wie man die ScheduleJobs-Methoden in Quartz.Net aufruft, aber ich habe Mühe, die richtigen Parameter zu erstellen, die es erwartet.

Folgendes habe ich versucht:

IJobDetail jobDetail = JobBuilder.Create<ReportJob>()
    .WithIdentity("theJob")
    .Build();
ITrigger everydayTrigger = TriggerBuilder.Create()
    .WithIdentity("everydayTrigger")
    // fires 
    .WithCronSchedule("0 0 12 1/1 * ?")
    // start immediately
    .StartAt(DateBuilder.DateOf(DateTime.Now.Hour, DateTime.Now.Minute, DateTime.Now.Second, DateTime.Now.Day, DateTime.Now.Month, DateTime.Now.Year))
    .Build();
ITrigger yearlyTrigger = TriggerBuilder.Create()
    .WithIdentity("yearlyTrigger")
    // fires 
    .WithCronSchedule("0 0 12 1 1 ? *")
    // start immediately
    .StartAt(DateBuilder.DateOf(DateTime.Now.Hour, DateTime.Now.Minute, DateTime.Now.Second, DateTime.Now.Day, DateTime.Now.Month, DateTime.Now.Year))
    .Build();
var dictionary = new Dictionary<IJobDetail, ISet<ITrigger>>();
dictionary.Add(jobDetail, new HashSet<ITrigger>() { everydayTrigger, yearlyTrigger });
sched.ScheduleJobs((dictionary, true); // is a cast possible here to IDictionary?

Andere Versuche;

sched.ScheduleJobs(new [] { jobDetail, new[] { afternoonTrigger } }, true);

&&

sched.ScheduleJobs(new[] { new KeyValuePair<IJobDetail, ITrigger>()}.ToDictionary<IJobDetail, Quartz.Collection.ISet<ITrigger>(), true);

Antworten auf die Frage(1)

Ihre Antwort auf die Frage