IOperationCallback.OnOperation

Syntax

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

Parameters

Operation. Operation type. This parameter is not used.

O1. The object that contains access protocol filter.

O2. The object that contains access protocol filter.

State. Conflict resolution result. It is determined by the CallbackOperationState enumeration.

Description

The OnOperation method executes actions required to resolve a conflict.

Example

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

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("Replace name '" + (O1 As IAuditFilterObject).Name
            + "' with '" + (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 UserProc;
Var
    FilCon, FilConDef: IAuditFiltersContainer;
    FilObj, FilObjDef: IAuditFilterObject;
    State: 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), State);
    If State = CallbackOperationState.Replace 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 UserProc;

On executing the example a conflict is generated when loading the file. The user is prompted to resolve the conflict.

See also:

IOperationCallback