예제 #1
0
 internal override void UpdateValues(MultiValuedPropertyBase newMvp)
 {
     if (newMvp != null && newMvp.IsChangesOnlyCopy)
     {
         throw new InvalidOperationException(DataStrings.ErrorNotSupportedForChangesOnlyCopy);
     }
     base.BeginUpdate();
     try
     {
         this.propertyValues.Clear();
         if (!this.IsReadOnly)
         {
             this.added.Clear();
             this.removed.Clear();
         }
         this.changed    = true;
         this.wasCleared = true;
         if (newMvp != null)
         {
             foreach (object obj in ((IEnumerable)newMvp))
             {
                 T t = (T)((object)obj);
                 this.propertyValues.Add(t);
                 if (!this.IsReadOnly)
                 {
                     this.added.Add(t);
                 }
             }
         }
     }
     finally
     {
         base.EndUpdate();
     }
 }
예제 #2
0
 internal virtual void CopyChangesFrom(ConfigurableObject changedObject)
 {
     if (changedObject == null)
     {
         throw new ArgumentNullException("changedObject");
     }
     this.CheckWritable();
     ProviderPropertyDefinition[] array = new ProviderPropertyDefinition[changedObject.propertyBag.Keys.Count];
     changedObject.propertyBag.Keys.CopyTo(array, 0);
     foreach (ProviderPropertyDefinition providerPropertyDefinition in array)
     {
         if (!providerPropertyDefinition.IsReadOnly && (!providerPropertyDefinition.IsWriteOnce || this.ObjectState == ObjectState.New) && (changedObject.propertyBag.SaveCalculatedValues || !providerPropertyDefinition.IsCalculated) && changedObject.IsModified(providerPropertyDefinition))
         {
             object obj = changedObject[providerPropertyDefinition];
             MultiValuedPropertyBase multiValuedPropertyBase = obj as MultiValuedPropertyBase;
             if (!providerPropertyDefinition.IsMultivalued || multiValuedPropertyBase == null || multiValuedPropertyBase.IsChangesOnlyCopy)
             {
                 this[providerPropertyDefinition] = obj;
             }
             else
             {
                 MultiValuedPropertyBase multiValuedPropertyBase2 = (MultiValuedPropertyBase)this[providerPropertyDefinition];
                 multiValuedPropertyBase2.CopyChangesFrom(multiValuedPropertyBase);
                 this.CleanupInstantiationErrors(providerPropertyDefinition);
             }
         }
     }
 }
 internal override void UpdateValues(MultiValuedPropertyBase newMvp)
 {
     if (newMvp != null && newMvp.GetType() != base.GetType())
     {
         throw new ArgumentException("newMvp", DataStrings.ExceptionCannotSetDifferentType(base.GetType(), newMvp.GetType()));
     }
     base.UpdateValues(newMvp);
 }
 public override void CopyChangesFrom(MultiValuedPropertyBase changedMvp)
 {
     if (changedMvp != null && changedMvp.GetType() != base.GetType())
     {
         throw new ArgumentOutOfRangeException("changedMvp", DataStrings.ErrorCannotCopyFromDifferentType(base.GetType(), changedMvp.GetType()));
     }
     base.CopyChangesFrom(changedMvp);
 }
예제 #5
0
        public override void CopyChangesFrom(MultiValuedPropertyBase changedMvp)
        {
            if (this.IsReadOnly)
            {
                throw new InvalidObjectOperationException(this.ReadOnlyErrorMessage);
            }
            if (changedMvp == null)
            {
                throw new ArgumentNullException("changedMvp");
            }
            if (!changedMvp.Changed)
            {
                return;
            }
            bool copyChangesOnly = base.CopyChangesOnly;

            base.BeginUpdate();
            try
            {
                base.CopyChangesOnly = true;
                if (changedMvp.WasCleared)
                {
                    this.Clear();
                }
                foreach (object item in changedMvp.Removed)
                {
                    this.Remove(item);
                }
                foreach (object item2 in changedMvp.Added)
                {
                    this.Add(item2);
                }
            }
            catch (Exception)
            {
                this.errorOnUpdate = true;
                throw;
            }
            finally
            {
                base.CopyChangesOnly = copyChangesOnly;
                base.EndUpdate();
            }
        }
예제 #6
0
 internal abstract void UpdateValues(MultiValuedPropertyBase newMvp);
예제 #7
0
 public abstract void CopyChangesFrom(MultiValuedPropertyBase changedMvp);
예제 #8
0
 public static bool IsNullOrEmpty(MultiValuedPropertyBase property)
 {
     return(property == null || property.Count == 0);
 }