Exemple #1
0
 private void SaveShape(ShapeSaveData saveData, XmlWriter writer)
 {
     writer.WriteStartElement(saveData.ShapeType);
     writer.WriteAttributeString("Id", saveData.ShapeId);
     writer.WriteAttributeString("Colour", saveData.Colour);
     foreach (var attribute in saveData.ShapeData)
     {
         writer.WriteAttributeString(attribute.Key, attribute.Value);
     }
     writer.WriteEndElement();
 }
Exemple #2
0
 private void Save(IEnumerable <IDrawable> drawables, string filePath)
 {
     using (XmlWriter writer = XmlWriter.Create(filePath))
     {
         writer.WriteStartElement("Shapes");
         foreach (IDrawable drawable in drawables)
         {
             ShapeSaveData shapeSaveData = drawable.SaveBehaviour.GetSaveData();
             SaveShape(shapeSaveData, writer);
         }
         writer.WriteEndElement();
     }
 }
Exemple #3
0
        public ShapeSaveData GetSaveData()
        {
            ShapeSaveData result = new ShapeSaveData(_line)
            {
                ShapeType = ShapeType
            };

            result.ShapeData["StartX"] = _line.StartPoint.X.ToString();
            result.ShapeData["StartY"] = _line.StartPoint.Y.ToString();
            result.ShapeData["EndX"]   = _line.EndPoint.X.ToString();
            result.ShapeData["EndY"]   = _line.EndPoint.Y.ToString();
            return(result);
        }
Exemple #4
0
        public ShapeSaveData GetSaveData()
        {
            ShapeSaveData result = new ShapeSaveData(_drawableRectangle)
            {
                ShapeType = ShapeType
            };

            Rectangle rectangle = _drawableRectangle.Rectangle;

            result.ShapeData["X"] = rectangle.X.ToString();
            result.ShapeData["Y"] = rectangle.Y.ToString();
            result.ShapeData["H"] = rectangle.Height.ToString();
            result.ShapeData["W"] = rectangle.Width.ToString();
            return(result);
        }