예제 #1
0
파일: Actions.cs 프로젝트: ondrej11/o106
        public static void SetProperty(ActionManager actionManager, IValueProvider valueProvider, object value)
        {
            SetPropertyAction action = new SetPropertyAction(valueProvider, value);

            if (actionManager == null)
            {
                action.Execute();
            }
            else
            {
                actionManager.RecordAction(action);
            }
        }
예제 #2
0
        public override bool TryToMerge(IAction followingAction)
        {
            SetPropertyAction next = followingAction as SetPropertyAction;

            // Comparing the Property does not allow for proper merging. - D.H.
            // if (next != null
            // && next.Property == this.Property)
            // Using new comparison.
            if (next != null &&
                next.Property.Name == this.Property.Name &&
                next.Property.Parent == this.Property.Parent &&
                next.Property.CanSetValue == this.Property.CanSetValue)
            {
                this.NewValue = next.NewValue;
                Property.SetValue(NewValue);
                return(true);
            }
            return(false);
        }