Page Index Toggle Pages: 1 Send TopicPrint
Normal Topic ShapeNode Id use (Read 2882 times)
felix.kaelin
YaBB Newbies
*
Offline


I love YaBB 1G - SP1!

Posts: 3
Joined: Feb 9th, 2011
ShapeNode Id use
Feb 9th, 2011 at 10:48am
Print Post  
Hi people,

I try to identify the ShapeNode's on a diagramm by the id on an event like this:

[code]
private void diaPool_LinkCreated(object sender, MindFusion.Diagramming.LinkEventArgs e)
{
if (e.Link != null)
{
if ((e.Link.Destination != null) && (e.Link.Origin != null))
{
Console.WriteLine(e.Link.Origin.Id);
}
}
}
[/code]

But the id is null.
Must I set the id after create the shapenode or is it setted by the diagram?

Gr33z3
Felix
  
Back to top
 
IP Logged
 
Stoyo
God Member
*****
Offline


MindFusion support

Posts: 13230
Joined: Jul 20th, 2005
Re: ShapeNode Id use
Reply #1 - Feb 9th, 2011 at 10:59am
Print Post  
Hi Felix,

The Id property is not set automatically, it is used for storing custom data just as Tag and you must set it yourself. You can assign to it integer values using the method shown in the post below, or perhaps Guid instances or string values.

http://mindfusion.eu/Forum/YaBB.pl?board=wpfdg_disc;action=display;num=129291942...

I hope that helps,
Stoyan
  
Back to top
 
IP Logged
 
felix.kaelin
YaBB Newbies
*
Offline


I love YaBB 1G - SP1!

Posts: 3
Joined: Feb 9th, 2011
Re: ShapeNode Id use
Reply #2 - Feb 16th, 2011 at 3:57pm
Print Post  
Hi Stoyan,

yes for the moment it has worked, but now I've got a problem more whit the Id.
When i save the whole diagram to a String and load it back like this:
Code
Select All
string test = this.diaPool.SaveToString();
this.diaPool.LoadFromString(test); 


I lose the value in the Id.

So now the question:
Have you implemented some function that I can override and so save the value in the Id or is that implemented allready and I miss some configuration?

Gr33z3
Felix
  
Back to top
 
IP Logged
 
Stoyo
God Member
*****
Offline


MindFusion support

Posts: 13230
Joined: Jul 20th, 2005
Re: ShapeNode Id use
Reply #3 - Feb 16th, 2011 at 4:06pm
Print Post  
Hi Felix,

If you are using simple types such as string or integer the values should be saved automatically. If you are using your custom type as id, make it [Serializable] and it should be serialized automatically too. If you save to XML format, handle the SerializeTag and DeserializeTag events to serialize the id values as custom XML attributes or elements.

I hope that helps,
Stoyan
  
Back to top
 
IP Logged
 
felix.kaelin
YaBB Newbies
*
Offline


I love YaBB 1G - SP1!

Posts: 3
Joined: Feb 9th, 2011
Re: ShapeNode Id use
Reply #4 - Feb 17th, 2011 at 10:02am
Print Post  
Hi Stoyan,

very big thanks. That was the problem I need to fix, serialize the class I've created for the Id  Cheesy

So now it works very fine.

Gr33z3
Felix
  
Back to top
 
IP Logged
 
Page Index Toggle Pages: 1
Send TopicPrint