/// <summary> /// Stores element in the undo/redo buffer /// </summary> /// <param name="operation">Operation that will be save for the element</param> /// <param name="element">Element to be buffered</param> public void StoreInBuffer(BufferOperation operation, ShapeElement element) { UndoElement UndoElement = new UndoElement(element, operation); this.undoManager.AddItem(UndoElement); element.UndoShape = element.Copy(); }
/// <summary> /// Buffer element class that is used for buffering actions for undoing/redoing /// </summary> /// <param name="currentShape">Current shape</param> /// <param name="operation">Opertion</param> public UndoElement(ShapeElement currentShape, BufferOperation operation) { this.currentShape = currentShape; if (currentShape.UndoShape != null) { this.oldShape = currentShape.UndoShape.Copy(); } this.newShape = currentShape.Copy(); this.operation = operation; }