Capturing before the Part are added (similar to DeleteParts)

Hi,

We have a software with two flowsheets, when adding / removing on the first flowsheet, if the node is already on the other flowsheet, we want to ask to user if he really want to do it.

When deleting, we capture action by overriding the DeleteParts in the GoXamPartManager. This works fine without problem.

When adding, we didn’t find equivalent method in the GoXamPartManager.


We tried do intercept in the GoXamModel.InsertNode but as soon as the software is waiting for the user input (MessageBox) the cursor becomes a wait cursor. The application is ready to be used as we can use the keyboard to select the right answer in the message box and it works fines, but the wait cursor doesn’t allow the user to click the button with his mouse.

We also tried in the DraggingTools.DoDragEnter with the same result.

We also did try to override the Mouse.Cursor when displaying the MessageBox but no better result.


We suspect that there is something in GoXam forcing the cursor to be on wait status.

Thanks you
Jean-Philip

There are many different ways that code can add parts to a diagram, so there is no one way to try to intercept that. And a number of such ways can not or should not be interrupted with modal dialogs – including all of the dragging-with-a-mouse operations.

First, if you have code to add something, you can collect the desired information beforehand.

Second, for predefined code in commands or tools, you can customize the operations to either prevent the command or tool from executing, or you can customize their operations afterwards but before the transaction has completed.

For a drag-and-drop operation, you can implement some combination of the following event handlers: Diagram.SelectionMoved, Diagram.SelectionCopied, Diagram.ExternalObjectsDropped.

For a copy-and-paste operation, you can implement a Diagram.ClipboardPasted event handler.

For a newly drawn Link, you can implement a Diagram.LinkDrawn event handler.

For a Node creation via click, you can customize the ClickCreatingTool.PrototypeData or implement a Diagram.NodeCreated event handler.

Thanks you :)