Event occurrence is traced with task scheduler interface is used to work with the events collection. In this case the task container specified in task scheduler settings should contain tasks run on occurring the configured event.
An event may occur after executing a task if the corresponding setup is created for it. An event can also be generated from application code. The IMetabaseCustomForeEvents interface is used to work with the events collection. To generate an event, get its description by means of properties or methods of the specified interface, and execute the IMetabaseCustomForeEvent.Invoke method.
The example of generating event named Loading Start. If on performing the example the task scheduler is run, and the container, with which the task scheduler works, has tasks started on executing this event, they will be performed.
Sub InvokeEvent; Var MB: IMetabase; CustomClassExtender: IMetabaseCustomExtender; Events: IMetabaseCustomForeEvents; ForeEvent: IMetabaseCustomForeEvent; Begin MB := MetabaseClass.Active; //Get user class container CustomClassExtender := Mb.SpecialObject(MetabaseSpecialObject.CustomExtender).Edit As IMetabaseCustomExtender; //Get events list Events := CustomClassExtender.Events; ForeEvent := Events.FindByName("Loading Start"); //Event generating ForeEvent.Invoke; End Sub InvokeEvent;