public override bool Equals(Object obj) { AutomationElement other = obj as AutomationElement; if (null == other) { return(false); } return(Automation.Compare(this, other)); }
internal override bool AppliesTo(AutomationElement element) { // TODO: Test caching behavior object currentVal = element.GetCurrentPropertyValue(property); object conditionVal = val; if (currentVal == null || conditionVal == null) { return(currentVal == conditionVal); } // Compare AutomationElements against Condition's // stored runtime ID array if (property == AEIds.LabeledByProperty || property == GridItemPatternIdentifiers.ContainingGridProperty || property == SelectionItemPatternIdentifiers.SelectionContainerProperty) { AutomationElement elementVal = currentVal as AutomationElement; int [] conditionId = conditionVal as int []; return(currentVal != null && conditionId != null && Automation.Compare(conditionId, elementVal.GetRuntimeId())); } // For some other properties, need to reconstruct proper // object for comparison if (property == AEIds.BoundingRectangleProperty) { double [] rectArray = (double [])val; conditionVal = new Rect(rectArray [0], rectArray [1], rectArray [2], rectArray [3]); } else if (property == AEIds.ClickablePointProperty) { double [] pointArray = (double [])val; conditionVal = new Point(pointArray [0], pointArray [1]); } else if (property == AEIds.ControlTypeProperty) { conditionVal = ControlType.LookupById((int)val); } else if (property == AEIds.CultureProperty) { conditionVal = new CultureInfo((int)val); } return(ArePropertyValuesEqual(conditionVal, currentVal)); }
public override bool Equals(object obj) { var el2 = obj as AutomationElement; return(obj != null && !(el2 == null) && Automation.Compare(el1: this, el2: el2)); }