/// <summary> /// Creates a <see cref="Window"/> element. /// </summary> public Window(FrameworkAutomationElementBase frameworkAutomationElement, ILoggingService loggingService, string pathToConfigFile) : base(frameworkAutomationElement) { CacheService = new CacheService(pathToConfigFile, loggingService); if (loggingService == null) { _loggingService = new LoggingService(); } else { _loggingService = loggingService; } }
protected override void Execute(CodeActivityContext context) { try { string attrName = AttrName.Get(context); object attrValue = AttrValue.Get(context); Int32 timeOut = TimeOut.Get(context); bool isFoundFlag = false; UiElement element = Common.GetValueOrDefault(context, this.Element, null); AutomationElement autoEle = element.NativeObject as AutomationElement; FrameworkAutomationElementBase baseFrame = autoEle.FrameworkAutomationElement; PropertyId[] ids = autoEle.GetSupportedPropertiesDirect(); PropertyId currentId = null; for (int i = 0; i < ids.Length; i++) { if (String.Equals(ids[i].Name, attrName, StringComparison.CurrentCultureIgnoreCase)) { currentId = ids[i]; break; } } for (int i = 0; i < timeOut / 1000; i++) { if (attrValue == baseFrame.GetPropertyValue(currentId)) { isFoundFlag = true; break; } Thread.Sleep(1000); } if (!isFoundFlag && !ContinueOnError.Get(context)) { SharedObject.Instance.Output(SharedObject.enOutputType.Error, "相应元素的属性值未匹配,获取属性失败"); throw new Exception("获取属性失败,过程中断"); } } catch (Exception e) { SharedObject.Instance.Output(SharedObject.enOutputType.Error, "等待获取元素属性过程出错", e.Message); if (ContinueOnError.Get(context)) { return; } else { throw e; } } }
protected override void Execute(CodeActivityContext context) { try { var selStr = Selector.Get(context); object attrValue = null; string attrName = AttrName.Get(context); UiElement element = Common.GetValueOrDefault(context, this.Element, null); if (element == null && selStr != null) { element = UiElement.FromSelector(selStr); } AutomationElement autoEle = element.NativeObject as AutomationElement; FrameworkAutomationElementBase baseFrame = autoEle.FrameworkAutomationElement; PropertyId[] ids = autoEle.GetSupportedPropertiesDirect(); for (int i = 0; i < ids.Length; i++) { if (String.Equals(ids[i].Name, attrName, StringComparison.CurrentCultureIgnoreCase)) { attrValue = baseFrame.GetPropertyValue(ids[i]); break; } } if (attrValue == null) { Result.Set(context, ""); } else { Result.Set(context, attrValue); } } catch (Exception e) { SharedObject.Instance.Output(SharedObject.enOutputType.Error, "获取元素属性失败", e.Message); if (ContinueOnError.Get(context)) { return; } else { throw e; } } }
protected DragPatternBase(FrameworkAutomationElementBase frameworkAutomationElement, TNativePattern nativePattern) : base(frameworkAutomationElement, nativePattern) { }
/// <summary> /// Creates a <see cref="Menu"/> element. /// </summary> public Menu(FrameworkAutomationElementBase frameworkAutomationElement) : base(frameworkAutomationElement) { }
protected NotificationEventHandlerBase(FrameworkAutomationElementBase frameworkElement, Action <SHAutomationElement, NotificationKind, NotificationProcessing, string, string> callAction) : base(frameworkElement) { _callAction = callAction; }
public TogglePattern(FrameworkAutomationElementBase frameworkAutomationElement, UIA.TogglePattern nativePattern) : base(frameworkAutomationElement, nativePattern) { }
/// <summary> /// Creates a <see cref="RadioButton"/> element. /// </summary> public RadioButton(FrameworkAutomationElementBase frameworkAutomationElement) : base(frameworkAutomationElement) { }
public TransformPattern(FrameworkAutomationElementBase frameworkAutomationElement, UIA.IUIAutomationTransformPattern nativePattern) : base(frameworkAutomationElement, nativePattern) { }
/// <summary> /// Creates a <see cref="ComboBoxItem"/> element. /// </summary> public ComboBoxItem(FrameworkAutomationElementBase frameworkAutomationElement) : base(frameworkAutomationElement) { }
/// <summary> /// Creates an element with a <see cref="IInvokePattern"/>. /// </summary> public InvokeAutomationElement(FrameworkAutomationElementBase frameworkAutomationElement) : base(frameworkAutomationElement) { }
public DropTargetPattern(FrameworkAutomationElementBase frameworkAutomationElement, UIA.IUIAutomationDropTargetPattern nativePattern) : base(frameworkAutomationElement, nativePattern) { }
public VirtualizedItemPattern(FrameworkAutomationElementBase frameworkAutomationElement, UIA.VirtualizedItemPattern nativePattern) : base(frameworkAutomationElement, nativePattern) { }
/// <summary> /// Creates a <see cref="TreeItem"/> element. /// </summary> public TreeItem(FrameworkAutomationElementBase frameworkAutomationElement) : base(frameworkAutomationElement) { _selectionItemAutomationElement = new SelectionItemAutomationElement(frameworkAutomationElement); _expandCollapseAutomationElement = new ExpandCollapseAutomationElement(frameworkAutomationElement); }
protected Transform2PatternBase(FrameworkAutomationElementBase frameworkAutomationElement, TNativePattern nativePattern) : base(frameworkAutomationElement, nativePattern) { }
public ScrollPattern(FrameworkAutomationElementBase frameworkAutomationElement, UIA.IUIAutomationScrollPattern nativePattern) : base(frameworkAutomationElement, nativePattern) { }
public ObjectModelPattern(FrameworkAutomationElementBase frameworkAutomationElement, UIA.IUIAutomationObjectModelPattern nativePattern) : base(frameworkAutomationElement, nativePattern) { }
/// <summary> /// Creates a <see cref="Window"/> element. /// </summary> public Window(FrameworkAutomationElementBase frameworkAutomationElement) : base(frameworkAutomationElement) { }
public WindowPattern(FrameworkAutomationElementBase frameworkAutomationElement, UIA.IUIAutomationWindowPattern nativePattern) : base(frameworkAutomationElement, nativePattern) { }
public UIA3StructureChangedEventHandler(FrameworkAutomationElementBase frameworkElement, Action <SHAutomationElement, StructureChangeType, int[]> callAction) : base(frameworkElement, callAction) { }
/// <summary> /// Creates a <see cref="DataGridViewHeader"/> element. /// </summary> public DataGridViewHeader(FrameworkAutomationElementBase frameworkAutomationElement) : base(frameworkAutomationElement) { }
protected LegacyIAccessiblePatternBase(FrameworkAutomationElementBase frameworkAutomationElement, TNativePattern nativePattern) : base(frameworkAutomationElement, nativePattern) { }
/// <summary> /// Creates a <see cref="Spinner"/> element. /// </summary> public Spinner(FrameworkAutomationElementBase frameworkAutomationElement) : base(frameworkAutomationElement) { }
public ValuePattern(FrameworkAutomationElementBase frameworkAutomationElement, UIA.IUIAutomationValuePattern nativePattern) : base(frameworkAutomationElement, nativePattern) { }
public DockPattern(FrameworkAutomationElementBase frameworkAutomationElement, UIA.DockPattern nativePattern) : base(frameworkAutomationElement, nativePattern) { }
/// <summary> /// Creates an element with a <see cref="ITogglePattern"/>. /// </summary> public ToggleAutomationElement(FrameworkAutomationElementBase frameworkAutomationElement) : base(frameworkAutomationElement) { }
/// <summary> /// Creates a <see cref="TextBox"/> element. /// </summary> public TextBox(FrameworkAutomationElementBase frameworkAutomationElement) : base(frameworkAutomationElement) { }
/// <summary> /// Creates a <see cref="SelectionItemAutomationElement"/> element. /// </summary> public SelectionItemAutomationElement(FrameworkAutomationElementBase frameworkAutomationElement) : base(frameworkAutomationElement) { }
public TableItemPattern(FrameworkAutomationElementBase frameworkAutomationElement, UIA.IUIAutomationTableItemPattern nativePattern) : base(frameworkAutomationElement, nativePattern) { }
public ItemContainerPattern(FrameworkAutomationElementBase frameworkAutomationElement, UIA.IUIAutomationItemContainerPattern nativePattern) : base(frameworkAutomationElement, nativePattern) { }