Esempio n. 1
0
        /// <summary>
        /// Copies the properties to a target object.
        /// </summary>
        /// <param name="target">The target.</param>
        /// <param name="raisePropertyChanged">if set to <c>true</c> the PropertyChanged event may be raised.</param>
        /// <returns>true if at least one property has been changed; false otherwise.</returns>
        public virtual bool CopyProperties(AutoObject target, bool raisePropertyChanged)
        {
            if (target == null)
            {
                throw new ArgumentNullException("target");
            }

            bool b = target.RaisePropertyChanged;

            target.RaisePropertyChanged = raisePropertyChanged;
            try
            {
                bool changed = false;
                foreach (KeyValuePair <string, object> kv in Properties)
                {
                    if (target.SetProperty(kv.Key, kv.Value))
                    {
                        changed = true;
                    }
                }
                return(changed);
            }
            finally
            {
                target.RaisePropertyChanged = b;
            }
        }
Esempio n. 2
0
 /// <summary>
 /// Copies the properties to a target object.
 /// </summary>
 /// <param name="target">The target.</param>
 /// <returns>true if at least one property has been changed; false otherwise.</returns>
 public virtual bool CopyProperties(AutoObject target)
 {
     return(CopyProperties(target, false));
 }