Exemplo n.º 1
0
 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;
         }
     }
 }
Exemplo n.º 2
0
 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);
 }
Exemplo n.º 3
0
 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;
         }
     }
 }
Exemplo n.º 4
0
 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;
         }
     }
 }
Exemplo n.º 5
0
 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;
         }
     }
 }
Exemplo n.º 6
0
 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;
         }
     }
 }
Exemplo n.º 7
0
 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;
         }
     }
 }
Exemplo n.º 8
0
 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;
         }
     }
 }
Exemplo n.º 9
0
 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;
         }
     }
 }