public void CopyToClipboard() { using (MemoryStream stream = new MemoryStream()) { BOP.Serializer serializer = DesignerTree.FormDesigner.FrontendSession.CreateSerializer(); serializer.RemoveReferencesToObjectsNotSerialized = false; serializer.Serialize(stream, Node); DesignerTree.FormDesigner.Dataphoria.Warnings.AppendErrors(DesignerTree.FormDesigner, serializer.Errors, true); stream.Position = 0; Clipboard.SetDataObject(new DataObject(DataFormats.UnicodeText, new StreamReader(stream).ReadToEnd())); } }
public void CopyFromNode(DesignerNode source, DropLinePosition position) { INode node; using (MemoryStream stream = new MemoryStream()) { BOP.Serializer serializer = DesignerTree.FormDesigner.FrontendSession.CreateSerializer(); serializer.Serialize(stream, source); DesignerTree.FormDesigner.Dataphoria.Warnings.AppendErrors(DesignerTree.FormDesigner, serializer.Errors, true); stream.Position = 0; BOP.Deserializer deserializer = DesignerTree.FormDesigner.FrontendSession.CreateDeserializer(); deserializer.FindReference += new BOP.FindReferenceHandler(DeserializeFindReference); node = (INode)deserializer.Deserialize(stream, null); DesignerTree.FormDesigner.Dataphoria.Warnings.AppendErrors(DesignerTree.FormDesigner, deserializer.Errors, true); } RecursiveGetUniqueName(node); PlaceNewNode(node, position); DesignerTree.Modified(); }