public TextPatternRange FindAttribute(AutomationTextAttribute attribute, object value, bool backward) { Utility.ValidateArgumentNonNull(attribute, "attribute"); Utility.ValidateArgumentNonNull(value, "value"); if ((attribute == TextPattern.CultureAttribute) && (value is CultureInfo)) { value = ((CultureInfo)value).LCID; } try { return(TextPatternRange.Wrap( this._range.FindAttribute(attribute.Id, value, Utility.ConvertToInt(backward)), this._pattern)); } catch (System.Runtime.InteropServices.COMException e) { Exception newEx; if (Utility.ConvertException(e, out newEx)) { throw newEx; } else { throw; } } }
internal static TextPatternRange[] Wrap(UIAutomationClient.IUIAutomationTextRangeArray ranges, TextPattern pattern) { if (ranges == null) { return(null); } TextPatternRange[] rangeArray = new TextPatternRange[ranges.Length]; for (int i = 0; i < ranges.Length; i++) { rangeArray[i] = new TextPatternRange(ranges.GetElement(i), pattern); } return(rangeArray); }
public TextPatternRange[] GetVisibleRanges() { try { return(TextPatternRange.Wrap(this._pattern.GetVisibleRanges(), this)); } catch (System.Runtime.InteropServices.COMException e) { Exception newEx; if (Utility.ConvertException(e, out newEx)) { throw newEx; } else { throw; } } }
public TextPatternRange RangeFromPoint(Point screenLocation) { try { return(TextPatternRange.Wrap(this._pattern.RangeFromPoint(Utility.PointManagedToNative(screenLocation)), this)); } catch (System.Runtime.InteropServices.COMException e) { Exception newEx; if (Utility.ConvertException(e, out newEx)) { throw newEx; } else { throw; } } }
public bool Compare(TextPatternRange range) { try { return(0 != this._range.Compare(range.NativeRange)); } catch (System.Runtime.InteropServices.COMException e) { Exception newEx; if (Utility.ConvertException(e, out newEx)) { throw newEx; } else { throw; } } }
public TextPatternRange RangeFromAnnotation(AutomationElement annotation) { Utility.ValidateArgumentNonNull(annotation, "annotation"); try { return(TextPatternRange.Wrap(this._pattern.RangeFromAnnotation(annotation.NativeElement), this)); } catch (System.Runtime.InteropServices.COMException e) { Exception newEx; if (Utility.ConvertException(e, out newEx)) { throw newEx; } else { throw; } } }
public TextPatternRange FindText(string text, bool backward, bool ignoreCase) { try { return(TextPatternRange.Wrap( this._range.FindText(text, Utility.ConvertToInt(backward), Utility.ConvertToInt(ignoreCase)), this._pattern)); } catch (System.Runtime.InteropServices.COMException e) { Exception newEx; if (Utility.ConvertException(e, out newEx)) { throw newEx; } else { throw; } } }
public int CompareEndpoints(TextPatternRangeEndpoint endpoint, TextPatternRange targetRange, TextPatternRangeEndpoint targetEndpoint) { try { return(this._range.CompareEndpoints( (UIAutomationClient.TextPatternRangeEndpoint)endpoint, targetRange.NativeRange, (UIAutomationClient.TextPatternRangeEndpoint)targetEndpoint)); } catch (System.Runtime.InteropServices.COMException e) { Exception newEx; if (Utility.ConvertException(e, out newEx)) { throw newEx; } else { throw; } } }
public TextPatternRange GetCaretRange(out bool isActive) { try { int intIsActive; TextPatternRange caretRange = TextPatternRange.Wrap( this._pattern.GetCaretRange(out intIsActive), this); isActive = (intIsActive != 0); return(caretRange); } catch (System.Runtime.InteropServices.COMException e) { Exception newEx; if (Utility.ConvertException(e, out newEx)) { throw newEx; } else { throw; } } }