示例#1
0
        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);
        }
示例#2
0
        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);
        }
示例#3
0
        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);
            }
        }
示例#4
0
 public SurfaceStyleSettingHelper(IShapeSurface surface)
 {
     _surface = surface;
 }
示例#5
0
 public SurfaceMouseNewHelper(IShapeSurface surface)
 {
     _surface = surface;
 }
示例#6
0
 public SurfaceMouseModifyHelper(IShapeSurface surface)
 {
     _surface = surface;
 }