Ejemplo n.º 1
0
            public override bool Equals(object obj)
            {
                ClassHandlerKey other = obj as ClassHandlerKey;

                return(Object.ReferenceEquals(this, other) || !Object.ReferenceEquals(other, null) &&
                       Object.Equals(this.ClassType, other.ClassType) &&
                       Object.Equals(this.RoutedEvent, other.RoutedEvent));
            }
Ejemplo 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);
        }
Ejemplo 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();
        }
Ejemplo 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);
        }
Ejemplo n.º 5
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());
        }