
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
In my addin, I've wrapped a button click and everything the button does into a global transaction. If I only click the button once, the transaction can be undone with one undo. However, If I click my button twice, only the very latest transaction is undone properly. The previous transaction is no longer grouped.
Button click does these tasks:
- Read iProperties
- Generate Table
- Draw a bunch of sketched symbols
The process: I click my button twice(giving enough time for it to finish each time), then click undo twice.
My expectation: Every action performed by both clicks of my button should be undone.
What is actually happening: The first undo click undoes every action performed by the very last button click. The next undo click undoes a single drawing of a sketched symbol. If I continue clicking undo, it will undo each of the sketched symbol drawings, one at a time. If I click it enough times, it will eventually undo drawing the table.
I thought transactions were supposed to "group" actions. Do I misunderstand how transactions work, or have I stumbled across a bug?
Code looks somethign like this:
Transaction transaction = default(Transaction); try { transaction = m_InventorApplication.TransactionManager.StartGlobalTransaction((_Document)aDoc, "readSymbols"); //read iProperties (calls a function from another class) //Draw table (calls function within this class) //Draw symbols (calls a function from another class) transaction.End(); } catch { transaction.End(); }
Solved! Go to Solution.