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

                return(Object.ReferenceEquals(this, other) || !Object.ReferenceEquals(other, null) &&
                       Object.Equals(this.Owner, other.Owner) &&
                       Object.Equals(this.Name, other.Name));
            }
Exemplo n.º 2
0
        public static void AddOwner(RoutedEvent routedEvent, Type ownerType)
        {
            RoutedEventHashKey key = new RoutedEventHashKey(ownerType, routedEvent.Name);

            if (registeredEvents.ContainsKey(key))
            {
                throw new Granular.Exception("Type \"{0}\" is already an owner of RoutedEvent \"{1}\"", key.Owner.Name, routedEvent);
            }

            registeredEvents.Add(key, routedEvent);
        }
Exemplo n.º 3
0
        public static RoutedEvent RegisterRoutedEvent(string name, RoutingStrategy routingStrategy, Type handlerType, Type ownerType)
        {
            RoutedEventHashKey key = new RoutedEventHashKey(ownerType, name);

            if (registeredEvents.ContainsKey(key))
            {
                throw new Granular.Exception("RoutedEvent {0}.{1} is already registered", ownerType.Name, name);
            }

            RoutedEvent routedEvent = new RoutedEvent(name, routingStrategy, handlerType, ownerType);

            registeredEvents.Add(key, routedEvent);

            return(routedEvent);
        }