public void RemoveAutomationEventHandler(classic.AutomationEvent eventId, IUiElement element, classic.AutomationEventHandler eventHandler) { classic.Automation.RemoveAutomationEventHandler( eventId, element.GetSourceElement() as classic.AutomationElement, eventHandler); }
public UiEltCollection(classic.AutomationElementCollection elements) { foreach (classic.AutomationElement element in elements.Cast<classic.AutomationElement>().Where(element => null != element)) { _collectionHolder.Add(AutomationFactory.GetUiElement(element)); } }
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); }
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); }
public static IUiElement PerformSetDockPosition(this IUiElement element, classic.DockPosition dockPosition) { // try { element.GetCurrentPattern<IDockPattern>(classic.DockPattern.Pattern).SetDockPosition(dockPosition); // } catch (Exception eExtensionMethod) { // // // // throw; // } return element; }
public UiaExpandCollapsePattern(IUiElement element, classic.ExpandCollapsePattern expandCollapsePattern) { _expandCollapsePattern = expandCollapsePattern; _element = element; //this._useCache = useCache; }
public UiElementInformation(classic.AutomationElement.AutomationElementInformation information) { _infoHolder = information; }
public UiaTablePattern(IUiElement element, classic.TablePattern tablePattern) { _tablePattern = tablePattern; _element = element; //this._useCache = useCache; }
public UiaSelectionPattern(IUiElement element, classic.SelectionPattern selectionPattern) { this._selectionPattern = selectionPattern; this._element = element; //this._useCache = useCache; }
public UiaValuePattern(classic.ValuePattern valuePattern) { _valuePattern = valuePattern; }
public UiaWindowPattern(IUiElement element, classic.WindowPattern windowPattern) { this._windowPattern = windowPattern; this._element = element; //this._useCache = useCache; }
// private UiaWindowPattern(AutomationElement el, SafePatternHandle hPattern, bool cached) : base(el, hPattern) // { // this._hPattern = hPattern; // this._cached = cached; // } public virtual void SetWindowVisualState(classic.WindowVisualState state) { // UiaCoreApi.WindowPattern_SetWindowVisualState(this._hPattern, state); this._windowPattern.SetWindowVisualState(state); }
internal void CallDockPatternForSet(PatternCmdletBase cmdlet, IUiElement control, IUiElement inputObject, classic.DockPosition position) { // try { // // 20131208 // // DockPattern dockPattern = control.GetCurrentPattern(classic.DockPattern.Pattern) as DockPattern; // // DockPattern dockPattern = control.GetCurrentPattern<IDockPattern, DockPattern>(classic.DockPattern.Pattern) as DockPattern; // 20140102 try { control.PerformSetDockPosition(position); if (PassThru) { WriteObject(this, control); } else { WriteObject(this, true); } } catch { WriteObject(this, false); } // IDockPattern dockPattern = control.GetCurrentPattern<IDockPattern>(classic.DockPattern.Pattern); // if (null != dockPattern) { // dockPattern.SetDockPosition(position); // // if (PassThru && null != (inputObject as IUiElement)) { // WriteObject(this, inputObject); // } else { // WriteObject(this, true); // } // } else { // WriteVerbose(this, "couldn't get DockPattern"); // WriteObject(this, false); // } // } // catch { // // } }
public UiaTogglePattern(IUiElement element, classic.TogglePattern togglePattern) { _togglePattern = togglePattern; _element = element; //this._useCache = useCache; }
protected bool checkNotNull(object objectToTest, classic.AutomationEventArgs e) { // 20131109 //AutomationElement sourceElement; // 20131118 //IUiElement sourceElement; /* AutomationElement sourceElement; */ try { // 20131109 //sourceElement = objectToTest as AutomationElement; // 20131118 //sourceElement = objectToTest as IUiElement; classic.AutomationElement sourceElement = objectToTest as classic.AutomationElement; // 20131109 //this.EventSource = sourceElement; // 20131118 // property to method //this.EventSource = sourceElement.SourceElement; // 20131118 //this.EventSource = sourceElement.GetSourceElement(); EventSource = sourceElement; EventArgs = e; } catch { //(ElementNotAvailableException eNotAvailable) { return false; } return true; }
public UiaInvokePattern(classic.InvokePattern InvokePattern) { this._invokePattern = InvokePattern; }
public UiaValuePattern(IUiElement element, classic.ValuePattern valuePattern) { _valuePattern = valuePattern; _element = element; //this._useCache = useCache; }
public UiaRangeValuePattern(IUiElement element, classic.RangeValuePattern rangeValuePattern) { _rangeValuePattern = rangeValuePattern; _element = element; //this._useCache = useCache; }
public static IUiElement PerformSetWindowVisualState(this IUiElement element, classic.WindowVisualState state) { try { element.GetCurrentPattern<IWindowPattern>(classic.WindowPattern.Pattern).SetWindowVisualState(state); } catch (Exception eExtensionMethod) { // // throw; } return element; }
public static IUiElement PerformSetDockPosition(this IUiElement element, classic.DockPosition dockPosition) { element.GetCurrentPattern<IDockPattern>(classic.DockPattern.Pattern).SetDockPosition(dockPosition); return element; }
public static IUiElement PerformScrollVertical(this IUiElement element, classic.ScrollAmount amount) { try { element.GetCurrentPattern<IScrollPattern>(classic.ScrollPattern.Pattern).ScrollVertical(amount); } catch (Exception eExtensionMethod) { // // throw; } return element; }
public static IUiElement PerformScroll(this IUiElement element, classic.ScrollAmount horizontalAmount, classic.ScrollAmount verticalAmount) { try { element.GetCurrentPattern<IScrollPattern>(classic.ScrollPattern.Pattern).Scroll(horizontalAmount, verticalAmount); } catch (Exception) { // // throw; } return element; }
protected override void SaveEventInput( // 20131109 classic.AutomationElement src, //IUiElement src, classic.AutomationEventArgs e, string programmaticName, bool infoAdded) { // inform the Wait-UiaEventRaised cmdlet try { // 20131109 //CurrentData.LastEventSource = src; //.SourceElement; // as AutomationElement; // 20131112 //CurrentData.LastEventSource = new UiElement(src); CurrentData.LastEventSource = AutomationFactory.GetUiElement(src); CurrentData.LastEventArgs = e; // as AutomationEventArgs; CurrentData.LastEventType = programmaticName; CurrentData.LastEventInfoAdded = infoAdded; } catch { //WriteVerbose(this, "failed to register an event in the collection"); } }
internal static List<IUiElement> SearchByContainsTextViaUia( IUiElement inputObject, classic.Condition conditionsForTextSearch) { IUiEltCollection textSearchCollection = inputObject.FindAll(classic.TreeScope.Descendants, conditionsForTextSearch); return textSearchCollection.Cast<IUiElement>().ToList(); }
/// <summary> /// /// </summary> /// <param name="element"></param> /// <param name="scope"></param> /// <returns></returns> internal static IUiElement[] GetParentOrAncestor(this IUiElement element, classic.TreeScope scope) { var walker = new classic.TreeWalker( classic.Condition.TrueCondition); var ancestors = new List<IUiElement>(); try { IUiElement testParent = AutomationFactory.GetUiElement(walker.GetParent(element.GetSourceElement() as classic.AutomationElement)); if (scope == classic.TreeScope.Parent || scope == classic.TreeScope.Ancestors) { if (testParent.GetCurrent() != UiElement.RootElement.GetCurrent()) { ancestors.Add(testParent); } if ((testParent.Equals(UiElement.RootElement) && testParent.GetCurrent().Equals(UiElement.RootElement.GetCurrent())) || scope == classic.TreeScope.Parent) { return ancestors.ToArray(); } } while (testParent != null && (int)testParent.GetCurrent().ProcessId > 0 && !testParent.GetCurrent().Equals(UiElement.RootElement.GetCurrent())) { testParent = AutomationFactory.GetUiElement(walker.GetParent(testParent.GetSourceElement() as classic.AutomationElement)); if (testParent != null && (int)testParent.GetCurrent().ProcessId > 0 && !testParent.GetCurrent().Equals(UiElement.RootElement.GetCurrent())) { ancestors.Add(testParent); } else { break; } } return ancestors.ToArray(); } catch { return ancestors.ToArray(); } }
internal static List<IUiElement> SearchByExactConditionsViaUia( IUiElement inputObject, Hashtable[] searchCriteria, classic.Condition conditions) { if (conditions == null) return new List<IUiElement>(); if (inputObject == null || (int) inputObject.GetCurrent().ProcessId <= 0) return new List<IUiElement>(); IUiEltCollection tempCollection = inputObject.FindAll(classic.TreeScope.Descendants, conditions); if (null == searchCriteria || 0 == searchCriteria.Length) { return tempCollection.ToArray().ToList<IUiElement>(); } return tempCollection.ToArray().Where(element => TestControlWithAllSearchCriteria(searchCriteria, element)).ToList<IUiElement>(); }
public UiaGridItemPattern(IUiElement element, classic.GridItemPattern gridItemPattern) { this._gridItemPattern = gridItemPattern; this._element = element; //this._useCache = useCache; }
internal static List<IUiElement> SearchByWildcardOrRegexViaUia( IUiElement inputObject, ControlSearcherData data, classic.Condition conditionsForWildCards, bool viaWildcardOrRegex) { var resultCollection = new List<IUiElement>(); if (null == inputObject) return resultCollection; try { var controlSearcherData = new ControlSearcherData { InputObject = data.InputObject ?? (new UiElement[]{ (UiElement)UiElement.RootElement }), Name = data.Name, AutomationId = data.AutomationId, Class = data.Class, Value = data.Value, ControlType = null != data.ControlType && 0 < data.ControlType.Length ? data.ControlType : (new string[] {}), CaseSensitive = caseSensitive }; var cmdlet1 = new GetControlCollectionCmdletBase(controlSearcherData); try { List<IUiElement> tempList = cmdlet1.GetAutomationElementsViaWildcards_FindAll( controlSearcherData, inputObject, conditionsForWildCards, cmdlet1.CaseSensitive, false, false, viaWildcardOrRegex); if (null == data.SearchCriteria || 0 == data.SearchCriteria.Length) { resultCollection.AddRange(tempList); } else { foreach (IUiElement tempElement2 in tempList.Where(elt => TestControlWithAllSearchCriteria(data.SearchCriteria, elt))) { resultCollection.Add(tempElement2); } } if (null != tempList) { tempList.Clear(); tempList = null; } return resultCollection; } catch (Exception eUnexpected) { (new GetControlCmdletBase()).WriteError( new GetControlCmdletBase(), "The input control or window has been possibly lost." + eUnexpected.Message, "UnexpectedError", ErrorCategory.ObjectNotFound, true); } cmdlet1 = null; return resultCollection; } catch (Exception eWildCardSearch) { (new GetControlCmdletBase()).WriteError( new GetControlCmdletBase(), "The input control or window has been possibly lost." + eWildCardSearch.Message, "UnexpectedError", ErrorCategory.ObjectNotFound, true); return resultCollection; } }
public UiaExpandCollapsePattern(classic.ExpandCollapsePattern ExpandCollapsePattern) { _expandCollapsePattern = ExpandCollapsePattern; }
public UiaInvokePattern(IUiElement element, classic.InvokePattern invokePattern) { this._invokePattern = invokePattern; this._element = element; //this._useCache = useCache; }