IUndoableObject (future)

IUndoableObject (future)

Old forum URL: forums.lhotka.net/forums/t/392.aspx


Fabio posted on Friday, June 16, 2006

To increase the UI behavior i think we need one more method/property to know if the UndoableObject have an undoable state.
The method name, in IUndoableObject, may be: bool HaveUndoableState();
The implementation may be:
public bool HaveUndoableState()
{return (_stateStack.Count>0);}

Using from inheritance we can hask if de object support the IUndoableObject and then we can enable/disable the Undo button asking for HaveUndoableState.
Fabio.

xal replied on Friday, June 16, 2006

Fabio,
I realize it's not the same because it's not in the interface, but you can work around it.
BusinessBase exposes a protected property named EditLevel. You could expose that from your bo if you need to. Again, it's not the same, but it'll get you closer to what you want.
It'd be nice if the EditLevel where exposed through the interface.

It would also be very nice if we had an application level parameter to disable n-level undo or at least a class level attribute to permanently disable undo for a given type.

Andrés

RockfordLhotka replied on Friday, June 16, 2006

EditLevel is now protected in both BusinessBase and BusinessListBase, so you have access in both cases. If you want to expose it as a public member, or through an interface, you can create your own base class for this purpose, but I think having it as protected is sufficient for the general case.

Copyright (c) Marimer LLC