private void btnOK_Click(object sender, EventArgs e) { try { this.Cursor = Cursors.WaitCursor; if (!IsValid()) { throw new ApplicationException(errorMessage); } ServiceBusManager.Username = txtUsername.Text; ServiceBusManager.Password = txtPassword.Text; ServiceBusManager.Start(); configuration.ConfigurationManager.DoNotShowSettingFormAtStartup(); this.DialogResult = System.Windows.Forms.DialogResult.OK; this.Close(); } catch (Exception ex) { MessageBox.Show(ex.Message, "Error", MessageBoxButtons.OK, MessageBoxIcon.Warning); txtUsername.Focus(); } finally { this.Cursor = Cursors.Default; } }
private void StartServiceBus() { try { this.Cursor = Cursors.WaitCursor; ServiceBusManager.Start(); stopImg.Visible = false; startImg.Visible = true; lblStatus.Text = "Started"; btnStop.Visible = true; btnStart.Visible = false; lblStatus.ForeColor = Color.Green; } catch (Exception ex) { MessageBox.Show(ex.Message, "Error", MessageBoxButtons.OK, MessageBoxIcon.Warning); } finally { this.Cursor = Cursors.Default; } }