private void NewInstanceOKButton_Click(object sender, EventArgs e) { if (ServerNameBox.Enabled == false) { ServerNameBox.Text = ""; } if (NewInstanceTextBox.Enabled == false) { NewInstanceTextBox.Text = ""; } string connection = this.NewInstanceTextBox.Text; if (String.IsNullOrEmpty(connection)) { connection = "Data Source = " + this.ServerNameBox.Text + "; Provider = msolap"; } try{ main.InstallNewServer(connection); } catch (Exception ex) { MessageBox.Show(ex.Message); return; } Close(); }
private void NewInstanceOKButton_Click(object sender, EventArgs e) { if (ServerNameBox.Enabled == false) { ServerNameBox.Text = ""; } if (NewInstanceTextBox.Enabled == false) { NewInstanceTextBox.Text = ""; } string connection = this.NewInstanceTextBox.Text; if (String.IsNullOrEmpty(connection)) { connection = "Data Source = " + this.ServerNameBox.Text + "; Provider = msolap"; } try { ConnectingLabel.Visible = true; ConnectingLabel.Text = "Connecting to " + this.ServerNameBox.Text; Cursor.Current = Cursors.WaitCursor; NewInstanceOKButton.Enabled = false; NewInstanceCancelButton.Enabled = false; Application.DoEvents(); this.Invoke((MethodInvoker) delegate() { main.InstallNewServer(connection); Application.DoEvents(); ConnectingLabel.Text = "Connected!"; }); NewInstanceOKButton.Enabled = true; NewInstanceCancelButton.Enabled = true; Cursor.Current = Cursors.Default; ConnectingLabel.Visible = false; } catch (Exception ex) { MessageBox.Show(ex.Message); NewInstanceOKButton.Enabled = true; NewInstanceCancelButton.Enabled = true; Cursor.Current = Cursors.Default; ConnectingLabel.Visible = false; return; } Close(); }