コード例 #1
0
		public IMemento Restore() {
			// Before
			drawableContainer.Invalidate();
			ChangeFieldHolderMemento oldState = new ChangeFieldHolderMemento(drawableContainer, fieldToBeChanged);
			fieldToBeChanged.Value = oldValue;
			// After
			drawableContainer.Invalidate();
			return oldState;
		}
コード例 #2
0
        public IMemento Restore()
        {
            // Before
            drawableContainer.Invalidate();
            ChangeFieldHolderMemento oldState = new ChangeFieldHolderMemento(drawableContainer, fieldToBeChanged);

            fieldToBeChanged.Value = oldValue;
            // After
            drawableContainer.Invalidate();
            return(oldState);
        }
コード例 #3
0
        public bool Merge(IMemento otherMemento)
        {
            ChangeFieldHolderMemento other = otherMemento as ChangeFieldHolderMemento;

            if (other != null)
            {
                if (other.drawableContainer.Equals(drawableContainer))
                {
                    if (other.fieldToBeChanged.Equals(fieldToBeChanged))
                    {
                        // Match, do not store anything as the initial state is what we want.
                        return(true);
                    }
                }
            }
            return(false);
        }