public IMemento Restore() { // Before drawableContainer.Invalidate(); ChangeFieldHolderMemento oldState = new ChangeFieldHolderMemento(drawableContainer, fieldToBeChanged); fieldToBeChanged.Value = oldValue; // After drawableContainer.Invalidate(); return oldState; }
public IMemento Restore() { // Before drawableContainer.Invalidate(); ChangeFieldHolderMemento oldState = new ChangeFieldHolderMemento(drawableContainer, fieldToBeChanged); fieldToBeChanged.Value = oldValue; // After drawableContainer.Invalidate(); return(oldState); }
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); }