Quartz scheduler: avoid using class file and want to call a method directly

痞子三分冷 提交于 2020-01-07 02:17:06

问题


I am using quartz scheduler in my project. I have copy pasted my code below.In this area of code, Type type=typeof(class), I need to call a method like, Type type=typeof(methodname()). I dont want to call an external class file.

int JobID = 0;
JobDetailImpl job = null;
Quartz.Impl.Triggers.CronTriggerImpl trigger = null;
ISimpleTrigger simpleTrigger = null;
JobDataMap jobdatamap = new JobDataMap();
sheduler.Start();
String cronExpression = "0 0/1 * * * ?";
Type type = typeof(TriggerJob1);
job = new JobDetailImpl("Job" + JobID + "", null, type);
trigger = new Quartz.Impl.Triggers.CronTriggerImpl("Trigger" + JobID + "", "Job" + JobID + "", cronExpression);
sheduler.ScheduleJob(job, trigger); 

TriggerJob1 in the above code is a class file which I created locally. According to quartz scheduler, it has the functionality that scheduler calls at its scheduled time.

why i want to use a method instead of Triggerjob1 class file is:- I am using quartz scheduler in aspx file. I have all functionality written in a button click event. I am going to invoke this button by using scheduler.

I want to use like this. This is my expected behaviour.

Type type = typeof(button_click);

I do not want to call this button click from external class file. But the syntax of quartz scheduler advices me to use a class file only.

Kindly help me if anyone know it. If anyone cannot understand me what I am saying, please let me know.

来源:https://stackoverflow.com/questions/39376807/quartz-scheduler-avoid-using-class-file-and-want-to-call-a-method-directly

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!