Example #1
0
        public TextRange FindAttribute(TextAttributeId attribute, object value, bool backward)
        {
            var nativeValue     = NativeValueConverter.ToNative(value);
            var nativeTextRange = ComCallWrapper.Call(() => NativeRange.FindAttribute(attribute.Id, nativeValue, backward.ToInt()));

            return(NativeValueConverter.NativeToManaged(Automation, nativeTextRange));
        }
Example #2
0
        public TextRange GetCaretRange(out bool isActive)
        {
            var rawIsActive     = 0;
            var nativeTextRange = ComCallWrapper.Call(() => ExtendedNativePattern.GetCaretRange(out rawIsActive));

            isActive = (rawIsActive != 0);
            return(NativeValueConverter.NativeToManaged(Automation, nativeTextRange));
        }
Example #3
0
        public TextRange[] GetVisibleRanges()
        {
            var nativeRanges = ComCallWrapper.Call(() => NativePattern.GetVisibleRanges());

            return(NativeValueConverter.NativeArrayToManaged(Automation, nativeRanges));
        }
Example #4
0
        protected Element NativeElementToElement(PropertyId property)
        {
            var nativeElement = Get <UIA.IUIAutomationElement>(property);

            return(NativeValueConverter.NativeToManaged(AutomationElement.Automation, nativeElement));
        }
Example #5
0
        protected Element[] NativeElementArrayToElements(PropertyId property)
        {
            var nativeElements = Get <UIA.IUIAutomationElementArray>(property);

            return(NativeValueConverter.NativeArrayToManaged(AutomationElement.Automation, nativeElements));
        }
Example #6
0
        public TextRange GetConversionTarget()
        {
            var nativeTextRange = ComCallWrapper.Call(() => ExtendedNativePattern.GetConversionTarget());

            return(NativeValueConverter.NativeToManaged(Automation, nativeTextRange));
        }
Example #7
0
        public Element FindItemByProperty(Element startAfter, PropertyId property, object value)
        {
            var foundNativeElement = ComCallWrapper.Call(() =>
                                                         NativePattern.FindItemByProperty(
                                                             startAfter == null ? null : startAfter.NativeElement,
                                                             property == null ? 0 : property.Id, NativeValueConverter.ToNative(value)));

            return(ToAutomationElement(foundNativeElement));
        }
Example #8
0
        public Element[] GetChildren()
        {
            var nativeChildren = ComCallWrapper.Call(() => NativeRange.GetChildren());

            return(NativeValueConverter.NativeArrayToManaged(Automation, nativeChildren));
        }
Example #9
0
        /// <summary>
        /// Finds the first element which is in the given treescope and matches the condition
        /// </summary>
        public Element FindFirst(TreeScope treeScope, ConditionBase condition)
        {
            var nativeFoundElement = NativeElement.FindFirst((UIA.TreeScope)treeScope, NativeConditionConverter.ToNative(Automation, condition));

            return(NativeValueConverter.NativeToManaged(Automation, nativeFoundElement));
        }
Example #10
0
        public TextRange Clone()
        {
            var clonedTextRangeNative = ComCallWrapper.Call(() => NativeRange.Clone());

            return(NativeValueConverter.NativeToManaged(Automation, clonedTextRangeNative));
        }
Example #11
0
        public TextRange2 AsTextRange2()
        {
            var nativeRange2 = (UIA.IUIAutomationTextRange2)NativeRange;

            return(NativeValueConverter.NativeToManaged(Automation, nativeRange2));
        }
Example #12
0
        public Element GetEnclosingElement()
        {
            var nativeElement = ComCallWrapper.Call(() => NativeRange.GetEnclosingElement());

            return(NativeValueConverter.NativeToManaged(Automation, nativeElement));
        }
Example #13
0
        public TextRange RangeFromAnnotation(Element annotation)
        {
            var nativeElement = ComCallWrapper.Call(() => ExtendedNativePattern.RangeFromAnnotation(annotation.NativeElement));

            return(NativeValueConverter.NativeToManaged(Automation, nativeElement));
        }
Example #14
0
        public TextRange RangeFromChild(Element child)
        {
            var nativeRange = ComCallWrapper.Call(() => NativePattern.RangeFromChild(child.NativeElement));

            return(NativeValueConverter.NativeToManaged(Automation, nativeRange));
        }
Example #15
0
        public TextRange FindText(string text, bool backward, bool ignoreCase)
        {
            var nativeTextRange = ComCallWrapper.Call(() => NativeRange.FindText(text, backward.ToInt(), ignoreCase.ToInt()));

            return(NativeValueConverter.NativeToManaged(Automation, nativeTextRange));
        }
Example #16
0
        public TextRange RangeFromPoint(Point point)
        {
            var nativeRange = ComCallWrapper.Call(() => NativePattern.RangeFromPoint(point.ToTagPoint()));

            return(NativeValueConverter.NativeToManaged(Automation, nativeRange));
        }
Example #17
0
        /// <summary>
        /// Finds all elements in the given treescope and condition
        /// </summary>
        public Element[] FindAll(TreeScope treeScope, ConditionBase condition)
        {
            var nativeFoundElements = NativeElement.FindAll((UIA.TreeScope)treeScope, NativeConditionConverter.ToNative(Automation, condition));

            return(NativeValueConverter.NativeArrayToManaged(Automation, nativeFoundElements));
        }