private void editConnectionToolStripMenuItem_Click(object sender, EventArgs e) { if (this.provider != null) { IDatabaseProvider provider = DatabaseConnectionDialog.Show(this, this.provider.Identifier, this.provider.ConnectionString); if (provider != null) { provider.Open(); this.provider = provider; // Reset list connections: this.SchemasList.Items.Clear(); this.TablesList.Items.Clear(); foreach (DbSchema item in this.provider.GetSchemas()) { ListViewItem lvi = SchemasList.Items.Add(item.ToString(), 1); lvi.Tag = item; lvi.Group = SchemasList.Groups["Schemas"]; } this.SchemasList.Columns[0].AutoResize(ColumnHeaderAutoResizeStyle.ColumnContent); // Refresh window state and title: this.UpdateWindowState(); } } }
private void newSessionToolStripMenuItem_Click(object sender, EventArgs e) { // Open new connection: if (this.CloseSession(true)) { this.provider = DatabaseConnectionDialog.Show(this); NewSession(); } }
private void TryOpenConnection() { bool succeeded = false; while ((this.provider != null) && (!succeeded)) { try { this.provider.Open(); succeeded = true; } catch (Exception ex) { MessageBox.Show(this, "Failed to open connection: " + ex.Message, this.formTitle, MessageBoxButtons.OK, MessageBoxIcon.Exclamation); this.provider = DatabaseConnectionDialog.Show(this, this.provider.Identifier, this.provider.ConnectionString); } } }