Events: IMetabaseCustomForeEvents;
The Events property returns a collection of custom events.
Custom events are stored in repository metadata. Event occurrence is tracked with task scheduler. In this case the task container specified in task scheduler settings should contain tasks run on occurring the configured event.
The event can occur as a result of any other task execution, if corresponding setting is made for it. The event can be also generated from application code using the Invoke method.
Add links to the Metabase system assembly.
The example of custom event creation:
Sub UserProc;
Var
MB: IMetabase;
CustomClassExtender: IMetabaseCustomExtender;
Events: IMetabaseCustomForeEvents;
ForeEvent: IMetabaseCustomForeEvent;
Begin
MB := MetabaseClass.Active;
//Get custom classes container
CustomClassExtender := Mb.SpecialObject(MetabaseSpecialObject.CustomExtender).Edit As IMetabaseCustomExtender;
//Get the list of events
Events := CustomClassExtender.Events;
ForeEvent := Events.Add("BEGIN_LOAD");
ForeEvent.Name := "Application login";
(CustomClassExtender As IMetabaseObject).Save;
End Sub UserProc;
Imports Prognoz.Platform.Interop.Metabase;
Public Shared Sub Main(Params: StartParams);
Var
MB: IMetabase;
CustomClassExtender: IMetabaseCustomExtender;
Events: IMetabaseCustomForeEvents;
ForeEvent: IMetabaseCustomForeEvent;
Begin
MB := Params.Metabase;
//Get custom classes container
CustomClassExtender := Mb.SpecialObject[MetabaseSpecialObject.msoCustomExtender].Edit() As IMetabaseCustomExtender;
//Get the list of events
Events := CustomClassExtender.Events;
ForeEvent := Events.Add("BEGIN_LOAD");
ForeEvent.Name := "Start loading";
(CustomClassExtender As IMetabaseObject).Save();
End Sub;
The example of custom event generation from application code:
Sub UserProc;
Var
MB: IMetabase;
CustomExtender: IMetabaseCustomExtender;
Events: IMetabaseCustomForeEvents;
ForeEvent: IMetabaseCustomForeEvent;
Begin
MB := MetabaseClass.Active;
//Getting a custom class container
CustomExtender := MB.SpecialObject(MetabaseSpecialObject.CustomExtender).Edit As IMetabaseCustomExtender;
//Getting list of events
Events := CustomExtender.Events;
ForeEvent := Events.FindByName("Starting download");
//Generating event
ForeEvent.Invoke;
End Sub UserProc;
Imports Prognoz.Platform.Interop.Metabase;
Public Shared Sub Main1(Params: StartParams);
Var
MB: IMetabase;
CustomExtender: IMetabaseCustomExtender;
Events: IMetabaseCustomForeEvents;
ForeEvent: IMetabaseCustomForeEvent;
Begin
MB := Params.Metabase;
//Get custom classes container
CustomExtender := MB.SpecialObject[MetabaseSpecialObject.msoCustomExtender].Edit() As IMetabaseCustomExtender;
//Get the list of events
Events := CustomExtender.Events;
ForeEvent := Events.FindByName("Start loading");
//Event generation
ForeEvent.Invoke(Null);
End Sub;
See also: