C# 创建隐藏事务

发布于 2024-07-09 23:06:56 字数 521 浏览 7 评论 0原文

我正在使用 VS2005 的 C# 和 DSL 工具。

我需要创建事务来更改一些数据,但我希望它们对用户隐藏,这意味着不显示在 VS2005 的 UNDO 列表中。

我尝试禁用 UndoManager

store.UndoManager.UndoState = UndoState.Disabled;

但通过禁用它,撤消列表中所有现有的先前操作都会被清除。

事务有一个名为“isHidden”的属性,但它是只读的,我不知道如何将其设置为隐藏。 我还尝试创建一个新的 UndoManager 但它也是一个只读属性...

我如何创建一个不出现在撤消列表中的事务?

我很乐意写一些更多细节以澄清任何疑问, 非常感谢, Luís Filipe

[补充]

我根据属性值绘制每个形状的背景。 例如,如果为真,则为绿色,如果为假,则为红色。 我需要打开一个事务来绘制形状的背景,但对我来说,它表现为计算的(只读)属性。

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.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

魂牵梦绕锁你心扉 2024-07-16 23:06:56

store.UndoManager.UndoState = UndoState.Disabled;

几乎适合你想要的,

store.UndoManager.UndoState = UndoState.DisabledNoFlush;

这不会清除撤消列表的其余部分:) 午餐时路易斯。

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.

我的黑色迷你裙 2024-07-16 23:06:56

恐怕我对你的问题没有确切的答案,但是......你确定你真的需要这个吗? 大多数时候,您需要更改模型中的某些数据是为了对模型中的其他更改做出反应。 如果是这种情况,您可能需要研究使用规则来获取在提交之前导致更改的规则上下文中的现有事务,这样您就不需要首先创建新事务。

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.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文