Compare() public static method

public static Compare ( AutomationElement el1, AutomationElement el2 ) : bool
el1 AutomationElement
el2 AutomationElement
return bool
Ejemplo n.º 1
0
        public override bool Equals(Object obj)
        {
            AutomationElement other = obj as AutomationElement;

            if (null == other)
            {
                return(false);
            }

            return(Automation.Compare(this, other));
        }
Ejemplo n.º 2
0
        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));
        }
Ejemplo n.º 3
0
        public override bool Equals(object obj)
        {
            var el2 = obj as AutomationElement;

            return(obj != null && !(el2 == null) && Automation.Compare(el1: this, el2: el2));
        }