How to add an undo/redo feature

A basic implementation of an undo/redo mechanism is provided by default. It uses event notifications to store an history of sessions that can be played back in reverse order.

To use it, create an instance of UndoManager and register it in the target domain.

Add this code after the creation of a domain in the store.

    undoManager = new UndoManager(store);
    // Now, all changes in the domain will be memorized
    undoManager.RegisterDomain(domain);

You can 'undo/redo' a session with the appropriate methods.

    if( undoManager.CanUndo) undoManager.Undo();
    if( undoManager.CanRedo) undoManager.Redo();

Last edited Apr 17, 2014 at 10:56 AM by aguerot, version 7