本文整理汇总了C#中IUiElement类的典型用法代码示例。如果您正苦于以下问题:C# IUiElement类的具体用法?C# IUiElement怎么用?C# IUiElement使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
IUiElement类属于命名空间,在下文中一共展示了IUiElement类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C#代码示例。
示例1: RemoveAutomationEventHandler
public void RemoveAutomationEventHandler(classic.AutomationEvent eventId, IUiElement element, classic.AutomationEventHandler eventHandler)
{
classic.Automation.RemoveAutomationEventHandler(
eventId,
element.GetSourceElement() as classic.AutomationElement,
eventHandler);
}
开发者ID:MatkoHanus,项目名称:STUPS,代码行数:7,代码来源:UiaAutomation.cs
示例2: ConvertElementToSearchCriteria
protected internal string ConvertElementToSearchCriteria(IUiElement element)
{
string result = "@{";
result += GetPropertyCompleteString(element, result, "Name");
result += GetPropertyCompleteString(element, result, "AutomationId");
result += GetPropertyCompleteString(element, result, "ControlType");
result += GetPropertyCompleteString(element, result, "Class");
result += GetPropertyCompleteString(element, result, "AcceleratorKey");
result += GetPropertyCompleteString(element, result, "AccessKey");
result += GetPropertyCompleteString(element, result, "BoundingRectangle");
result += GetPropertyCompleteString(element, result, "FrameworkId");
result += GetPropertyCompleteString(element, result, "HasKeyboardFocus");
result += GetPropertyCompleteString(element, result, "HelpText");
result += GetPropertyCompleteString(element, result, "IsContentElement");
result += GetPropertyCompleteString(element, result, "IsControlElement");
result += GetPropertyCompleteString(element, result, "IsEnabled");
result += GetPropertyCompleteString(element, result, "IsKeyboardFocusable");
result += GetPropertyCompleteString(element, result, "IsOffscreen");
result += GetPropertyCompleteString(element, result, "IsPassword");
result += GetPropertyCompleteString(element, result, "IsRequiredForForm");
result += GetPropertyCompleteString(element, result, "ItemStatus");
result += GetPropertyCompleteString(element, result, "ItemType");
//result += getPropertyCompleteString(inputObject, result, "LabeledBy");
result += GetPropertyCompleteString(element, result, "LocalizedControlType");
result += GetPropertyCompleteString(element, result, "NativeWindowHandle");
result += GetPropertyCompleteString(element, result, "Orientation");
result += GetPropertyCompleteString(element, result, "ProcessId");
result += GetPatternStrings(element);
result += "}";
return result;
}
开发者ID:MatkoHanus,项目名称:STUPS,代码行数:32,代码来源:ConvertToUiaSearchCriteriaCommand.cs
示例3: CallDockPatternForGet
internal void CallDockPatternForGet(PatternCmdletBase cmdlet, IUiElement control, IUiElement inputObject)
{
try {
WriteObject(this, control.GetDockPosition());
} catch (Exception) {
WriteObject(this, false);
// throw;
}
// //dockPattern.Current.DockPosition
// try {
// // 20131208
// // DockPattern dockPattern = control.GetCurrentPattern(classic.DockPattern.Pattern) as DockPattern;
// // DockPattern dockPattern = control.GetCurrentPattern<IDockPattern, DockPattern>(classic.DockPattern.Pattern) as DockPattern;
// IDockPattern dockPattern = control.GetCurrentPattern<IDockPattern>(classic.DockPattern.Pattern);
// if (null != dockPattern) {
// WriteObject(this, dockPattern.Current.DockPosition);
// } else {
// WriteVerbose(this, "couldn't get DockPattern");
// WriteObject(this, false);
// }
// }
// catch {
//
// }
}
开发者ID:apetrovskiy,项目名称:STUPS,代码行数:25,代码来源:PatternCmdletBase.cs
示例4: AddAutomationPropertyChangedEventHandler
public void AddAutomationPropertyChangedEventHandler(IUiElement element, classic.TreeScope scope, classic.AutomationPropertyChangedEventHandler eventHandler, params classic.AutomationProperty[] properties)
{
classic.Automation.AddAutomationPropertyChangedEventHandler(
element.GetSourceElement() as classic.AutomationElement,
scope,
eventHandler,
properties);
}
开发者ID:MatkoHanus,项目名称:STUPS,代码行数:8,代码来源:UiaAutomation.cs
示例5: AddAutomationEventHandler
public void AddAutomationEventHandler(classic.AutomationEvent eventId, IUiElement element, classic.TreeScope scope, classic.AutomationEventHandler eventHandler)
{
classic.Automation.AddAutomationEventHandler(
eventId,
element.GetSourceElement() as classic.AutomationElement,
scope,
eventHandler);
}
开发者ID:MatkoHanus,项目名称:STUPS,代码行数:8,代码来源:UiaAutomation.cs
示例6: GetResultList_ExactSearch
public static List<IUiElement> GetResultList_ExactSearch(IUiElement element, Condition conditions, Hashtable[] searchCriteria)
{
var resultListOfControls =
ControlSearcher.SearchByExactConditionsViaUia(
element,
searchCriteria,
conditions);
return resultListOfControls;
}
开发者ID:universsky,项目名称:STUPS,代码行数:9,代码来源:RealCodeCaller.cs
示例7: GetResultList_ViaWildcards
public static List<IUiElement> GetResultList_ViaWildcards(IUiElement element, Condition condition, ControlSearcherData data)
{
List<IUiElement> resultList =
ControlSearcher.SearchByWildcardOrRegexViaUia(
element,
data,
condition,
true);
return resultList;
}
开发者ID:universsky,项目名称:STUPS,代码行数:11,代码来源:RealCodeCaller.cs
示例8: 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;
}
}
开发者ID:apetrovskiy,项目名称:STUPS,代码行数:54,代码来源:ExSpyCode.cs
示例9: SearchByContainsTextViaWin32
public static List<IUiElement> SearchByContainsTextViaWin32(
IUiElement inputObject,
string containsText,
string[] controlTypeNames,
IEnumerable<IUiElement> collection,
IEnumerable<int> handles)
{
var singleControlSearcherData = new SingleControlSearcherData { Name = containsText, ControlType = controlTypeNames };
var controlProvider = FakeFactory.GetControlFromWin32Provider_old(collection, singleControlSearcherData);
controlProvider.HandleCollector = FakeFactory.GetHandleCollector(inputObject, new int[] {}, collection.ToArray());
return ControlSearcher.SearchByContainsTextViaWin32(inputObject, controlProvider).ToList();
}
开发者ID:universsky,项目名称:STUPS,代码行数:13,代码来源:RealCodeCaller.cs
示例10: GetControlCmdletBase
public GetControlCmdletBase()
{
Class = string.Empty;
Name = string.Empty;
AutomationId = string.Empty;
Value = string.Empty;
InputObject =
new IUiElement[] { CurrentData.CurrentWindow };
// CacheRequest
FromCache = Preferences.FromCache;
Regex = false;
}
开发者ID:MatkoHanus,项目名称:STUPS,代码行数:15,代码来源:GetControlCmdletBase.cs
示例11: GetResultList_ViaWildcards_Legacy
public static List<IUiElement> GetResultList_ViaWildcards_Legacy(IUiElement element, Condition condition, ControlSearcherData data)
{
var cmdletDerived = new GetControlCollectionCmdletBase();
List<IUiElement> resultList =
cmdletDerived.GetAutomationElementsWithFindAll(
element,
data,
condition,
false,
false,
false,
true);
return resultList;
}
开发者ID:universsky,项目名称:STUPS,代码行数:16,代码来源:RealCodeCaller.cs
示例12: Buttons_Descendants_None
public void Buttons_Descendants_None()
{
// Arrange
var elements = new IUiElement[] {};
IUiElement element =
FakeFactory.GetElement_ForFindAll(
elements,
new PropertyCondition(
AutomationElement.ControlTypeProperty,
ControlType.Button));
// Act
var resultCollection = ((element as ISupportsExtendedModel).Descendants as IExtendedModel).Buttons;
// Assert
MbUnit.Framework.Assert.AreEqual(AutomationFactory.GetUiEltCollection(elements), resultCollection);
Xunit.Assert.Equal(AutomationFactory.GetUiEltCollection(elements), resultCollection);
}
开发者ID:apetrovskiy,项目名称:STUPS,代码行数:18,代码来源:ISupportsExtendedModelTestFixture.cs
示例13: TestElementsCollectionOfCertainType
private IUiElement TestElementsCollectionOfCertainType(ControlType controlType, out IUiElement[] elements)
{
// Arrange
IUiElement[] elementsArray =
new[] {
FakeFactory.GetAutomationElementExpected(controlType, string.Empty, string.Empty, string.Empty, string.Empty),
FakeFactory.GetAutomationElementExpected(controlType, string.Empty, string.Empty, string.Empty, string.Empty),
FakeFactory.GetAutomationElementExpected(controlType, string.Empty, string.Empty, string.Empty, string.Empty)
};
elements = elementsArray;
IUiElement element =
FakeFactory.GetElement_ForFindAll(
elements,
new PropertyCondition(
AutomationElement.ControlTypeProperty,
controlType));
return element;
}
开发者ID:apetrovskiy,项目名称:STUPS,代码行数:19,代码来源:ISupportsExtendedModelTestFixture.cs
示例14: CollectRecursively
public virtual List<IntPtr> CollectRecursively(
IUiElement containerElement,
string name,
int level)
{
var resultHandle = IntPtr.Zero;
var controlHandle = IntPtr.Zero;
var controlHandles = new List<IntPtr>();
var tempControlHandles = new List<IntPtr>();
// 20140312
// var containerHandle = new IntPtr(containerElement.Current.NativeWindowHandle);
var containerHandle = new IntPtr(containerElement.GetCurrent().NativeWindowHandle);
if (containerHandle == IntPtr.Zero) return controlHandles;
// search at this level
do {
// using null instead of name
controlHandle =
NativeMethods.FindWindowEx(containerHandle, controlHandle, null, null);
if (controlHandle == IntPtr.Zero) continue;
controlHandles.Add(controlHandle);
tempControlHandles =
CollectRecursively(
UiElement.FromHandle(controlHandle),
name,
level + 1);
if (null == tempControlHandles || 0 == tempControlHandles.Count) continue;
controlHandles.AddRange(tempControlHandles);
} while (controlHandle != IntPtr.Zero);
return controlHandles;
}
开发者ID:apetrovskiy,项目名称:STUPS,代码行数:37,代码来源:HandleCollector.cs
示例15: UiaSelectionPattern
public UiaSelectionPattern(IUiElement element)
{
this._element = element;
}
开发者ID:MatkoHanus,项目名称:STUPS,代码行数:4,代码来源:UiaSelectionPattern.cs
示例16: UiaExpandCollapsePattern
public UiaExpandCollapsePattern(IUiElement element)
{
_element = element;
}
开发者ID:apetrovskiy,项目名称:STUPS,代码行数:4,代码来源:UiaExpandCollapsePattern.cs
示例17: UiaGridItemPattern
public UiaGridItemPattern(IUiElement element)
{
this._element = element;
}
开发者ID:MatkoHanus,项目名称:STUPS,代码行数:4,代码来源:UiaGridItemPattern.cs
示例18: WaitIfCondition
protected internal void WaitIfCondition(
IUiElement _control,
bool isEnabledOrIsVisible)
{
_control = InputObject.Cast<IUiElement>().ToArray()[0];
// 20140312
// if (isEnabledOrIsVisible) {
// Wait = !(_control.Current).IsEnabled;
// } else {
// Wait = (_control.Current).IsOffscreen;
// }
Wait = isEnabledOrIsVisible ? !(_control.GetCurrent()).IsEnabled : (_control.GetCurrent()).IsOffscreen;
do
{
SleepAndRunScriptBlocks(this);
DateTime nowDate = DateTime.Now;
try {
string tempIsReport = string.Empty;
// 20140312
// tempIsReport = isEnabledOrIsVisible ? _control.Current.IsEnabled.ToString() : _control.Current.IsOffscreen.ToString();
tempIsReport = isEnabledOrIsVisible ? _control.GetCurrent().IsEnabled.ToString() : _control.GetCurrent().IsOffscreen.ToString();
} catch { }
if (!CheckAndPrepareInput(this))
{
WriteObject(this, false);
WriteError(
this,
"An unknown error while checking the control.",
"CheckingControl",
ErrorCategory.InvalidResult,
true);
return;
}
// 20140312
// if (isEnabledOrIsVisible) {
// Wait = !(_control.Current).IsEnabled;
// } else {
// Wait = (_control.Current).IsOffscreen;
// }
Wait = isEnabledOrIsVisible ? !(_control.GetCurrent()).IsEnabled : (_control.GetCurrent()).IsOffscreen;
if ((nowDate - StartDate).TotalSeconds > Timeout / 1000)
{
// 20140312
// WriteVerbose(this, "timeout expired for AutomationId: " +
// _control.Current.AutomationId +
// ", title: " +
// _control.Current.Name);
// 20140312
// WriteError(
// this,
// CmdletName(this) + ": timeout expired for AutomationId: " +
// _control.Current.AutomationId +
// ", title: " +
// _control.Current.Name,
// "TimeoutExpired",
// ErrorCategory.OperationTimeout,
// true);
WriteError(
this,
CmdletName(this) + ": timeout expired for AutomationId: " +
_control.GetCurrent().AutomationId +
", title: " +
_control.GetCurrent().Name,
"TimeoutExpired",
ErrorCategory.OperationTimeout,
true);
}
if (_control != null) continue;
} while (Wait);
}
开发者ID:universsky,项目名称:STUPS,代码行数:77,代码来源:WaitCmdletBase.cs
示例19: UiaTablePattern
public UiaTablePattern(IUiElement element)
{
_element = element;
}
开发者ID:apetrovskiy,项目名称:STUPS,代码行数:4,代码来源:UiaTablePattern.cs
示例20: UiaInvokePattern
public UiaInvokePattern(IUiElement element, classic.InvokePattern invokePattern)
{
this._invokePattern = invokePattern;
this._element = element;
//this._useCache = useCache;
}
开发者ID:MatkoHanus,项目名称:STUPS,代码行数:6,代码来源:UiaInvokePattern.cs
注:本文中的IUiElement类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论