/// <summary> /// Responds to button click; saves options and starts /// the UI Automation worker thread. /// </summary> /// <param name="sender">Object that raised the event.</param> /// <param name="e">Event arguments.</param> private void btnProps_Click(object sender, EventArgs e) { // Convert Drawing.Point to Windows.Point. var drawingPoint = Cursor.Position; _targetPoint = new Point(drawingPoint.X, drawingPoint.Y); // Save caching settings in member variables so UI isn't accessed // directly by the other thread. _elementMode = rbFull.Checked ? AutomationElementMode.Full : AutomationElementMode.None; // For simplicity, always include Element in scope. _cacheScope = TreeScope.Element; if (cbDescendants.Checked) { _cacheScope |= TreeScope.Descendants; } // Note: if descendants are specified, children // are automatically included. else if (cbChildren.Checked) { _cacheScope |= TreeScope.Children; } _fetcher = new UiAutomationFetcher(this, _targetPoint, _cacheScope, _elementMode); // Start another thread to do the UI Automation work. var threadDelegate = new ThreadStart(StartWorkerThread); _workerThread = new Thread(threadDelegate) {Priority = ThreadPriority.Highest}; _workerThread.Start(); OutputResults("Wait..." + Environment.NewLine); }
public void AutomationElementModeTest() { CacheRequest target = new CacheRequest(); target.AutomationElementMode = AutomationElementMode.AutomationElementMode_Full; AutomationElementMode actual = target.AutomationElementMode; Assert.AreEqual(AutomationElementMode.AutomationElementMode_Full, actual); }
/// <summary> /// Constructor. /// </summary> /// <param name="form">The application form.</param> /// <param name="targetPoint">The screen coordinates of the cursor.</param> /// <param name="scope">The TreeScope for caching.</param> /// <param name="mode">The mode for caching.</param> public UiAutomationFetcher(FetchTimerForm form, Point targetPt, TreeScope scope, AutomationElementMode cacheMode) { _appForm = form; _treeScope = scope; _targetPoint = targetPt; _mode = cacheMode; }
// Private ctor used by Clone() private CacheRequest(Condition viewCondition, TreeScope scope, ArrayList properties, ArrayList patterns, AutomationElementMode automationElementMode, UiaCoreApi.UiaCacheRequest uiaCacheRequest) { _instanceLock = new object(); _viewCondition = viewCondition; _scope = scope; _properties = properties; _patterns = patterns; _automationElementMode = automationElementMode; _uiaCacheRequest = uiaCacheRequest; }
/// <summary> /// Responds to button click; saves options and starts /// the UI Automation worker thread. /// </summary> /// <param name="sender">Object that raised the event.</param> /// <param name="e">Event arguments.</param> private void btnProps_Click(object sender, EventArgs e) { // Convert Drawing.Point to Windows.Point. System.Drawing.Point drawingPoint = Cursor.Position; targetPoint = new System.Windows.Point(drawingPoint.X, drawingPoint.Y); // Save caching settings in member variables so UI isn't accessed // directly by the other thread. if (rbFull.Checked) { elementMode = AutomationElementMode.Full; } else { elementMode = AutomationElementMode.None; } // For simplicity, always include Element in scope. cacheScope = TreeScope.Element; if (cbDescendants.Checked) { cacheScope |= TreeScope.Descendants; } // Note: if descendants are specified, children // are automatically included. else if (cbChildren.Checked) { cacheScope |= TreeScope.Children; } fetcher = new UIAutomationFetcher(this, targetPoint, cacheScope, elementMode); // Start another thread to do the UI Automation work. ThreadStart threadDelegate = new ThreadStart(StartWorkerThread); workerThread = new Thread(threadDelegate); workerThread.Priority = ThreadPriority.Highest; workerThread.Start(); OutputResults("Wait..." + Environment.NewLine); }
public CacheRequest() { mode = AutomationElementMode.Full; treeFilter = Automation.ControlViewCondition; scope = TreeScope.Element; }
public static UIAutomationClient.AutomationElementMode Convert( AutomationElementMode automationElementMode) { return((UIAutomationClient.AutomationElementMode)automationElementMode); }
public CacheRequest () { mode = AutomationElementMode.Full; treeFilter = Automation.ControlViewCondition; scope = TreeScope.Element; }
// Private ctor used by Clone() private CacheRequest( Condition viewCondition, TreeScope scope, ArrayList properties, ArrayList patterns, AutomationElementMode automationElementMode, UiaCoreApi.UiaCacheRequest uiaCacheRequest) { _instanceLock = new object(); _viewCondition = viewCondition; _scope = scope; _properties = properties; _patterns = patterns; _automationElementMode = automationElementMode; _uiaCacheRequest = uiaCacheRequest; }
internal AutomationElement (IElement sourceElement) { this.sourceElement = sourceElement; current = new AutomationElementInformation (this, false); cached = new AutomationElementInformation (this, true); propertyCache = new Dictionary<int, CachedValue> (); mode = AutomationElementMode.Full; }