We are making use of Model Changed event and we are relying on ModelChanged Edits. But the problem is that we are getting multiple edits for a single move node which is affecting our further logic.
Is there any way that we can get the last edit or the final location of the node ?
We are facing another issue because of the above code changes.
What we have for copy-paste is once the user selects and Copies the nodes and connections and pastes. The pasted elements will be sticking to the mouse pointer and it will be so until the user clicks some where on the diagram. And once he clicks the elements will be put at that location.
This is the reference image:
We have the similar implementation for Dragging tool as here Copy with Mouse and also have some overriden methods in commandHandler. Didn’t get any exception thrown from GoXam control though.
and I was unable to encounter any problems with copy-and-paste and dragging.
So there must be some complication in your customizations of dragging (or copy-pasting) that are causing the problem.
I still think there is an unexpected exception happening, but it’s not likely to be uncaught. It might be muffled by the diagram. You’ll have to notice uncaught exceptions in the debugger.
After understanding the goXam code base I found that the purple lines are added by a method in DraggingTool named “MakeDragImage”. This method is called when “IsRealtime” is set to false.
I tried overriding this method but the problem is if I am adding the nodes after overriding this method, the edits are increasing. It didn’t help me.
Is there any way that I can filter from the diagram edits to get first and the last edit for move of node or link?
In the two images above the first one refers to the functionality before setting the IsRealTime to false and the second one is after setting the IsRealTime to false.
I expect after setting IsRealTime property to false it should behave in the same was as in image. Rather I see the purple borders. That is the problem.
Tried this solution but this expects some of the internal goXam methods to be made as public.
We tried another way, That is in ModelChanged event which we are subscribing, before starting with the logic, we find all those edits which are related to Property = “Location” and remove all edits except the last and thus we maintain the older behavior of moving objects after paste and also have limited the number of edits for edits( for Property=“Location”). With this implementation we are able to achieve what we wanted.
What are your thoughts about this ? Will this have any side effects ?
Yes, that should work, but you have to keep the first and the last ModelChanged event for each Part. The first is need for undo to work correctly; the last for redo.