Example #1
0
        } // UnExecuteCore

        /// <summary>
        /// Subsequent changes of the same property on the same object are consolidated into one action
        /// </summary>
        /// <param name="followingAction">Subsequent action that is being recorded</param>
        /// <returns>true if it agreed to merge with the next action, 
        /// false if the next action should be recorded separately</returns>
        public override bool TryToMerge(IAction followingAction)
        {
            SetPropertyAction next = followingAction as SetPropertyAction;
            if (AllowToMergeWithPrevious && next != null && next.ParentObject == ParentObject && next.Property == Property)
            {
                Value = next.Value;
                Property.SetValue(ParentObject, Value, null);
                return true;
            }
            return false;
        } // TryToMerge
        } // EnumUndoableActions

        #endregion

        #region Set Property

        public static void SetProperty(object instance, string propertyName, object value)
        {
            SetPropertyAction action = new SetPropertyAction(instance, propertyName, value);
            RecordAction(action);
        } // SetProperty