Next: IScheduledEvents;
The Next method returns parameters of the task execution events scheduled for future. The event data is calculated accounting the specified schedule.
Executing the example requires that the repository contains a scheduled tasks container with the TASK_CONTAINTER identifier.
Sub Main;
Var
MB: IMetabase;
Cont: IScheduledTasksContainer;
Invoke: IScheduledInvoke;
Events: IScheduledEvents;
TaskEvent: IScheduledEvent;
i: Integer;
Begin
MB := MetabaseClass.Active;
Cont := MB.ItemById("TASK_CONTAINTER").Bind As IScheduledTasksContainer;
Invoke := Cont.CreateInvokeEvent(DateTime.Now);
//Tasks execution events scheduled for the near future
Debug.WriteLine("Immediate launching");
Events := Invoke As IScheduledEvents;
For i := 0 To Events.Count - 1 Do
TaskEvent := Events.Item(i);
Debug.WriteLine(TaskEvent.StartDateTime);
End For;
Debug.WriteLine("Next");
//Next scheduled event
Debug.WriteLine("Next launching");
Events := Invoke.Next;
For i := 0 To Events.Count - 1 Do
TaskEvent := Events.Item(i);
Debug.WriteLine(TaskEvent.StartDateTime);
End For;
End Sub Main;
After executing the example the events of execution of the tasks in the scheduled tasks container are created. The date and time of the immediate launching of all tasks and the date and time of the next launching taking into account the schedule of each task are displayed in the development environment console.
See also: