public GetCachedPropertyValue ( |
||
property | ||
ignoreDefaultValue | bool | |
Résultat | object |
public object GetCachedPropertyValue(AutomationProperty property, bool ignoreDefaultValue)
{
Utility.ValidateArgumentNonNull(property, "property");
try
{
object obj = this._obj.GetCachedPropertyValueEx(property.Id, (ignoreDefaultValue) ? 1 : 0);
return Utility.WrapObjectAsProperty(property, obj);
}
catch (System.Runtime.InteropServices.COMException e)
{
Exception newEx; if (Utility.ConvertException(e, out newEx)) { throw newEx; } else { throw; }
}
}
AutomationElement::GetCachedPropertyValue ( |
/// ------------------------------------------------------------------- /// <summary> /// Test that the element's enable state is the same as 'isEnabled' argument /// </summary> /// ------------------------------------------------------------------- internal void TS_ElementEnabled(AutomationElement element, bool isEnabled, CheckType checkType) { bool enabled; if (m_useCurrent) { enabled = (bool)element.GetCurrentPropertyValue(AutomationElement.IsEnabledProperty); } else { enabled = (bool)element.GetCachedPropertyValue(AutomationElement.IsEnabledProperty); } if (enabled != isEnabled) { string errorStr; // Adding switch instead of if statements since this is most likely // an enumeration instead of a t/f such as soft focus states to be add // later. switch (isEnabled) { case true: errorStr = "Element is not enabled and is expected to be enabled"; break; case false: errorStr = "Element is enabled and is expected not to be enabled"; break; default: throw new ArgumentException("Need to handle " + isEnabled); } ThrowMe(checkType, errorStr); } m_TestStep++; }