/// <summary> /// Removes a previously added property changed event handler /// </summary> /// <param name="hWnd">window handle</param> /// <param name="property">the property to remove</param> /// <param name="element">the control in the window</param> /// <param name="eventHandler">the eveht handler to remove</param> static public void RemoveAutomationPropertyChangedEventHandler(IntPtr hWnd, AutomationProperty property, AutomationElement element, AutomationPropertyChangedEventHandler eventHandler) { Log.Debug(); if (hWnd == IntPtr.Zero) { return; } lock (WindowTable) { var windowElement = (WindowElement)WindowTable[hWnd]; if (windowElement != null) { var item = new RemoveAutomationPropertyChangedItem { Property = property, AutoElement = element, EventHandler = eventHandler, WinElement = windowElement }; RemoveAutomationPropertyChanged(item); //windowElement.RemoveAutomationPropertyChangedEventHandler(element, property, eventHandler); } } }
/// <summary> /// Enqueues the item for asynchronous handling /// </summary> /// <param name="item">item to add</param> private static void RemoveAutomationPropertyChanged(RemoveAutomationPropertyChangedItem item) { _instance._queue.Enqueue(item); }
/// <summary> /// Enqueues the item for asynchronous handling /// </summary> /// <param name="item">item to add</param> private static void RemoveAutomationPropertyChanged(RemoveAutomationPropertyChangedItem item) { _instance._queue.Enqueue(item); }
/// <summary> /// Removes a previously added property changed event handler /// </summary> /// <param name="hWnd">window handle</param> /// <param name="property">the property to remove</param> /// <param name="element">the control in the window</param> /// <param name="eventHandler">the eveht handler to remove</param> static public void RemoveAutomationPropertyChangedEventHandler(IntPtr hWnd, AutomationProperty property, AutomationElement element, AutomationPropertyChangedEventHandler eventHandler) { Log.Debug(); if (hWnd == IntPtr.Zero) { return; } lock (WindowTable) { var windowElement = (WindowElement)WindowTable[hWnd]; if (windowElement != null) { var item = new RemoveAutomationPropertyChangedItem { Property = property, AutoElement = element, EventHandler = eventHandler, WinElement = windowElement }; RemoveAutomationPropertyChanged(item); //windowElement.RemoveAutomationPropertyChangedEventHandler(element, property, eventHandler); } } }