public void CommitUndoTransaction(string transactionName) { if (_undoTransaction != null && _undoTransaction.ContainsKey(transactionName)) { MathExpGroupUndo _currStates = _undoTransaction[transactionName]; MathExpGroupUndo objRedo = new MathExpGroupUndo(this, (MathExpGroup)root.Export().Clone()); UndoEntity undo = new UndoEntity(_currStates, objRedo); _undoTransaction.Remove(transactionName); _undoEngine.AddUndoEntity(undo); enableUndo(); _disableUndo = false; } }
public void CreateUndoTransaction(string transactionName) { if (!_disableUndo) { _disableUndo = true; if (_undoTransaction == null) { _undoTransaction = new Dictionary <string, MathExpGroupUndo>(); } if (!_undoTransaction.ContainsKey(transactionName)) { _undoTransaction.Add(transactionName, new MathExpGroupUndo(this, (MathExpGroup)root.Export().Clone())); } else { _undoTransaction[transactionName] = new MathExpGroupUndo(this, (MathExpGroup)root.Export().Clone()); } } }