예제 #1
0
 public EventRouteItem(RoutedEventHandlerItem handler, object originalSource, object source, object target)
 {
     this.handler = handler;
     this.originalSource = originalSource;
     this.source = source;
     this.target = target;
 }
예제 #2
0
        private static void RegisterClassHandler(Type classType, RoutedEvent routedEvent, RoutedEventHandlerItem eventRouteItem)
        {
            ClassHandlerKey key = new ClassHandlerKey(classType, routedEvent);

            if (flattenedClassHandlersCache.Contains(key))
            {
                throw new Granular.Exception("{0} class handler for \"{1}\" has already been queried, RegisterClassHandler should only be called from {0}'s static constructor", classType.Name, routedEvent);
            }

            classHandlers.Add(key, eventRouteItem);
        }
예제 #3
0
        private static IEnumerable<RoutedEventHandlerItem> ResolveFlattenedClassHandlers(ClassHandlerKey key)
        {
            IEnumerable<RoutedEventHandlerItem> handlers = new RoutedEventHandlerItem[0];

            Type type = key.ClassType;
            while (type != null)
            {
                handlers = classHandlers.GetValues(new ClassHandlerKey(type, key.RoutedEvent)).Concat(handlers);
                type = type.BaseType;
            }

            return handlers.ToArray();
        }
예제 #4
0
        private static void RegisterClassHandler(Type classType, RoutedEvent routedEvent, RoutedEventHandlerItem eventRouteItem)
        {
            ClassHandlerKey key = new ClassHandlerKey(classType, routedEvent);

            if (flattenedClassHandlersCache.Contains(key))
            {
                throw new Granular.Exception("{0} class handler for \"{1}\" has already been queried, RegisterClassHandler should only be called from {0}'s static constructor", classType.Name, routedEvent);
            }

            classHandlers.Add(key, eventRouteItem);
        }