Exemple #1
0
        /// <summary>
        /// read configuration file
        /// </summary>
        /// <returns>
        /// settings object
        /// </returns>
        private static Settings ReadSettings()
        {
            var xmlRSettings = new XmlReaderSettings();
            var settings = new Settings();

            using (XmlReader reader = XmlReader.Create(ConfigFileName, xmlRSettings))
            {
                reader.MoveToContent();
                reader.ReadStartElement();
                settings.DPI = reader.ReadElementContentAsInt("DPI", "");
                settings.ColorPallet = reader.ReadElementContentAsInt("ColorPallet", "");
                settings.ColorList.Add(
                    reader.ReadElementContentAsString("_1color", ""));
                settings.ColorList.Add(
                    reader.ReadElementContentAsString("_2color", ""));
                settings.ColorList.Add(
                    reader.ReadElementContentAsString("_3color", ""));
                settings.ColorList.Add(
                    reader.ReadElementContentAsString("_4color", ""));
                settings.ColorList.Add(
                    reader.ReadElementContentAsString("_5color", ""));
                settings.ColorList.Add(
                    reader.ReadElementContentAsString("_6color", ""));
                settings.ColorList.Add(
                    reader.ReadElementContentAsString("_7color", ""));
                settings.ColorList.Add(
                    reader.ReadElementContentAsString("_8color", ""));
                reader.ReadEndElement();
            }
            return settings;
        }
Exemple #2
0
        private static void WriteSettings(Settings settings)
        {
            var ws = new XmlWriterSettings();

            using (var writer = XmlWriter.Create(ConfigFileName, ws))
            {
                writer.WriteStartElement("configuration", "");
                writer.WriteElementString("DPI", settings.DPI.ToString());
                writer.WriteElementString("ColorPallet", settings.ColorPallet.ToString());
                writer.WriteElementString("_1color", settings.ColorList[0]);
                writer.WriteElementString("_2color", settings.ColorList[1]);
                writer.WriteElementString("_3color", settings.ColorList[2]);
                writer.WriteElementString("_4color", settings.ColorList[3]);
                writer.WriteElementString("_5color", settings.ColorList[4]);
                writer.WriteElementString("_6color", settings.ColorList[5]);
                writer.WriteElementString("_7color", settings.ColorList[6]);
                writer.WriteElementString("_8color", settings.ColorList[7]);
                writer.WriteEndElement();
            }
        }
Exemple #3
0
 public static void UpdateSettings(Settings settings)
 {
     WriteSettings(settings);
 }
 public void UpdateSettingsFile(Settings settings)
 {
     SetSettings(settings);
     SettingsProxy.UpdateSettings(settings);
 }
 public void SetSettings(Settings set)
 {
     Settings = set;
 }
 public SettingsController(Settings settings)
 {
     Settings = settings;
 }
 public SettingsController()
 {
     Settings = SettingsProxy.GetSettings();
 }
 private void Init()
 {
     var settingController = new SettingsController();
     _settings = settingController.GetSettings();
 }