OnOperation(Operation: Integer; O1: Variant; O2: Variant: Var State: Integer);
Operation - an operation type. This parameter is not used.
O1 - the object, containing access protocol filter.
O2 - the object, containing access protocol filter.
State - a result of conflict resolving. It is defined by the CallbackOperationState enumeration.
The OnOperation method executes actions that are required to resolve a conflict.
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: