Ejemplo n.º 1
0
        public SettingsDialog()
        {
            InitializeComponent();

            this.settings = SettingsManager.CurrentSettings;
            DataContext = this.settings;
        }
Ejemplo n.º 2
0
 public static void SaveAsCurrentSettings(Settings newSettings)
 {
     using (var settingsFileStream = File.Open(settingsPath, FileMode.Create))
     {
         settingsSerializer.Serialize(settingsFileStream, newSettings);
         settings = newSettings;
     }
 }
Ejemplo n.º 3
0
        private static Settings GetSettingsFromFile()
        {
            CreateSettingsFileIfNotExist();

            using (var settingsFile = new FileStream(settingsPath, FileMode.Open))
            {
                settings = (Settings)settingsSerializer.Deserialize(settingsFile);
            }

            return settings;
        }
Ejemplo n.º 4
0
 private static void CreateSettingsFileIfNotExist()
 {
     if (!File.Exists(settingsPath))
     {
         using (var createdFileStream = File.Create(settingsPath))
         {
             var settingsToSave = new Settings();
             settingsToSave.SoundFile = Path.Combine(AppDomain.CurrentDomain.BaseDirectory, "Ring.wav");
             settingsSerializer.Serialize(createdFileStream, settingsToSave);
         }
     }
 }