Show / Hide Table of Contents

Delegate Application.CallIfDelegate

Delegate callback for the CallIfFound/CallIfNotFound EventHandlers which will be invoked when a selector is found/not found
CallIf handlers may be defined at two levels: At each selector or for a Unit of Work (UOW) [will be invoked for each Selector in the UOW]
A UOW is defined as all Selectors between actions (first action is Open)
More than one callback handler can be defined and subsequent handlers will only be invoked based upon return code values

Namespace: GenerallyPositive.Application
Assembly: GPAL.dll
Syntax
public delegate int CallIfDelegate(Application application, List<GPALAutomationElement> foundElements, List<GPALAutomationElement> matchedElements, Selector selector, bool matchedAll);
Parameters
Type Name Description
Application application

The current application running

System.Collections.Generic.List<GPALAutomationElement> foundElements

All found elements

System.Collections.Generic.List<GPALAutomationElement> matchedElements

All matched elements.
If a 'Match' criteria is set on a Selector, otherwise all found

Selector selector

The Selector used

System.Boolean matchedAll

true - all elements matched in foundElements
false - matchedElements out of foundElements

Returns
Type Description
System.Int32

try the next handler in the chain based upon handler return value
0 = not handled, bubble to next handler
1 = handled and continue with the program
-1 = terminate program

Examples
public static int CallIfFound(Application application, List<GPALAutomationElement> foundElements, List<GPALAutomationElement> matchedElements, Selector selector, bool matchedAll)
{
    int retVal = 1; // we are going to handle this
    ElementAssistant elementAssistant = (ElementAssistant)GPAL.ElementAssistant(application);
    foreach (GPALAutomationElement element in foundElements)
    {
        elementAssistant
            .ForSelector(selector)  // for interaction type, offsetx and offsety
            .WithElement(element).WithHardware
            .LeftClick();
    }
    return retVal;
}
In This Article
Back to top Generated by DocFX