Beispiel #1
0
 /// <summary>
 /// Creates the handlers link.
 /// </summary>
 /// <param name="routedEvent">The routed event.</param>
 /// <param name="handlers">The handlers.</param>
 /// <returns>System.Int32.</returns>
 internal int CreateHandlersLink(RoutedEvent routedEvent, RoutedEventHandlerInfoList handlers)
 {
     var item = new ClassHandlers();
     item.RoutedEvent = routedEvent;
     item.Handlers = handlers;
     item.HasSelfHandlers = false;
     this.eventHandlersList.Add(item);
     return this.eventHandlersList.Count - 1;
 }
Beispiel #2
0
 /// <summary>
 /// Gets the index of the handlers.
 /// </summary>
 /// <param name="routedEvent">The routed event.</param>
 /// <returns>System.Int32.</returns>
 internal int GetHandlersIndex(RoutedEvent routedEvent)
 {
     for (var i = 0; i < this.eventHandlersList.Count; i++)
     {
         if (this.eventHandlersList.List[i].RoutedEvent == routedEvent)
         {
             return i;
         }
     }
     return -1;
 }
Beispiel #3
0
 /// <summary>
 /// Updates the sub class handlers.
 /// </summary>
 /// <param name="routedEvent">The routed event.</param>
 /// <param name="baseClassListeners">The base class listeners.</param>
 internal void UpdateSubClassHandlers(RoutedEvent routedEvent, RoutedEventHandlerInfoList baseClassListeners)
 {
     var handlersIndex = this.GetHandlersIndex(routedEvent);
     if (handlersIndex != -1)
     {
         var hasSelfHandlers = this.eventHandlersList.List[handlersIndex].HasSelfHandlers;
         var handlers = hasSelfHandlers ? this.eventHandlersList.List[handlersIndex].Handlers.Next : this.eventHandlersList.List[handlersIndex].Handlers;
         var flag = false;
         if (handlers != null)
         {
             if ((baseClassListeners.Next != null) && baseClassListeners.Next.Contains(handlers))
             {
                 flag = true;
             }
         }
         else
         {
             flag = true;
         }
         if (flag)
         {
             if (hasSelfHandlers)
             {
                 this.eventHandlersList.List[handlersIndex].Handlers.Next = baseClassListeners;
             }
             else
             {
                 this.eventHandlersList.List[handlersIndex].Handlers = baseClassListeners;
             }
         }
     }
 }