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 UserProc;
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);
//Task execution events scheduled in the nearest time
Debug.WriteLine("Nearest start");
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 events
Debug.WriteLine("Next start");
Events := Invoke.Next;
For i := 0 To Events.Count - 1 Do
TaskEvent := Events.Item(i);
Debug.WriteLine(TaskEvent.StartDateTime);
End For;
End Sub UserProc;
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: