Ejemplo n.º 1
0
        /// <summary>
        /// Adds a property changed automation event handler
        /// </summary>
        /// <param name="hWnd">window handle</param>
        /// <param name="property">the property to track</param>
        /// <param name="element">the element in the window to track</param>
        /// <param name="eventHandler">the event handler</param>
        static public void AddAutomationPropertyChangedEventHandler(IntPtr hWnd,
                                                                    AutomationProperty property,
                                                                    AutomationElement element,
                                                                    AutomationPropertyChangedEventHandler eventHandler)
        {
            lock (WindowTable)
            {
                var windowElement = (WindowElement)WindowTable[hWnd];
                if (windowElement == null)
                {
                    windowElement = new WindowElement(hWnd);
                    WindowTable.Add(hWnd, windowElement);
                    windowElement.EvtOnWindowClosed += windowElement_EvtOnWindowClosed;
                }
                var item = new AddAutomationPropertyChangedItem
                {
                    Property     = property,
                    AutoElement  = element,
                    EventHandler = eventHandler,
                    WinElement   = windowElement
                };

                AddAutomationPropertyChanged(item);
            }
        }
Ejemplo n.º 2
0
 /// <summary>
 /// Enqueues the item for asynchronous handling
 /// </summary>
 /// <param name="item">item to add</param>
 private static void AddAutomationPropertyChanged(AddAutomationPropertyChangedItem item)
 {
     _instance._queue.Enqueue(item);
 }
Ejemplo n.º 3
0
 /// <summary>
 /// Enqueues the item for asynchronous handling
 /// </summary>
 /// <param name="item">item to add</param>
 private static void AddAutomationPropertyChanged(AddAutomationPropertyChangedItem item)
 {
     _instance._queue.Enqueue(item);
 }
Ejemplo n.º 4
0
        /// <summary>
        /// Adds a property changed automation event handler
        /// </summary>
        /// <param name="hWnd">window handle</param>
        /// <param name="property">the property to track</param>
        /// <param name="element">the element in the window to track</param>
        /// <param name="eventHandler">the event handler</param>
        static public void AddAutomationPropertyChangedEventHandler(IntPtr hWnd,
                                                            AutomationProperty property,
                                                            AutomationElement element,
                                                            AutomationPropertyChangedEventHandler eventHandler)
        {
            lock (WindowTable)
            {
                var windowElement = (WindowElement)WindowTable[hWnd];
                if (windowElement == null)
                {
                    windowElement = new WindowElement(hWnd);
                    WindowTable.Add(hWnd, windowElement);
                    windowElement.EvtOnWindowClosed += windowElement_EvtOnWindowClosed;
                }
                var item = new AddAutomationPropertyChangedItem
                {
                    Property = property,
                    AutoElement = element,
                    EventHandler = eventHandler,
                    WinElement = windowElement
                };

                AddAutomationPropertyChanged(item);
            }
        }