本文整理汇总了C#中IUiElement.GetSupportedPatterns方法的典型用法代码示例。如果您正苦于以下问题:C# IUiElement.GetSupportedPatterns方法的具体用法?C# IUiElement.GetSupportedPatterns怎么用?C# IUiElement.GetSupportedPatterns使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类IUiElement
的用法示例。
在下文中一共展示了IUiElement.GetSupportedPatterns方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: WritingAvailablePatterns
public static string WritingAvailablePatterns(IUiElement element)
{
string resultString = string.Empty;
try {
resultString = "available patterns";
resultString += "\r\n";
// 20120618 UiaCOMWrapper
// 20131209
// AutomationPattern[] supportedPatterns =
// element.GetSupportedPatterns();
IBasePattern[] supportedPatterns =
element.GetSupportedPatterns();
//UiaCOM::System.Windows.Automation.AutomationPattern[] supportedPatterns =
// element.GetSupportedPatterns();
if (supportedPatterns == null || supportedPatterns.Length <= 0) return resultString;
for (int i = 0; i < supportedPatterns.Length; i++) {
if (i > 0) {
resultString += "\r\n";
}
resultString +=
// 20131209
// supportedPatterns[i].ProgrammaticName.Replace("Identifiers.Pattern", "");
// 20131210
// (supportedPatterns[i] as AutomationPattern).ProgrammaticName.Replace("Identifiers.Pattern", "");
// (supportedPatterns[i].SourcePattern as AutomationPattern).ProgrammaticName.Replace("Identifiers.Pattern", "");
// 20140112
// (supportedPatterns[i].GetSourcePattern() as AutomationPattern).ProgrammaticName.Replace("Identifiers.Pattern", string.Empty);
supportedPatterns[i].GetType().Name.Substring(3);
}
/*
if (supportedPatterns != null &&
supportedPatterns.Length > 0) {
for (int i = 0; i < supportedPatterns.Length; i++) {
if (i > 0) {
this.richPatterns.Text += "\r\n";
}
this.richPatterns.Text +=
supportedPatterns[i].ProgrammaticName.Replace("Identifiers.Pattern", "");
}
}
*/
return resultString;
}
catch {
return resultString;
}
}
示例2: GetPatternStrings
private string GetPatternStrings(IUiElement element)
{
string result = string.Empty;
if (!Full) return result;
IBasePattern[] supportedPatterns =
element.GetSupportedPatterns();
if (null == supportedPatterns || 0 == supportedPatterns.Length) return result;
foreach (IBasePattern pattern in supportedPatterns) {
result += ";Has";
result +=
// (pattern.GetSourcePattern() as AutomationPattern).ProgrammaticName.Replace("Identifiers.Pattern", string.Empty);
pattern.GetType().Name.Substring(2);
result += "=$true";
}
return result;
}