本文整理汇总了C#中IUiElement.Any方法的典型用法代码示例。如果您正苦于以下问题:C# IUiElement.Any方法的具体用法?C# IUiElement.Any怎么用?C# IUiElement.Any使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类IUiElement
的用法示例。
在下文中一共展示了IUiElement.Any方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: TestControlByPropertiesFromHashtable
protected internal bool TestControlByPropertiesFromHashtable(
IUiElement[] inputElements,
IEnumerable<Hashtable> searchCriteria,
int timeout)
{
bool result = false;
if (null == searchCriteria || 0 == searchCriteria.Count()) return result;
if (null == inputElements || 0 == inputElements.Length) return result;
foreach (Hashtable ht in searchCriteria)
{
Dictionary<string, object> dict =
ht.ConvertHashtableToDictionary();
var cmdlet = new GetControlCmdletBase();
try { cmdlet.Class = dict["CLASS"].ToString(); } catch {}
try { cmdlet.AutomationId = dict["AUTOMATIONID"].ToString(); } catch {}
// 20131128
// try{ cmdlet.ControlType = dict["CONTROLTYPE"].ToString(); } catch {}
// 20131203
try { cmdlet.ControlType = new string[] { dict["CONTROLTYPE"].ToString() }; } catch {}
try { cmdlet.Name = dict["NAME"].ToString(); } catch {}
try { cmdlet.Value = dict["VALUE"].ToString(); } catch {}
cmdlet.Timeout = timeout;
if (null != inputElements && null != (inputElements as IUiElement[]) && inputElements.Any()) {
cmdlet.InputObject = inputElements;
} else {
if (CurrentData.CurrentWindow == null) {
return result;
}
cmdlet.InputObject = new[]{ CurrentData.CurrentWindow };
}
var controlSearcher =
AutomationFactory.GetSearcherImpl<ControlSearcher>() as ControlSearcher;
List<IUiElement> elementsToWorkWith =
controlSearcher.GetElements(
controlSearcher.ConvertCmdletToControlSearcherData(cmdlet),
cmdlet.Timeout);
// 20140212
// if (null == elementsToWorkWith) {
if (null == elementsToWorkWith || 0 == elementsToWorkWith.Count) {
// WriteVerbose(this, "couldn't get the control(s)");
return result;
} else {
// 20140212
bool theCurrentHashtableMatchesAtLeastOneElement = false;
foreach (IUiElement elementToWorkWith in elementsToWorkWith) {
bool oneControlResult =
elementToWorkWith.TestControlByPropertiesFromDictionary(dict);
if (oneControlResult) {
if (Preferences.HighlightCheckedControl) {
UiaHelper.HighlightCheckedControl(elementToWorkWith);
}
theCurrentHashtableMatchesAtLeastOneElement = true;
// result = true;
break;
} else { // 20130710
// 20140211
// return result;
// nothing to do
}
} // 20120824
if (!theCurrentHashtableMatchesAtLeastOneElement) return result;
}
}
// 20140211
// 20140211
result = true;
return result;
}