1
Vote

Nested commands don't work?

description

This code from the example throws InvalidOperationException with message : "Previous command is not completed. Use UndoRedoManager.Commit() to complete current command."
 
using (UndoRedoManager.Start("My Root Command"))
{
using (UndoRedoManager.Start("My Nested Command"))
{
}
}
 
 
Same goes when "nesting" commands from different threads :
using (UndoRedoManager.Start("First command"))
{
new Thread(() =>
{
Thread.Sleep(2000);
using (UndoRedoManager.Start("Second command"))
{
  UndoRedoManager.Commit();
}
}).Start();
 
Thread.Sleep(4000);
UndoRedoManager.Commit();
}

comments

sha0skywalker wrote Mar 18, 2010 at 3:41 PM

It doesn't like empty nested commands.

wrote Feb 13, 2013 at 10:58 PM