I have a GoView that allows the user to switch back and forth between a layered digraph layout and a force directed layout. In order to get the same result every time a user switches to the force directed layout, I first run the document through a tree layout to force a locality upon the data. These layout operations can be long running due to the amount data involved, so I give the user a cancel button and run all of the layout on a separate thread. However, a problem arises when the user switches from layered digraph to force directed and then presses the cancel button: the resulting view is the output of the intermediate tree layout, but they (reasonably) expect to see the layered digraph.
What’s the right way to solve this? I tried putting all of the nodes/links into a network and passing the network to the layout objects, but that didn’t seem to have any effect. Do I just need to catch the ThreadAbortException, mark the transaction as finished, and then undo the last transaction?