Exemplo n.º 1
0
 public static void Add(EventListener listener)
 {
     lock (_events)
     {
         _events.AddLast(listener);
     }
 }
Exemplo n.º 2
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;
     }
 }