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)); }
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); }
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(); }
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); }
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()); }