Ejemplo n.º 1
0
        public static EventListener Remove(AutomationEvent eventId, AutomationElement element, Delegate handler)
        {
            // Create a prototype to seek
            int[]         runtimeId = (element == null) ? null : element.GetRuntimeId();
            EventListener prototype = new EventListener(eventId.Id, runtimeId, handler);

            lock (_events)
            {
                LinkedListNode <EventListener> node = _events.Find(prototype);
                if (node == null)
                {
                    throw new ArgumentException("event handler not found");
                }
                EventListener result = node.Value;
                _events.Remove(node);
                return(result);
            }
        }
Ejemplo n.º 2
0
 public BasicEventListener(AutomationEvent eventKind, AutomationElement element, AutomationEventHandler handler) :
     base(eventKind.Id, element.GetRuntimeId(), handler)
 {
     Debug.Assert(handler != null);
     this._basicHandler = handler;
 }
Ejemplo n.º 3
0
 public StructureEventListener(AutomationEvent eventKind, AutomationElement element, StructureChangedEventHandler handler) :
     base(AutomationElement.StructureChangedEvent.Id, element.GetRuntimeId(), handler)
 {
     Debug.Assert(handler != null);
     this._structureChangeHandler = handler;
 }
Ejemplo n.º 4
0
 public PropertyEventListener(AutomationEvent eventKind, AutomationElement element, AutomationPropertyChangedEventHandler handler) :
     base(AutomationElement.AutomationPropertyChangedEvent.Id, element.GetRuntimeId(), handler)
 {
     Debug.Assert(handler != null);
     this._propChangeHandler = handler;
 }