public static void Undo(IUndoMarker marker) { Node node = (Node)marker; Node cursor = currentNode; while (cursor != null) { cursor.UndoItem.Undo(); if (cursor == node) { currentNode = cursor.Previous; if (currentNode == null) { currentNode = new Node(new NoOperation()) { Next = cursor }; } if (firstNode == cursor) { firstNode = currentNode; } return; } cursor = cursor.Previous; } throw new InvalidOperationException(); }
public static void Undo( IUndoMarker marker ) { Node node = (Node) marker; Node cursor = currentNode; while ( cursor != null ) { cursor.UndoItem.Undo(); if ( cursor == node ) { currentNode = cursor.Previous; if ( currentNode == null ) { currentNode = new Node( new NoOperation() ) {Next = cursor}; } if ( firstNode == cursor ) firstNode = currentNode; return; } cursor = cursor.Previous; } throw new InvalidOperationException(); }
public static void Redo(IUndoMarker marker) { Node node = (Node)marker; Node cursor = currentNode.Next; while (cursor != null) { cursor.UndoItem.Redo(); if (cursor == node) { currentNode = cursor; return; } cursor = cursor.Next; } throw new InvalidOperationException(); }
public static void Redo( IUndoMarker marker ) { Node node = (Node) marker; Node cursor = currentNode.Next; while ( cursor != null ) { cursor.UndoItem.Redo(); if ( cursor == node ) { currentNode = cursor; return; } cursor = cursor.Next; } throw new InvalidOperationException(); }