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; } }
public static void Test() { if (instance == null) { instance = new ServiceBusManager(); } instance.TestBus(); }
public static void Start() { if (instance == null) { instance = new ServiceBusManager(); } instance.StartBus(); }
public static void Start() { if (instance == null) { instance = new ServiceBusManager(); } instance.StartBus(); }
private void MainForm_FormClosing(object sender, FormClosingEventArgs e) { try { ServiceBusManager.Stop(); } catch (Exception ex) { e.Cancel = true; MessageBox.Show(ex.Message, "Error", MessageBoxButtons.OK, MessageBoxIcon.Warning); } }
private void Test() { try { Cursor = Cursors.WaitCursor; OrderDbContext dbContext = new OrderDbContext(); dbContext.Database.Connection.Open(); dbContext.Database.Connection.Close(); ServiceBusManager.Test(); MessageBox.Show("Test OK", "Success", MessageBoxButtons.OK, MessageBoxIcon.Information); } catch (Exception ex) { MessageBox.Show(ex.Message, "Test Failed", MessageBoxButtons.OK, MessageBoxIcon.Warning); } finally { 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; } }
private void StopBus() { sh.Close(); instance = null; }
public static void Test() { if (instance == null) instance = new ServiceBusManager(); instance.TestBus(); }