public void PushReverseAction <T>(UndoRedoOperation <T> undoOperation, T undoData) { List <IUndoRedoAction> stack = null; if (_undoInProgress) { stack = _redoActions; } else { stack = _undoActions; } if ((!_undoInProgress) && (!_redoInProgress)) { //_redoActions.Clear(); } if (_curTran == null) { ListOperations.Push(stack, new UndoRedoAction <T>(undoOperation, undoData)); } else { (stack[0] as UndoTransaction).AddUndoRedoOperation(new UndoRedoAction <T>(undoOperation, undoData)); } if (stack.Count > _maximumActions) { stack.RemoveRange(_maximumActions - 1, stack.Count - _maximumActions); } }
public void StartTransaction(UndoTransaction tran) { if (_curTran == null) { _curTran = tran; ListOperations.Push(_undoActions, new UndoTransaction(tran.Name)); ListOperations.Push(_redoActions, new UndoTransaction(tran.Name)); } }