public void SaveToDisk() { try { var json = JsonConvert.SerializeObject(this); File.WriteAllText(SettingsPersistencePathProvider.GetFilePath(), json); } catch (Exception e) { MessageBox.Show(e.ToString()); } }
public void Load() { try { var json = File.ReadAllText(SettingsPersistencePathProvider.GetFilePath()); var obj = JsonConvert.DeserializeObject <DatabaseConnectionStorage>(json); this.SqlRecordDtos.Clear(); this.OdbcDsnDtos.Clear(); SqlRecordDtos.AddRange(obj.SqlRecordDtos); OdbcDsnDtos.AddRange(obj.OdbcDsnDtos); } catch (Exception e) { MessageBox.Show(e.ToString()); } }