Exemplo n.º 1
0
 public EventRouteItem(RoutedEventHandlerItem handler, object originalSource, object source, object target)
 {
     this.handler = handler;
     this.originalSource = originalSource;
     this.source = source;
     this.target = target;
 }
Exemplo n.º 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);
        }
Exemplo n.º 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();
        }
Exemplo n.º 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);
        }