IAuditFiltersContainer.Callback

Syntax

Callback: IOperationCallback;

Description

The Callback property determines the action to perform if conflict appears during container loading.

Example

Executing the example requires the C:\Filter.xml file that contains more than one filter of access protocol.

Class MyOperationCallback: OperationCallback

Parent: IWin32Window;

 

Public Sub OnOperation(Operation: Integer; O1: Variant; O2: Variant; Var State: Integer);

Var

YesPress: Boolean;

Begin

YesPress := False;

If WinApplication.YesNoCancelBox("Change name '" + (O1 As IAuditFilterObject).Name + "' for '" + (O2 As IAuditFilterObject).Name + "'?", YesPress)

Then

State := YesPress ? CallbackOperationState.Replace : CallbackOperationState.Skip;

Else

State := CallbackOperationState.Stop;

End If;

End Sub OnOperation;

 

End Class MyOperationCallback;

 

Sub Main;

Var

FilCon, FilConDef: IAuditFiltersContainer;

FilObj, FilObjDef: IAuditFilterObject;

par: integer;

Begin

FilCon := New AuditFiltersContainer.Create;

FilCon.LoadFromFile("C:\Filter.xml");

FilCon.Callback := New MyOperationCallback.Create;

FilConDef := New AuditFiltersContainer.Create;

FilConDef.Load;

FilCon.Callback.OnOperation(0, FilCon.Filters.Item(1), FilConDef.Filters.Item(0), par);

If par = 1 Then

FilObj := FilCon.Filters.Item(1).Edit;

FilObjDef := FilConDef.Filters.Item(0);

FilObj.Name := FilObjDef.Name;

FilObj.Save;

FilCon.SaveToFile("C:\NameRepl.xml");

End If;

End Sub Main;

On executing the example a conflict is generated when loading the file. Conflict resolving is offered to the user.

See also:

IAuditFiltersContainer