views:

387

answers:

2

Hello,

I am using C# and DSL Tools for VS2005.

I need to create Transactions to change some data but i want them to be hidden from the user, that means, to not show in the UNDO list in VS2005.

I tried by disabling the UndoManager

store.UndoManager.UndoState = UndoState.Disabled;

But by disabling it all existing previous actions in the undo list are cleared.

Transactions have a property called "isHidden" but it's readonly i don't know how i can set the to hidden. I also tried to create a new UndoManager but it's also a readonly property...

How can i create a transaction that does not appear in the undo list?

I'd be glad to write some more details in order to clarify any doubts, Thank you very much, Luís Filipe

[added]

i paint every shape's background based on a property value. E.g, green if true, red if false. I need to open a transaction to paint the shape's background but for me it behaves as a calculated (read-only) property.

A: 

Hello. I'm afraid I don't have an exact answer for your question but... are you sure you really need that? Most of the times when you need to change some data in the model is to react to other changes in the model. If that is the case, you might want to investigate using rules to get an existing transaction within the context of the rule that causes the changes before it's committed so you don't have the need to create a new transaction in the first place.

i paint every shape's background based on a property value. E.g, green if true, red if false. I need to open a transaction to paint the shape's background but for me it behaves as a calculated (read-only) property.
Luis Filipe
+1  A: 

store.UndoManager.UndoState = UndoState.Disabled;

is almost right for what u want,

store.UndoManager.UndoState = UndoState.DisabledNoFlush;

this will not clear the rest of the undo list :) cyas at lunch Luis.

Apóstolo
This method seems to work although it's obsolete.If anyone knows how to achieve the same goal not using the obsolete method i would highly appreciate.Thank you
Luis Filipe