I am running a GP tool that takes some time from a button on Dockpane.
If the user close the Dockpane with the X (or any cancel button) I would like the GP tool to be canceled.
I still would like to use GPThread flag (or any other way that does not block the application)
What will be the best way to do it?
Happy holidays 🙂
Using the ExecuteToolAsync overload with a CancellationToken is the way to go. If you create a CancellationTokenSource scoped to the DockPane and override the DockPane's OnHidden method, you can call Cancel on the CancellationTokenSource object if the GP tool hasn't finished.
Hi Stephen
I will give it a try (it will take some time). I could not find an example for GP tool but I understand the concept.
Thanks