예제 #1
0
        /// <summary>
        /// Removes all the automation event handlers for the
        /// specified window
        /// </summary>
        /// <param name="hwnd">window handle</param>
        static public void RemoveAllAutomationEventHandlers(IntPtr hwnd)
        {
            Log.Debug(hwnd.ToString());

            lock (WindowTable)
            {
                if (WindowTable.Contains(hwnd))
                {
                    var windowElement = (WindowElement)WindowTable[hwnd];

                    windowElement.EvtOnWindowClosed -= windowElement_EvtOnWindowClosed;
                    Log.Debug("Found " + hwnd + " in hashtable. removing it");
                    WindowTable.Remove(hwnd);

                    Log.Debug("Calling RemoveAllEvents");

                    var item = new RemoveAllEventsItem {
                        WinElement = windowElement
                    };
                    RemoveAllEvents(item);
                }
                else
                {
                    Log.Debug("Did not find " + hwnd + " in hashtable.");
                }
            }
        }
예제 #2
0
 /// <summary>
 /// Enqueues the item for asynchronous handling
 /// </summary>
 /// <param name="item">item to add</param>
 private static void RemoveAllEvents(RemoveAllEventsItem item)
 {
     _instance._queue.Enqueue(item);
 }
예제 #3
0
 /// <summary>
 /// Enqueues the item for asynchronous handling
 /// </summary>
 /// <param name="item">item to add</param>
 private static void RemoveAllEvents(RemoveAllEventsItem item)
 {
     _instance._queue.Enqueue(item);
 }
예제 #4
0
        /// <summary>
        /// Removes all the automation event handlers for the
        /// specified window
        /// </summary>
        /// <param name="hwnd">window handle</param>
        static public void RemoveAllAutomationEventHandlers(IntPtr hwnd)
        {
            Log.Debug(hwnd.ToString());

            lock (WindowTable)
            {
                if (WindowTable.Contains(hwnd))
                {
                    var windowElement = (WindowElement)WindowTable[hwnd];

                    windowElement.EvtOnWindowClosed -= windowElement_EvtOnWindowClosed;
                    Log.Debug("Found " + hwnd + " in hashtable. removing it");
                    WindowTable.Remove(hwnd);

                    Log.Debug("Calling RemoveAllEvents");

                    var item = new RemoveAllEventsItem { WinElement = windowElement };
                    RemoveAllEvents(item);
                }
                else
                {
                    Log.Debug("Did not find " + hwnd + " in hashtable.");
                }
            }
        }