本文整理汇总了C#中System.Windows.Automation.AutomationElement.GetCachedPropertyValue方法的典型用法代码示例。如果您正苦于以下问题:C# AutomationElement.GetCachedPropertyValue方法的具体用法?C# AutomationElement.GetCachedPropertyValue怎么用?C# AutomationElement.GetCachedPropertyValue使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类System.Windows.Automation.AutomationElement
的用法示例。
在下文中一共展示了AutomationElement.GetCachedPropertyValue方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: TS_ElementEnabled
/// -------------------------------------------------------------------
/// <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++;
}
示例2: pattern_GetProperty
/// -------------------------------------------------------------------
/// <summary></summary>
/// -------------------------------------------------------------------
object pattern_GetProperty(AutomationElement element, AutomationProperty property)
{
if (m_useCurrent)
return element.GetCurrentPropertyValue(property);
else
return element.GetCachedPropertyValue(property);
}