private (Boolean success, String message) SaveConnectionHistory(String providerName, String connectionString) { var historyItem = new ConnectionHistoryItem { ConnectionString = connectionString, ProviderName = providerName }; var old = this.ConnectionHistoryConfig.Historys.Where(t => t.ConnectionString == connectionString).FirstOrDefault(); if (old == null) { this.ConnectionHistoryConfig.Historys.Add(historyItem); try { ConfigManager.SaveConfig(this.ConnectionHistoryConfig, typeof(ConnectionHistoryConfig), ConnectionHistoryConfig.FilePath); } catch (Exception exc) { return(false, exc.Message); } } return(true, null); }
/// <summary> /// 保存此实例包含的配置信息到磁盘文件 /// </summary> public void Save(String savePath, Boolean isEncrypt = false) { Type type = this.GetType(); ConfigManager.SaveConfig(this, type, savePath, isEncrypt); }
private void _btnSaveHistory_Click(Object sender, EventArgs e) { ConfigManager.SaveConfig <ConnectionHistoryConfig>(this.HistoryConfig, ConnectionHistoryConfig.FilePath); MessageBox.Show(this, "已保存!", "提示"); }