Ejemplo n.º 1
0
        //
        //  Private Methods
        //

        // PropertyChanged is a special case - we superimpose per-property granularity
        // on top of this event, by keeping separate lists of listeners for
        // each property.

        // Add a listener to the named property (empty means "any property")
        private void PrivateAddHandler(Type type, EventHandler <PropertyChangedEventArgs> handler, string propertyName)
        {
            Debug.Assert(handler != null && type != null && propertyName != null,
                         "Handler, type, and propertyName of event cannot be null");

            using (WriteLock)
            {
                TypeRecord tr = (TypeRecord)this[type];

                if (tr == null)
                {
                    // no entry in the hashtable - add a new one
                    tr = new TypeRecord(type, this);

                    this[type] = tr;

                    // listen for the desired events
                    tr.StartListening();
                }

                tr.AddHandler(handler, propertyName);
            }
        }
        //
        //  Private Methods
        //

        // PropertyChanged is a special case - we superimpose per-property granularity
        // on top of this event, by keeping separate lists of listeners for
        // each property.

        // Add a listener to the named property (empty means "any property")
        private void PrivateAddHandler(Type type, EventHandler<PropertyChangedEventArgs> handler, string propertyName)
        {
            Debug.Assert(handler != null && type != null && propertyName != null,
                "Handler, type, and propertyName of event cannot be null");

            using (WriteLock)
            {
                TypeRecord tr = (TypeRecord)this[type];

                if (tr == null)
                {
                    // no entry in the hashtable - add a new one
                    tr = new TypeRecord(type, this);

                    this[type] = tr;

                    // listen for the desired events
                    tr.StartListening();
                }

                tr.AddHandler(handler, propertyName);
            }
        }