////////////////////////////////////////////////////////////////////////////////////////////////////////////// // // InvokeLinkInternal() // // Invoke a hyperlink in the browser window. // // Runs on the background thread. // ////////////////////////////////////////////////////////////////////////////////////////////////////////////// private void InvokeLinkInternal(IUIAutomationElement elementLink, bool fUseCache) { if (elementLink != null) { IUIAutomationInvokePattern pattern = null; int iPatternId = _patternIdInvoke; // Will we be calling the Invoke() method through the Invoke pattern. // So first get the pattern for the hyperlink element. if (fUseCache) { // This does not result in a cross-proc call here, and should not fail. pattern = (IUIAutomationInvokePattern)elementLink.GetCachedPattern(iPatternId); } else { // This will fail if the element no longer exists. try { pattern = (IUIAutomationInvokePattern)elementLink.GetCurrentPattern(iPatternId); } catch { // If an exception is throw trying to access the element, do nothing. This will // occur if the element no longer exists, (eg the browser window has been closed.) } } if (pattern != null) { pattern.Invoke(); } } }
protected override void Dispose(bool disposing) { if (Pattern != null) { System.Runtime.InteropServices.Marshal.ReleaseComObject(Pattern); this.Pattern = null; } base.Dispose(disposing); }
public InvokePattern(A11yElement e, IUIAutomationInvokePattern p) : base(e, PatternType.UIA_InvokePatternId) { Pattern = p; this.IsUIActionable = true; }
internal static InvokePattern Wrap( AutomationElement element, IUIAutomationInvokePattern invokePattern) { return(new InvokePattern(element: element, invokePattern: invokePattern)); }
InvokePattern(AutomationElement element, IUIAutomationInvokePattern invokePattern) : base(el: element) { this._invokePattern = invokePattern; }
public static IUIAutomationElement xtInvoke(this IUIAutomationElement element) { _InvokePattern = (IUIAutomationInvokePattern)element.GetCurrentPattern(UIA_PatternIds.UIA_InvokePatternId); try { _InvokePattern.Invoke(); } catch (COMException com) { } return(element); }
public UiAutomationInvokeHint(IntPtr owningWindow, IUIAutomationInvokePattern invokePattern, Rect boundingRectangle) : base(owningWindow, boundingRectangle) { _invokePattern = invokePattern; }
private InvokePattern(AutomationElement el, IUIAutomationInvokePattern pattern, bool cached) : base(el, cached) { Debug.Assert(pattern != null); this._pattern = pattern; }