public IFigure CloneFigure(ExternalizableFilter filter) { var persister = new Externalizer(); var mem = persister.Save(this, filter); return(persister.Load(mem, null) as IFigure); }
private static IEditor RestoreEditorOnly( TransferContentTreeNode content, Externalizer externalizer, IControllerFactory factory ) { /// var type = content.Value.Item1; // restoreには使わない var modelMem = content.Value.ModelMemento; var figMem = content.Value.FigureMemento; var model = externalizer.Load(modelMem); var fig = externalizer.Load(figMem) as IFigure; var ret = CreateEditorWithFigure(model, fig, factory); if (content.Value.Initializer != null) { content.Value.Initializer(ret, content.Value.TransferInitArgs); } return(ret); }
public void TestNodeFigurePersist() { var persister = new Externalizer(); var node = new SimpleRect(); node.Bounds = new Rectangle(0, 0, 100, 100); IMemento mem = persister.Save(node); var onode = persister.Load(mem) as IConnectable; Assert.AreNotEqual(node, onode); Assert.AreEqual(new Rectangle(0, 0, 100, 100), onode.Bounds); }