public static SurfaceStoreData CreateStoreData( IShapeSurface surface) { SurfaceStoreData result = new SurfaceStoreData(); IShapeSource src = surface.Source; // save the last ghost surface.NewGhost(ShapeType.None); result._picture = src.Background; result._size = src.Size; if (!src.NamedHatchStyle.IsEmpty) { result._namedHatchStyle = (NamedHatchStylesForXmlSerialize)src.NamedHatchStyle; } if (!src.NamedTextureStyle.IsEmpty) { result._namedTextureStyle = (NamedTextureStylesForXmlSerialize)src.NamedTextureStyle; } IList <IShape> shapes = src.Shapes; if (shapes != null && shapes.Count > 0) { result._shapes = new ShapeForXmlSerialize[shapes.Count]; for (int i = 0; i < shapes.Count; i++) { result._shapes[i] = new ShapeForXmlSerialize(shapes[i]); } } return(result); }
public void Save(IShapeSurface surface, Stream stream) { if (surface == null) { throw new ArgumentNullException("surface"); } if (!stream.CanWrite) { throw new ArgumentException("stream"); } SurfaceStoreData data = SurfaceStoreData.CreateStoreData(surface); XmlSerializer xs = new XmlSerializer(typeof(SurfaceStoreData)); xs.Serialize(stream, data); }
public void Save(IShapeSurface surface, Stream stream) { if (!stream.CanWrite) { throw new ArgumentException("stream"); } SerializationBasedStreamItemWriter writer = new SerializationBasedStreamItemWriter(stream); SurfaceStoreData data = SurfaceStoreData.CreateStoreData(surface); if (surface.Source.Tag == null) { writer.Write(data); } else { writer.Write(data, surface.Source.Tag); } }
public SurfaceStyleSettingHelper(IShapeSurface surface) { _surface = surface; }
public SurfaceMouseNewHelper(IShapeSurface surface) { _surface = surface; }
public SurfaceMouseModifyHelper(IShapeSurface surface) { _surface = surface; }