Exemplo n.º 1
0
        /// <summary>
        /// 保存为xml文件
        /// </summary>
        /// <param name="filename"></param>
        public void Save(string filename)
        {
            try
            {
                XmlTextWriter wr = new XmlTextWriter(filename, null);
                wr.Formatting = Formatting.Indented;
                wr.WriteStartElement("CanvasDataModel");
                m_backgroundLayer.GetObjectData(wr);
                m_gridLayer.GetObjectData(wr);

                foreach (ICanvasLayer layer in m_layers)
                {
                    if (layer is ISerialize)
                    {
                        ((ISerialize)layer).GetObjectData(wr);
                    }
                }

                XmlUtil.WriteProperties(this, wr);
                wr.WriteEndElement();
                wr.Close();
                m_undoBuffer.Dirty = false;
            }
            catch { }
        }
Exemplo n.º 2
0
 public void GetObjectData(XmlWriter wr)
 {
     wr.WriteStartElement("layer");
     wr.WriteAttributeString("Id", m_id);
     XmlUtil.WriteProperties(this, wr);
     wr.WriteStartElement("items");
     foreach (IDrawObject drawobj in m_objects)
     {
         if (drawobj is ISerialize)
         {
             ((ISerialize)drawobj).GetObjectData(wr);
         }
     }
     wr.WriteEndElement();
     wr.WriteEndElement();
 }
Exemplo n.º 3
0
 public void GetObjectData(XmlWriter wr)
 {
     wr.WriteStartElement("backgroundlayer");
     XmlUtil.WriteProperties(this, wr);
     wr.WriteEndElement();
 }