protected virtual void InternalSetValue <T>(T value, [NotNull] string key) { Contract.Requires(key != null); try { _configuration.SetValue(key, ConvertToString(value)); using (var writer = new StreamWriter(File.Create(_filePath))) { _configuration.Save(writer); } } catch (Exception ex) { _tracer.TraceError("Fatal error writing configuration file: " + _filePath + " - " + ex.Message); } }
protected virtual void InternalSetValue <T>(T value, string key) { Contract.Requires(!string.IsNullOrEmpty(key)); try { _configuration.SetValue(key, ConvertToString <T>(value)); using (var writer = new StreamWriter(File.Create(_filePath))) { _configuration.Save(writer); } OnPropertyChanged(key); } catch (Exception ex) { MessageBox.Show("Fatal error writing configuration file: " + _filePath + " - " + ex.Message); } }