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); } }
public BasicEventListener(AutomationEvent eventKind, AutomationElement element, AutomationEventHandler handler) : base(eventKind.Id, element.GetRuntimeId(), handler) { Debug.Assert(handler != null); this._basicHandler = handler; }
public StructureEventListener(AutomationEvent eventKind, AutomationElement element, StructureChangedEventHandler handler) : base(AutomationElement.StructureChangedEvent.Id, element.GetRuntimeId(), handler) { Debug.Assert(handler != null); this._structureChangeHandler = handler; }
public PropertyEventListener(AutomationEvent eventKind, AutomationElement element, AutomationPropertyChangedEventHandler handler) : base(AutomationElement.AutomationPropertyChangedEvent.Id, element.GetRuntimeId(), handler) { Debug.Assert(handler != null); this._propChangeHandler = handler; }