Exemplo n.º 1
0
		public IMemento Restore() {
			// Before
			drawableContainer.Invalidate();
			ChangeFieldHolderMemento oldState = new ChangeFieldHolderMemento(drawableContainer, fieldToBeChanged);
			fieldToBeChanged.Value = oldValue;
			// After
			drawableContainer.Invalidate();
			return oldState;
		}
Exemplo n.º 2
0
        public IMemento Restore()
        {
            // Before
            drawableContainer.Invalidate();
            ChangeFieldHolderMemento oldState = new ChangeFieldHolderMemento(drawableContainer, fieldToBeChanged);

            fieldToBeChanged.Value = oldValue;
            // After
            drawableContainer.Invalidate();
            return(oldState);
        }
Exemplo n.º 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);
        }