示例#1
0
        /// <summary>
        /// Removes event handler for the specified window and element
        /// </summary>
        /// <param name="hWnd">window handle</param>
        /// <param name="autoEvent">the event to remove</param>
        /// <param name="element">the automation element</param>
        static public void RemoveAutomationEventHandler(IntPtr hWnd, AutomationEvent autoEvent, AutomationElement element)
        {
            Log.Debug("hWnd=" + hWnd);
            if (hWnd != IntPtr.Zero)
            {
                lock (WindowTable)
                {
                    var windowElement = (WindowElement)WindowTable[hWnd];
                    if (windowElement != null)
                    {
                        var item = new RemoveEventHandlerItem
                        {
                            AutoEvent   = autoEvent,
                            AutoElement = element,
                            WinElement  = windowElement
                        };
                        RemoveAutomationEvent(item);

                        //windowElement.RemoveAutomationEventHandler(element, autoEvent);
                    }
                }
            }
        }
示例#2
0
 /// <summary>
 /// Enqueues a request for the item for asynchronous handling
 /// </summary>
 /// <param name="item">item to add</param>
 private static void RemoveAutomationEvent(RemoveEventHandlerItem item)
 {
     _instance._queue.Enqueue(item);
 }
示例#3
0
 /// <summary>
 /// Enqueues a request for the item for asynchronous handling
 /// </summary>
 /// <param name="item">item to add</param>
 private static void RemoveAutomationEvent(RemoveEventHandlerItem item)
 {
     _instance._queue.Enqueue(item);
 }
示例#4
0
        /// <summary>
        /// Removes event handler for the specified window and element
        /// </summary>
        /// <param name="hWnd">window handle</param>
        /// <param name="autoEvent">the event to remove</param>
        /// <param name="element">the automation element</param>
        static public void RemoveAutomationEventHandler(IntPtr hWnd, AutomationEvent autoEvent, AutomationElement element)
        {
            Log.Debug("hWnd=" + hWnd);
            if (hWnd != IntPtr.Zero)
            {
                lock (WindowTable)
                {
                    var windowElement = (WindowElement)WindowTable[hWnd];
                    if (windowElement != null)
                    {
                        var item = new RemoveEventHandlerItem
                        {
                            AutoEvent = autoEvent,
                            AutoElement = element,
                            WinElement = windowElement
                        };
                        RemoveAutomationEvent(item);

                        //windowElement.RemoveAutomationEventHandler(element, autoEvent);
                    }
                }
            }
        }