4

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

Vince
  • 118
  • 1
  • 6

2 Answers2

5

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);
    }
sgmoore
  • 15,694
  • 5
  • 43
  • 67
  • If I use calendar to exclude dates, those dates still show up in the for loop. Any idea how to get a list without those? – Vince Aug 16 '13 at 20:43
2

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.

Mário Meyrelles
  • 1,594
  • 21
  • 26