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

Reload Model after LoadBinary

It seems that when I Diagram.LoadBinary, the diagram is getting updated but the model is not getting updated.

This means that the event handlers I have attached to the Model are not firing.

I'm making the assumption that the model is NOt getting updated, by reseting the model to the diagram after I do the load. The diagram goes blank and the "loaded" edd objects disappear.

Suggestions? VB.NET please.

8 Replies

J. J.Nagarajan Syncfusion Team July 27, 2007 01:48 AM UTC

Hi Dan,

Sorry for the inconvenience caused. We could not visualize the condition that you have mentioned here. After deserialize the diagram file we can trigger the Model events(like SizeChanged, PinPointChanged). I have attached my test sample here.

http://websamples.syncfusion.com/samples/Diagram.Windows/F65562/main.htm

Please let us know which Model events you could not fire after the deserialization.

Thanks,
Nagaraj


DH Dan Harris July 27, 2007 03:13 PM UTC


Ok I must be doing something VERY wrong. I had used the exact project as a model for my experimenting.

I have attached my project. So maybe you can tell me what I'm doing wrong.

Here are the steps to follow.

Drag one of the "tables" onto the diagram.

Rotate the tabels and notice how they only go in 90 degree increaments.

Now hit the load button.

Now do the rotate. Constraints are gone, event does not fire.

So I started looking at it an realized that the "Model" is where the events are wired up to. So I got to wondering how the model got loaded up.

Now look in the code, you will see a commented out line in the Load Button handler.

This reassigns the Model to the diagram. Uncomment and run, now the edd loads, updates the overview and promptly disappears when the model is reattached to the diagram?????

I'm SURE I'm doing something real stupid and do not understand how all of this works together. But I have really looked hard at the Getting Started project, and I can't figure out what I'm doing different???

Sorry to be such a newbie! I really like how all of this works, I just need to get a clear understanding of how all of this works.

Dan




>Hi Dan,

Sorry for the inconvenience caused. We could not visualize the condition that you have mentioned here. After deserialize the diagram file we can trigger the Model events(like SizeChanged, PinPointChanged). I have attached my test sample here.

http://websamples.syncfusion.com/samples/Diagram.Windows/F65562/main.htm

Please let us know which Model events you could not fire after the deserialization.

Thanks,
Nagaraj

PlanOGram.zip


J. J.Nagarajan Syncfusion Team July 27, 2007 06:19 PM UTC

Hi Dan,

Thanks for the update. We could not find your attachment in this post. Could you please attach you sample and let us know.

Thanks,
Nagaraj


DH Dan Harris July 27, 2007 06:31 PM UTC


That is very strange! I can see it on the web site??? I'm trying it again.

PlanOGram0.zip


J. J.Nagarajan Syncfusion Team July 27, 2007 11:31 PM UTC

Hi Dan,

Sorry for the confusion. Yes, I was able to visualize the condition that you have mentioned here. I will forward this issue to our developer. If you want to fire the events after deserialization then you have to add the event handler after the LoadBinary() method. Please refer to the following code snippet.

Private Sub butLoad_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles butLoad.Click
Me.OverviewControl1.DetachDiagram()
Me.Diagram1.LoadBinary("..\..\test.edd")
Me.OverviewControl1.Diagram = Me.Diagram1
Me.Diagram1.Invalidate(True)

AddHandler Diagram1.Controller.Model.EventSink.PinPointChanged, AddressOf EventSink_PinPointChanged
End Sub

Private Sub EventSink_PinPointChanged(ByVal evtArgs As PinPointChangedEventArgs)
Console.WriteLine(evtArgs.NodeAffected.Name)
End Sub

I have attached the sample for your reference. You can download the sample from the following page.

http://websamples.syncfusion.com/samples/Diagram.Windows/F65562_27-7/main.htm

Please refer to the sample and let me know if you have any questions.

Thanks for bringing this issue to our attention.

Thanks,
Nagaraj


DH Dan Harris July 28, 2007 06:57 PM UTC

Of course I TRIED THAT!!!! That was the point of my whole message. The event sink seems to be attached to the Model not the diagram, or at least the Rotate event was??? And when I load the model does not seem to contain the diagram.

This was the point of my whole question. I was under the impression that the model contain a representaion of the diagram?????

I will look closely at the sample you sent, to see if I can get it to work.

But I REALLY think I must be missing something here!

Dan


DH Dan Harris July 28, 2007 07:16 PM UTC

Ok I played with the sample you sent back and now I get it. I'm still confussed about the relation of the Model to the Diagram, but I can see how to make things work.

Thanks for your help.


J. J.Nagarajan Syncfusion Team July 30, 2007 09:26 PM UTC

Hi Dan,

As you mentioned the model does not contain the diagram when loaded(deserializing), this issue has been forwarded to the development team. A Model is a collection of objects rendered onto a view and manipulated by a controller. The Model.EventSink event s fired when the user affect the nodes in the Model. In the present scenario of the diagram control the Model is separate componant to which the diagram is integrated by setting Model property of the diagram control.

Please take the look at the sample provided earlier and let me know if you have any further questions. If you have any issues, please provide more information on them.

Thanks,
Nagaraj

Loader.
Live Chat Icon For mobile
Up arrow icon