Question

In version 1 we have computeFireTimes which will returns a list of Dates that are the next fire times of a Trigger

Is there a way to do the same thing in version 2

Was it helpful?

Solution

Use GetNextFireTimeUtc and GetFireTimeAfter ,

eg

    var dt = trigger.GetNextFireTimeUtc();

    for (int i = 0; i < 10; i++)
    {
        if (dt == null)
             break;

        Console.WriteLine(dt.Value.ToLocalTime());

        dt = trigger.GetFireTimeAfter(dt);
    }

OTHER TIPS

Another option:

var times = TriggerUtils.ComputeFireTimes(trigger as IOperableTrigger, null, 10); 
foreach (var time in times) Debug.WriteLine(time.ToLocalTime());

This will return the next 10 fire times.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top