I'm trying to find a simple Quartz.Net example where when a button is clicked, it kicks off the Quartz.Net functionality.

I was able to take the Quartz.Net example (console application) and change some things to produce this (SimpleExample.cs):

    public virtual void Run()
    {
        ISchedulerFactory sf = new StdSchedulerFactory();
        IScheduler sched = sf.GetScheduler();

        DateTimeOffset runTime = DateBuilder.EvenMinuteDate(DateTime.UtcNow);
        DateTimeOffset startTime = DateBuilder.NextGivenSecondDate(null, 10);

        IJobDetail job = JobBuilder.Create<HelloJob>()
            .WithIdentity("job1", "group1")
            .Build();
        ITrigger trigger = TriggerBuilder.Create()
            .WithIdentity("trigger1", "group1")
            .StartAt(runTime)
            .WithCronSchedule("5 0/1 * * * ?")
            .Build();

        sched.ScheduleJob(job, trigger);

        sched.Start();

    }

But I'm a little confused as to how one triggers this from a button click. I thought I could do something like this:

    private void button1_Click(object sender, EventArgs e)
    {
     code here....
    }

But that didn't work.

I reviewed the following websites, but not all were helpful in relation to starting this from a button click.

http://www.mkyong.com/java/quartz-scheduler-example/ - Java, so hard for me to understand the difference (I'm new to all this!).

http://www.hardcodet.net/2010/01/lightweight-task-slash-job-scheduling-with-silverlight-support - This was helpful, but it is unclear to me how Silverlight works with a regular .Net Form. Seems like an entirely different project.

/////

Additional changes: 1

Edit
Report