public IMemento Restore() { // Before textContainer.Invalidate(); TextChangeMemento oldState = new TextChangeMemento(textContainer); textContainer.ChangeText(oldText, false); // After textContainer.Invalidate(); return oldState; }
public IMemento Restore() { // Before textContainer.Invalidate(); TextChangeMemento oldState = new TextChangeMemento(textContainer); textContainer.ChangeText(oldText, false); // After textContainer.Invalidate(); return(oldState); }
public bool Merge(IMemento otherMemento) { TextChangeMemento other = otherMemento as TextChangeMemento; if (other != null) { if (other.textContainer.Equals(textContainer)) { // Match, do not store anything as the initial state is what we want. return(true); } } return(false); }