Пример #1
0
 /// <summary>
 /// Determine if the property corresponding to 'bit' is dirty.  If dirty, this normally indicates
 /// that a corresponding register needs to be updated in Apply().
 ///
 /// If a derived class needs to keep track of more than 32 properties, override
 /// PropertyChangePending(object) and delegate the operation to a method similar
 /// to this one that tracks more bits...
 /// </summary>
 /// <param name="bit">the bit (or bits) to clear</param>
 protected bool PropertyChangePending(CorePropertyChanged bit)
 {
     // One possible way to override this method to support more than 32 properties
     // (448 as shown) is:
     //    int index = (int)(bit & 0x000f);
     //    return ( mBigPropertyChangePending[index] & bit & ~0x000f ) != 0;
     return((mCorePropertyChangePending & bit) != 0);
 }
Пример #2
0
        protected virtual bool SetIfPropertyChanged <T>(ref T memberVar, T newValue, CorePropertyChanged propertyId)
        {
            if (EqualityComparer <T> .Default.Equals(memberVar, newValue))
            {
                // no changes
                return(false);
            }

            memberVar = newValue;
            SetPropertyChangePending(propertyId);
            // anytime a property changes, we need to re-validate.
            NeedValidate = true;
            return(true);
        }
Пример #3
0
 /// <summary>
 /// Clear a bit indicating the corresponding property is clean.  This is normally called
 /// from Apply after a corresponding register has been update.
 ///
 /// If a derived class needs to keep track of more than 32 properties, override
 /// SetPropertyChangePending(object) and delegate the operation to a method similar
 /// to this one that tracks more bits...
 /// </summary>
 /// <param name="bit">the bit (or bits) to set</param>
 protected void ClearPropertyChangePending(CorePropertyChanged bit)
 {
     mCorePropertyChangePending &= ~bit;
 }
Пример #4
0
 /// <summary>
 /// Set a bit indicating the corresponding property is dirty.  This normally indicates
 /// that a corresponding register needs to be updated in Apply().
 ///
 /// If a derived class needs to keep track of more than 32 properties, override
 /// SetPropertyChangePending(object) and delegate the operation to a method similar
 /// to this one that tracks more bits...
 /// </summary>
 /// <param name="bit">the bit (or bits) to set</param>
 protected void SetPropertyChangePending(CorePropertyChanged bit)
 {
     mCorePropertyChangePending |= bit;
 }