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

Était-ce utile?

La 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);
    }

Autres conseils

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.

Licencié sous: CC-BY-SA avec attribution
Non affilié à StackOverflow
scroll top