public override IAutomationFocusChangedEventHandler RegisterFocusChangedEvent(Action <AutomationElement> action) { var eventHandler = new UIA3FocusChangedEventHandler(this, action); ComCallWrapper.Call(() => NativeAutomation.AddFocusChangedEventHandler(null, eventHandler)); return(eventHandler); }
public ITextRange FindAttribute(TextAttributeId attribute, object value, bool backward) { var nativeValue = ValueConverter.ToNative(value); var nativeTextRange = ComCallWrapper.Call(() => NativeRange.FindAttribute(attribute.Id, nativeValue, backward.ToInt())); return(TextRangeConverter.NativeToManaged(Automation, nativeTextRange)); }
public ITextRange RangeFromAnnotation(AutomationElement annotation) { var nativeInputElement = AutomationElementConverter.ToNative(annotation); var nativeElement = ComCallWrapper.Call(() => ExtendedNativePattern.RangeFromAnnotation(nativeInputElement)); return(TextRangeConverter.NativeToManaged((UIA3Automation)BasicAutomationElement.Automation, nativeElement)); }
public override ITextRange RangeFromChild(AutomationElement child) { var nativeChild = child.ToNative(); var nativeRange = ComCallWrapper.Call(() => NativePattern.RangeFromChild(nativeChild)); return(TextRangeConverter.NativeToManaged((UIA3Automation)BasicAutomationElement.Automation, nativeRange)); }
public ITextRange GetCaretRange(out bool isActive) { var rawIsActive = 0; var nativeTextRange = ComCallWrapper.Call(() => ExtendedNativePattern.GetCaretRange(out rawIsActive)); isActive = rawIsActive != 0; return(TextRangeConverter.NativeToManaged((UIA3Automation)BasicAutomationElement.Automation, nativeTextRange)); }
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)); }
public AutomationElement FindItemByProperty(AutomationElement startAfter, PropertyId property, object value) { var foundNativeElement = ComCallWrapper.Call(() => NativePattern.FindItemByProperty( startAfter?.ToNative(), property?.Id ?? 0, ValueConverter.ToNative(value))); return(AutomationElementConverter.NativeToManaged((UIA3Automation)BasicAutomationElement.Automation, foundNativeElement)); }
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)); }
public override AutomationElement FocusedElement() { return(ComCallWrapper.Call(() => { var nativeElement = CacheRequest.IsCachingActive ? NativeAutomation.GetFocusedElementBuildCache(CacheRequest.Current.ToNative(this)) : NativeAutomation.GetFocusedElement(); return WrapNativeElement(nativeElement); })); }
/// <summary> /// Creates an <see cref="AutomationElement" /> from a given windows handle (HWND) /// </summary> public override AutomationElement FromHandle(IntPtr hwnd) { return(ComCallWrapper.Call(() => { var nativeElement = CacheRequest.IsCachingActive ? NativeAutomation.ElementFromHandleBuildCache(hwnd, CacheRequest.Current.ToNative(this)) : NativeAutomation.ElementFromHandle(hwnd); return WrapNativeElement(nativeElement); })); }
public override AutomationElement GetDesktop() { return(ComCallWrapper.Call(() => { var desktop = CacheRequest.IsCachingActive ? NativeAutomation.GetRootElementBuildCache(CacheRequest.Current.ToNative(this)) : NativeAutomation.GetRootElement(); return WrapNativeElement(desktop); })); }
public override bool TryGetClickablePoint(out Point point) { var tagPoint = new UIA.tagPOINT { x = 0, y = 0 }; var success = ComCallWrapper.Call(() => NativeElement.GetClickablePoint(out tagPoint)) != 0; point = success ? new Point(tagPoint.x, tagPoint.y) : null; return(success); }
/// <summary> /// Creates an <see cref="AutomationElement" /> from a given point /// </summary> public override AutomationElement FromPoint(Point point) { return(ComCallWrapper.Call(() => { var nativePoint = point.ToTagPoint(); var nativeElement = CacheRequest.IsCachingActive ? NativeAutomation.ElementFromPointBuildCache(nativePoint, CacheRequest.Current.ToNative(this)) : NativeAutomation.ElementFromPoint(nativePoint); return WrapNativeElement(nativeElement); })); }
public override bool TryGetClickablePoint(out Point point) { var tagPoint = new UIA.tagPOINT { x = 0, y = 0 }; var success = ComCallWrapper.Call(() => NativeElement.GetClickablePoint(out tagPoint)) != 0; if (success) { point = new Point(tagPoint.x, tagPoint.y); } else { success = Properties.ClickablePoint.TryGetValue(out point); } return(success); }
public Rectangle[] GetBoundingRectangles() { var unrolledRects = ComCallWrapper.Call(() => NativeRange.GetBoundingRectangles()); if (unrolledRects == null) { return(null); } // If unrolledRects is somehow not a multiple of 4, we still will not // overrun it, since (x / 4) * 4 <= x for C# integer math. var result = new Rectangle[unrolledRects.Length / 4]; for (var i = 0; i < result.Length; i++) { var j = i * 4; result[i] = new Rectangle(unrolledRects[j], unrolledRects[j + 1], unrolledRects[j + 2], unrolledRects[j + 3]); } return(result); }
public void Select() { ComCallWrapper.Call(() => NativeRange.Select()); }
public override void SetValue(string value) { ComCallWrapper.Call(() => NativePattern.SetValue(value)); }
public override void Select(int flagsSelect) { ComCallWrapper.Call(() => NativePattern.Select(flagsSelect)); }
public override IAccessible GetIAccessible() { // ReSharper disable once SuspiciousTypeConversion.Global return(ComCallWrapper.Call(() => (IAccessible)NativePattern.GetIAccessible())); }
public override void DoDefaultAction() { ComCallWrapper.Call(() => NativePattern.DoDefaultAction()); }
public object GetAttributeValue(TextAttributeId attribute) { var nativeValue = ComCallWrapper.Call(() => NativeRange.GetAttributeValue(attribute.Id)); return(attribute.Convert <object>(nativeValue)); }
public int MoveEndpointByUnit(TextPatternRangeEndpoint endpoint, TextUnit unit, int count) { return(ComCallWrapper.Call(() => NativeRange.MoveEndpointByUnit((UIA.TextPatternRangeEndpoint)endpoint, (UIA.TextUnit)unit, count))); }
public ITextRange FindText(string text, bool backward, bool ignoreCase) { var nativeTextRange = ComCallWrapper.Call(() => NativeRange.FindText(text, backward.ToInt(), ignoreCase.ToInt())); return(TextRangeConverter.NativeToManaged(Automation, nativeTextRange)); }
public int CompareEndpoints(TextPatternRangeEndpoint srcEndPoint, ITextRange targetRange, TextPatternRangeEndpoint targetEndPoint) { var nativeRange = ToNativeRange(targetRange); return(ComCallWrapper.Call(() => NativeRange.CompareEndpoints((UIA.TextPatternRangeEndpoint)srcEndPoint, nativeRange, (UIA.TextPatternRangeEndpoint)targetEndPoint))); }
public void ExpandToEnclosingUnit(TextUnit textUnit) { ComCallWrapper.Call(() => NativeRange.ExpandToEnclosingUnit((UIA.TextUnit)textUnit)); }
public bool Compare(ITextRange range) { var nativeRange = ToNativeRange(range); return(ComCallWrapper.Call(() => NativeRange.Compare(nativeRange)) != 0); }
public ITextRange Clone() { var clonedTextRangeNative = ComCallWrapper.Call(() => NativeRange.Clone()); return(TextRangeConverter.NativeToManaged(Automation, clonedTextRangeNative)); }
public void AddToSelection() { ComCallWrapper.Call(() => NativeRange.AddToSelection()); }
public void RemoveFromSelection() { ComCallWrapper.Call(() => NativeRange.RemoveFromSelection()); }
public void ScrollIntoView(bool alignToTop) { ComCallWrapper.Call(() => NativeRange.ScrollIntoView(alignToTop.ToInt())); }