Example #1
0
        public static IEnumerable <Shape> RestoreState(int ext, string format)
        {
            var shapesMemento = FormatFactory.SelectSerializationFormat(ext).Load(format);
            var shapes        = new List <Shape>();

            foreach (var shapeMemento in shapesMemento)
            {
                var data = new XData();
                data.SetData(shapeMemento.X, shapeMemento.Y, shapeMemento.Width, shapeMemento.Height,
                             shapeMemento.Color, shapeMemento.LineWidth, shapeMemento.Type, shapeMemento.TabIndex);

                var shape = new Shape(data, data.Type);
                shapes.Add(shape);
            }

            return(shapes);
        }
Example #2
0
 public void SaveState(int ext, string format)
 {
     FormatFactory.SelectSerializationFormat(ext).Save(format, Shapes);
 }