public IUndoUnit UseRedo() { IUndoUnit obj = null; if (_currentItem != null) { if (_position == EnumUndoStackPosition.AtRedo) { if (_currentItem.Previous != null) { _currentItem = _currentItem.Previous; obj = _currentItem.Value.RedoObject; } } else { obj = _currentItem.Value.RedoObject; _position = EnumUndoStackPosition.AtRedo; } } return(obj); }
public IUndoUnit UseUndo() { IUndoUnit obj = null; if (_currentItem != null) { if (_position == EnumUndoStackPosition.AtRedo) { obj = _currentItem.Value.UndoObject; _position = EnumUndoStackPosition.AtUndo; } else { if (_currentItem.Next != null) { _currentItem = _currentItem.Next; obj = _currentItem.Value.UndoObject; } } } return(obj); }
public void AddUndoEntity(UndoEntity entity) { cutoff(); if (_currentItem != null) { if (_position == EnumUndoStackPosition.AtUndo) { RemoveFirst(); } else { if (entity.UndoObject is SizeUndo && _currentItem.Value.UndoObject is SizeUndo) { if (((SizeUndo)entity.UndoObject).Key == ((SizeUndo)_currentItem.Value.UndoObject).Key) { RemoveFirst(); } } } } this.AddFirst(entity); _currentItem = this.First; _position = EnumUndoStackPosition.AtRedo; }