private void menuConnect_Click(object sender, EventArgs e) { ConnectionDialog cdialog = null; try { cdialog = new ConnectionDialog(); if (cdialog.ShowDialog() == DialogResult.OK) { GeneratorContext.currentConnectionString = cdialog.SelectedConnection; GeneratorContext.currentDatabaseServer = cdialog.SelectedDatabaseType; statusBarPanel.Text = "Loading schema..........."; FinishedLoading loading = OnFinishedLoading; presenter.LoadDatabaseSchema(loading); } } catch (Exception ex) { MessageBox.Show(ex.Message); } finally { if (cdialog != null) { cdialog.Dispose(); } } }
private void menuConnect_Click(object sender, EventArgs e) { ConnectionDialog cdialog = null; try { cdialog = new ConnectionDialog(); if (cdialog.ShowDialog() == DialogResult.OK) { Context.currentConnectionString = cdialog.SelectedConnection; Context.currentDatabaseServer = cdialog.SelectedDatabaseType; StartLoading(); } } catch (Exception ex) { MessageBox.Show(ex.Message); } finally { if (cdialog == null) { cdialog.Dispose(); } } }