コード例 #1
0
 public void SaveToDisk()
 {
     try
     {
         var json = JsonConvert.SerializeObject(this);
         File.WriteAllText(SettingsPersistencePathProvider.GetFilePath(), json);
     }
     catch (Exception e)
     {
         MessageBox.Show(e.ToString());
     }
 }
コード例 #2
0
 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());
     }
 }