private bool EditCloudDBConnection(IWin32Window parentWindow, Connections connections) { SsdsConnectionManagerForm form = new SsdsConnectionManagerForm(); form.Initialize(this._serviceProvider, this.ConnectionManager, this.ErrorCollectionService); if (DesignUtils.ShowDialog(form, parentWindow, this._serviceProvider) == DialogResult.OK) { string cs = form.GetConnectionString(ConnectionStringDisplayOption.IncludePassword); ConnectionManager.ConnectionString = cs; if (!this.ConnectionManager.Name.Equals(form.ConnectionName, StringComparison.OrdinalIgnoreCase)) { this.ConnectionManager.Name = ConnectionManagerUtils.GetConnectionName(connections, form.ConnectionName); } ConnectionManager.Description = form.ConnectionDescription; SsdsConnectionManager innerManager = (SsdsConnectionManager)ConnectionManager.InnerObject; innerManager.Authority = form.Authority; innerManager.UserName = form.UserName; innerManager.Password = form.Password; return(true); } return(false); }
private void btnTest_Click(object sender, EventArgs e) { try { SsdsConnectionManager cm = new SsdsConnectionManager(); cm.ConnectionString = this.GetConnectionString(ConnectionStringDisplayOption.IncludePassword); // Override default service URL if (!string.IsNullOrEmpty(this._url)) { cm.Url = this._url; } Connection conn = (Connection)cm.AcquireConnection(null); try { conn.TestWithThrow(); MessageBox.Show("Test Connection Succeeded", "Connection Manager", MessageBoxButtons.OK, MessageBoxIcon.Information, MessageBoxDefaultButton.Button1); } catch (Exception ex) { MessageBox.Show(ex.Message, "Connection Manager", MessageBoxButtons.OK, MessageBoxIcon.Error, MessageBoxDefaultButton.Button1); } } catch (Exception exc) { this.ReportErrors(exc); } }
private void SsdsConnectionManagerForm_Load(object sender, EventArgs e) { this.ConnectionName = this.ConnectionManager.Name; this.ConnectionDescription = this.ConnectionManager.Description; SsdsConnectionManager innerManager = (SsdsConnectionManager)this.ConnectionManager.InnerObject; this.Authority = innerManager.Authority; this.UserName = innerManager.UserName; this.Password = innerManager.GetPassword(); this._url = innerManager.Url; this.btnTest.Enabled = this.ValidateConnectionString(); }