Hi,
I create a program to modelize data. I use Save() function with serialize item (like TableShape Demo)
this my serialize function for my TableGraphSource :
public override void SerializeNode(NodeViewModelBase node, SerializationInfo info){ base.SerializeNode(node, info); if (node is INodeSerializable) { info = (node as INodeSerializable).Serialize(info); }}each model have a Serialize method with his own parameters to serialize
It's the same for Deserialize TableGraphSource :
public override NodeViewModelBase DeserializeNode(IShape shape, SerializationInfo info) { NodeViewModelBase node = null; if (shape is TableShapeMulti) { var table = new TableModelMulti(); node = table.Deserialize(info); } else if (shape is TableShape) { var table = new TableModel(); node = table.Deserialize(info); } else if (shape is ShapeShape) { if (null != info["Content"]) { switch (info["Content"].ToString()) { case "Controls.Entity.Models.ShapeModel": var _sm = new ShapeModel(); node = _sm.Deserialize(info); break; ... default: var shapeModel = Activator.CreateInstance(Type.GetType(info["Content"].ToString())); if (shapeModel is ShapeModel) node = (shapeModel as ShapeModel).Deserialize(info); break; } } } else { var row = new RowModel(); row.Deserialize(info); node = row; } if (null != node) { if (info["Position"] != null) node.Position = Utils.ToPoint(info["Position"].ToString()).Value; if (info[this.NodeUniqueIdKey] != null) { var nodeUniquekey = info[this.NodeUniqueIdKey].ToString(); if (!this.CachedNodes.ContainsKey(nodeUniquekey)) { this.CachedNodes.Add(nodeUniquekey, node); } } } return node; }
Saving is OK and Reloading is OK (all data are correctly affected) but i have a problem with ContainerShape : Width, Height, Position (X,Y) properties are not binding anymore between shape and model when i reload diagram.
I use styleSelector to link shape with model (my app is based on TableShape demo for code structure)
Can you help me please ? Thanks