FindAttribute() public method

public FindAttribute ( AutomationTextAttribute attribute, object value, bool backward ) : TextPatternRange
attribute AutomationTextAttribute
value object
backward bool
return TextPatternRange
Example #1
0
        //---------------------------------------------------------------------------
        // Wrapper for TextPatternRange.FindAttribute Method
        //---------------------------------------------------------------------------
        internal void Range_FindAttribute(TextPatternRange callingRange, ref TextPatternRange targetRange, AutomationTextAttribute attrib, object val, bool backward, Type expectedException, CheckType checkType)
        {
            string call = "";
            if (attrib != null)
                call = "TextPatternRange.FindAttribute(" + Helpers.GetProgrammaticName(attrib) + ", " + (val == null ? "NULL" : val.ToString()) + ", " + backward + ")";
            else
                call = "TextPatternRange.FindAttribute(NULL," + (val == null ? "NULL" : val.ToString()) + ", " + backward + ")";
            Comment("---Calling " + call);

            if (callingRange == null)
                throw new ArgumentNullException(call + " requires non-NULL TextPatterncallingRange");

            try
            {
                targetRange = callingRange.FindAttribute(attrib, val, backward);
            }
            catch (Exception actualException)
            {
                if (Library.IsCriticalException(actualException))
                    throw;

                TestException(expectedException, actualException, call, checkType);
                return;
            }
            TestNoExceptionQuiet(expectedException, call, checkType);
        }