Ejemplo n.º 1
0
        internal void UnpersistElementSettings(IElementSettingsMgr settingsMgr, System.Xml.XmlReader reader)
        {
            //Assumes reader has started the read of element "Settings"
            int startDepth = reader.Depth;

            while (reader.Read() && reader.Depth > startDepth)
            {
                if (reader.IsStartElement() && reader.Name == BlueSpider.Motor.Settings.ElementSettingsMgr._LocationName)
                {
                    PointF location;
                    UnpersistLocation(reader, out location);
                    settingsMgr.Location = location;
                }
                else if (reader.IsStartElement() && reader.Name == BlueSpider.Motor.Settings.ElementSettingsMgr._CommentsName)
                {
                    string comments = null;
                    UnpersistComments(reader, out comments);
                    if (!string.IsNullOrEmpty(comments))
                        settingsMgr.Comments = string.Copy(comments);
                }
            }

            ////Assumes reader has started the read of element "Settings"
            //int startDepth = reader.Depth;
            //reader.Read();
            //if (reader.Name == BlueSpider.Motor.Settings.ElementSettingsMgr._LocationName)
            //{
            //    PointF location;
            //    UnpersistLocation(reader, out location);
            //    settingsMgr.Location = location;
            //}
            //// read up to close tag "</ Settings>
            //if (startDepth > reader.Depth)
            //    reader.Read();

            // reader should finish at the end element tag "Settings"
        }
Ejemplo n.º 2
0
 internal void PersistElementSettingsMgr(IElementSettingsMgr settingsMgr, System.Xml.XmlWriter writer)
 {
     writer.WriteStartElement("Settings");
     writer.WriteStartElement(BlueSpider.Motor.Settings.ElementSettingsMgr._LocationName);
     writer.WriteAttributeString("x", XmlConvert.ToString(settingsMgr.Location.X));
     writer.WriteAttributeString("y", XmlConvert.ToString(settingsMgr.Location.Y));
     writer.WriteEndElement();
     if (!string.IsNullOrEmpty(settingsMgr.Comments))
     {
         writer.WriteStartElement(BlueSpider.Motor.Settings.ElementSettingsMgr._CommentsName);
         writer.WriteString(settingsMgr.Comments);
         writer.WriteEndElement();
     }
     writer.WriteEndElement();
 }