Beispiel #1
0
 ///<summary>
 /// Get this configuration set from a specific config file
 ///</summary>
 public static SeccionVentanas Open(string path)
 {
     if ((object)instance == null)
     {
         if (path.EndsWith(".config", StringComparison.InvariantCultureIgnoreCase))
         {
             spath = path.Remove(path.Length - 7);
         }
         else
         {
             spath = path;
         }
         Configuration config = ConfigurationManager.OpenExeConfiguration(spath);
         if (config.Sections["SeccionVentanas"] == null)
         {
             instance = new SeccionVentanas();
             config.Sections.Add("SeccionVentanas", instance);
             config.Save(ConfigurationSaveMode.Modified);
         }
         else
         {
             instance = (SeccionVentanas)config.Sections["SeccionVentanas"];
         }
     }
     return(instance);
 }
Beispiel #2
0
        ///<summary>
        ///Create a full copy of the current properties
        ///</summary>
        public SeccionVentanas Copy()
        {
            SeccionVentanas copy = new SeccionVentanas();
            string          xml  = SerializeSection(this, "SeccionVentanas", ConfigurationSaveMode.Full);

            System.Xml.XmlReader rdr = new System.Xml.XmlTextReader(new System.IO.StringReader(xml));
            copy.DeserializeSection(rdr);
            return(copy);
        }
Beispiel #3
0
        ///<summary>
        ///Save the current property values to the config file
        ///</summary>
        public void Save()
        {
            Configuration   config  = ConfigurationManager.OpenExeConfiguration(spath);
            SeccionVentanas section = (SeccionVentanas)config.Sections["SeccionVentanas"];

            //
            // TODO: Add code to copy all properties from "this" to "section"
            //
            //section.SectorConfig = this.SectorConfig;
            section.Ventanas = this.Ventanas;
            config.Save(ConfigurationSaveMode.Full);             //Try with "Modified" to see the difference
        }