public static void RegisterClassHandler(Type classType, RoutedEvent routedEvent, Delegate handler, bool handledEventsToo) { lock (Synchronized) { Dictionary <RoutedEvent, List <RoutedEventHandlerInfo> > classHandlers; if (!_typedClassListeners.TryGetValue(classType, out classHandlers)) { classHandlers = new Dictionary <RoutedEvent, List <RoutedEventHandlerInfo> >(); _typedClassListeners.Add(classType, classHandlers); } List <RoutedEventHandlerInfo> handlerInfoList; if (!classHandlers.TryGetValue(routedEvent, out handlerInfoList)) { handlerInfoList = new List <RoutedEventHandlerInfo>(); classHandlers.Add(routedEvent, handlerInfoList); } var handlerInfo = new RoutedEventHandlerInfo(handler, handledEventsToo); handlerInfoList.Add(handlerInfo); } }
/// <summary> /// Adds an <see cref="RoutedEvent"/> handler to this element, using a command stencil as handler. /// </summary> /// <param name="routedEvent">Routed event identifier.</param> /// <param name="handler">Handler for the event.</param> /// <param name="handledEventsToo"><c>true</c> if the handler should be invoked for events that has been marked as handled; <c>false</c> for the default behavior.</param> public void AddHandler(RoutedEvent routedEvent, ICommandStencil handler, bool handledEventsToo) { List<RoutedEventHandlerInfo> handlerList; if (!_eventHandlerDictionary.TryGetValue(routedEvent, out handlerList)) { handlerList = new List<RoutedEventHandlerInfo>(1); _eventHandlerDictionary.Add(routedEvent, handlerList); } var handlerInfo = new RoutedEventHandlerInfo(handler, handledEventsToo); handlerList.Add(handlerInfo); }
public static void RegisterClassHandler(Type classType, RoutedEvent routedEvent, Delegate handler, bool handledEventsToo) { lock (Synchronized) { Dictionary<RoutedEvent, List<RoutedEventHandlerInfo>> classHandlers; if (!_typedClassListeners.TryGetValue(classType, out classHandlers)) { classHandlers = new Dictionary<RoutedEvent, List<RoutedEventHandlerInfo>>(); _typedClassListeners.Add(classType, classHandlers); } List<RoutedEventHandlerInfo> handlerInfoList; if (!classHandlers.TryGetValue(routedEvent, out handlerInfoList)) { handlerInfoList = new List<RoutedEventHandlerInfo>(); classHandlers.Add(routedEvent, handlerInfoList); } var handlerInfo = new RoutedEventHandlerInfo(handler, handledEventsToo); handlerInfoList.Add(handlerInfo); } }