/// <summary> /// roll back everything in the currently open batch, not redoable /// </summary> public void UndoBatch() { _working = true; try { _batch?.Undo(); } finally { _working = false; _batch = null; } }
/// <summary> /// roll back everything in the currently open batch, not redoable /// </summary> public void UndoBatch() { Working = true; bool nonEmptyBefore = (_batch?.Count ?? 0) > 0 || _undoEvents.Any(); try { _batch?.Undo(); } finally { bool nowEmpty = !_undoEvents.Any(); Working = false; _batch = null; if (nonEmptyBefore && nowEmpty) { Empty?.Invoke(this, EventArgs.Empty); } } }