예제 #1
0
            /// <summary>
            /// Constructor</summary>
            /// <param name="manager">The value changed event manager</param>
            /// <param name="source">The source of the value changed event</param>
            /// <param name="pd">The property descriptor of the value that changed</param>
            public ValueChangedRecord(ValueChangedEventManager manager, object source, PropertyDescriptor pd)
            {
                // keep a strong reference to the source.  Normally we avoid this, but
                // it's OK here since its scope is exactly the same as the strong reference
                // held by the PD:  begins with pd.AddValueChanged, ends with
                // pd.RemoveValueChanged.   This ensures that we _can_ call RemoveValueChanged
                // even in cases where the source implements value-semantics (which
                // confuses the PD - see 795205).
                m_manager   = manager;
                m_source    = new WeakReference(source);
                m_pd        = pd;
                m_eventArgs = new ValueChangedEventArgs(pd);

                pd.AddValueChanged(source, new EventHandler(OnValueChanged));
            }
예제 #2
0
            /// <summary>
            /// Constructor</summary>
            /// <param name="manager">The value changed event manager</param>
            /// <param name="source">The source of the value changed event</param>
            /// <param name="pd">The property descriptor of the value that changed</param>
            public ValueChangedRecord(ValueChangedEventManager manager, object source, PropertyDescriptor pd)
            {
                // keep a strong reference to the source.  Normally we avoid this, but
                // it's OK here since its scope is exactly the same as the strong reference
                // held by the PD:  begins with pd.AddValueChanged, ends with
                // pd.RemoveValueChanged.   This ensures that we _can_ call RemoveValueChanged
                // even in cases where the source implements value-semantics (which
                // confuses the PD - see 795205).
                m_manager = manager;
                m_source = new WeakReference(source);
                m_pd = pd;
                m_eventArgs = new ValueChangedEventArgs(pd);

                pd.AddValueChanged(source, new EventHandler(OnValueChanged));
            }