private static void AddRoutedEventHandler( Hashtable table, RoutedEvent routedEvent, RoutedEventHandler handler, bool handledEventsToo) { if (routedEvent == null || handler == null) { throw new ArgumentNullException(); } // Create a new RoutedEventHandler RoutedEventHandlerInfo routedEventHandlerInfo = new RoutedEventHandlerInfo(handler, handledEventsToo); // Get the entry corresponding to the given RoutedEvent ArrayList handlers = (ArrayList)table[routedEvent]; if (handlers == null) { table[routedEvent] = (handlers = new ArrayList()); } // Add the RoutedEventHandlerInfo to the list handlers.Add(routedEventHandlerInfo); }
private bool HasClickEventHandler(object objectWithEvent) { object eventStore = objectWithEvent.GetType() .GetProperty("EventHandlersStore", BindingFlags.Instance | BindingFlags.NonPublic) .GetValue(objectWithEvent, null); if (eventStore != null) { RoutedEventHandlerInfo clickEvent = ((RoutedEventHandlerInfo[])eventStore .GetType() .GetMethod("GetRoutedEventHandlers", BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic) .Invoke(eventStore, new object[] { Button.ClickEvent })) .FirstOrDefault(); if (clickEvent == default) { return(false); } return(clickEvent.Handler?.Method.Name != null); } return(false); }
public bool Equals(RoutedEventHandlerInfo handlerInfo) { return(this == handlerInfo); }
/// <summary> /// Is the given RoutedEventHandlerInfo equals the current /// </summary> public bool Equals(RoutedEventHandlerInfo handlerInfo) => this._handler == handlerInfo._handler && this._handledEventsToo == handlerInfo._handledEventsToo;
/// <summary> /// Equalses the specified handler information. /// </summary> /// <param name="handlerInfo">The handler information.</param> /// <returns><c>true</c> if XXXX, <c>false</c> otherwise.</returns> public bool Equals(RoutedEventHandlerInfo handlerInfo) { return (this.Handler == handlerInfo.Handler) && (this.InvokeHandledEventsToo == handlerInfo.InvokeHandledEventsToo); }
public bool Equals(RoutedEventHandlerInfo handlerInfo) { return this == handlerInfo; }
// Constructor for RouteItem internal RouteItem(object target, RoutedEventHandlerInfo routedEventHandlerInfo) { this._target = target; this._routedEventHandlerInfo = routedEventHandlerInfo; }