예제 #1
0
		public IMemento Restore() {
			// Before
			textContainer.Invalidate();
			TextChangeMemento oldState = new TextChangeMemento(textContainer);
			textContainer.ChangeText(oldText, false);
			// After
			textContainer.Invalidate();
			return oldState;
		}
예제 #2
0
        public IMemento Restore()
        {
            // Before
            textContainer.Invalidate();
            TextChangeMemento oldState = new TextChangeMemento(textContainer);

            textContainer.ChangeText(oldText, false);
            // After
            textContainer.Invalidate();
            return(oldState);
        }
예제 #3
0
        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);
        }