public static void Register(this ScheduleTimer timer, string key, IScheduledRule rule, Delegate @delegate, params object[] args) { IScheduledItem scheduledItem = SchedulerFactory.Provider(rule); if (scheduledItem == null) { return; } timer.AddAsyncTask(key, scheduledItem, @delegate, args); }
public static IScheduledItem Provider(IScheduledRule rule) { IScheduledItem result; if (rule is ScheduledBlockIntervalRule) { ScheduledBlockIntervalRule rule2 = rule as ScheduledBlockIntervalRule; result = SchedulerFactory.BlockIntervalRule(rule2); } else { if (rule is ScheduledBlockTimerRule) { ScheduledBlockTimerRule rule3 = rule as ScheduledBlockTimerRule; result = SchedulerFactory.BlockTimerRule(rule3); } else { ScheduledRule rule4 = rule as ScheduledRule; result = SchedulerFactory.BaseRule(rule4); } } return(result); }