Page Index Toggle Pages: 1 Send TopicPrint
Normal Topic Shape.Id missing after SaveToStream / LoadFromStre (Read 1136 times)
lagear
YaBB Newbies
*
Offline


I love YaBB 1G - SP1!

Posts: 1
Joined: Mar 15th, 2010
Shape.Id missing after SaveToStream / LoadFromStre
Mar 15th, 2010 at 2:28pm
Print Post  
Hi,

I'm using the trial version.

I've created custom Shape, using:

var shape = new Shape(
new ElementTemplate[] { new RoundRectangleTemplate(0, 0, 100, 100, 6) },
new ElementTemplate[] { },
null,
FillMode.Winding,
actividad.Id.ToString());
actividadShape =
new ActividadShape(
new AnchorPattern(
new[]
{
new AnchorPoint(50, 0, true, true, MarkStyle.Circle, color),
new AnchorPoint(100, 50, true, true, MarkStyle.Circle, color),
new AnchorPoint(50, 100, true, true, MarkStyle.Circle, color),
new AnchorPoint(0, 50, true, true, MarkStyle.Circle, color)
}),
shape,
actividad.Codigo);

The actividad.Codigo and actividad.Id are my own application identifiers.

The problem is that after save the diagrama and try to load, the Shape.Id property is empty and the nodes change from rectangle to ellipse.

The SaveToStream method, lost the Shape object and their properties?

Best,
  
Back to top
 
IP Logged
 
Stoyo
God Member
*****
Offline


MindFusion support

Posts: 13230
Joined: Jul 20th, 2005
Re: Shape.Id missing after SaveToStream / LoadFrom
Reply #1 - Mar 15th, 2010 at 4:29pm
Print Post  
Hi,

Node shapes are serialized by storing only their IDs in the stream. When loading a node, the control expects a Shape with the loaded ID to be already defined, e.g. in the application's constructor or the form.Load event. If no shape with such ID exists, the control sets Diagram.DefaultShape as the node's shape.

So you should move that "var shape = new Shape(...)" code to the application's init code, or save all shapes you will be using into a shape library file and load them by calling ShapeLibrary.LoadFrom when the application starts.

I hope that helps,
Stoyan
  
Back to top
 
IP Logged
 
Page Index Toggle Pages: 1
Send TopicPrint