We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy. Image for the cookie policy date

The diagram does not work After saving

Hello There, I create a Decision Tree program based on the idea of OrgChart sample. I attached all my code here for you to run it and reproduce the problem. You can run it, click icon: "Add condition" or "Add Result" or "Add Condition--Condition" or "Add Condition--Result", then click on the diagram to draw "symbol". Then click "Save..." icon, to save the diagram to a file. Here the problem occurs: After the saving, click "Add condition" etc icon, then click on the diagram, it does not work any more. The diagram seems "freeze" could you look my code to identify what is the reason? TIA! CS_2319.zip

5 Replies

AD Administrator Syncfusion Team October 26, 2004 10:54 AM

Hi After taking a look at the application, it looks like the InsertSymbolTool(s) are not properly registered. Take a look at the modified version of barItemAddCondition_Click event: this.diagram.Controller.RegisterTool(new InsertSymbolTool("InsertCondition", typeof(clsConditionSymbol))); this.diagram.Controller.ActivateTool("InsertCondition"); and also this line in your RegisterCustomTools() routine. this.diagram.Controller.RegisterTool(new InsertSymbolTool("InsertCondition", typeof(clsConditionSymbol))); Now when you save the Diagram and then try to insert a ConditionSymbol it will work fine, but the other Symbols cannot be inserted as they are not registered properly. The LinkTool works fine as it has been registered properly. You need to modify the RegisterCustomTools() routine along with registering the InsertSymbolTool for other custom symbols to address this issue. Regards Arun


AD Administrator Syncfusion Team October 26, 2004 01:00 PM

Hello Aron, I modified my code according your suguestion. Now the saving works OK. but I got the same problem when I click the "Open" icon to open a diagram. After I opened a diagram, click the "Add Condition" etc Icons, the program looks "freeze". I attached my newly modified code here for you to run it to re-produce the problem. Could you indentify the cause for me? Thanks it, >Hi > >After taking a look at the application, it looks like the InsertSymbolTool(s) are not properly registered. Take a look at the modified version of barItemAddCondition_Click event: >this.diagram.Controller.RegisterTool(new InsertSymbolTool("InsertCondition", typeof(clsConditionSymbol))); >this.diagram.Controller.ActivateTool("InsertCondition"); > >and also this line in your RegisterCustomTools() routine. >this.diagram.Controller.RegisterTool(new InsertSymbolTool("InsertCondition", typeof(clsConditionSymbol))); > >Now when you save the Diagram and then try to insert a ConditionSymbol it will work fine, but the other Symbols cannot be inserted as they are not registered properly. The LinkTool works fine as it has been registered properly. You need to modify the RegisterCustomTools() routine along with registering the InsertSymbolTool for other custom symbols to address this issue. > >Regards >Arun CS_7589.zip


AD Administrator Syncfusion Team October 26, 2004 03:55 PM

Hi You need to call RegisterCustomTools() to ensure that all the Tools are registered. This is because, Diagram internally calls MVCDispose() which destroys the model, view, and controller and ensures that they are completely disconnected from the diagram control, when you load a serialized Diagram. I added RegisterCustomTools() in the barItemOpen_Click event of your sample and everything worked fine. Regards Arun


AD Administrator Syncfusion Team October 27, 2004 07:36 AM

Thanks. Now all Symbol tools work OK. The "Update Layout" still does not work after clicking "Open..." icon to open a diagram. I guess the "LoadBianary" cleaned the diagram.LayoutManager, so I added this line to RegisterCustomTools(): this.diagram.LayoutManager = this.pclsLayoutManager; But It does not work. Any Idea? TIA >Hi > >You need to call RegisterCustomTools() to ensure that all the Tools are registered. This is because, Diagram internally calls MVCDispose() which destroys the model, view, and controller and ensures that they are completely disconnected from the diagram control, when you load a serialized Diagram. > >I added RegisterCustomTools() in the barItemOpen_Click event of your sample and everything worked fine. > >Regards >Arun >


AD Administrator Syncfusion Team October 27, 2004 10:29 AM

Hi The LayoutManager class in Essential Diagram provides the basic plumbing for layout managers and the Diagram serialization implementation serializes only it''s Model and part of the View component and there is no attempt to serialize the LayoutManager contained within the Diagram. The serialization logic is contained in the DiagramDoc class defined within the "..Diagram\Controls\Diagram.cs'' file and which is instantiated within the Diagram control''s Load/Save methods. So your sub classed LayoutManager should implement the ISerializable interface. You will have to provide a custom version of the DiagramDoc class that serializes the LayoutManager in addition to the Model and View components and instruct your diagram to use this custom document type by overriding the Load/Save methods to take care of this issue. Regards Arun

Loader.
Live Chat Icon For mobile
Up arrow icon