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 StopServiceBus() { try { this.Cursor = Cursors.WaitCursor; ServiceBusManager.Stop(); stopImg.Visible = true; startImg.Visible = false; lblStatus.Text = "Stoped"; btnStop.Visible = false; btnStart.Visible = true; lblStatus.ForeColor = Color.Red; } catch (Exception ex) { MessageBox.Show(ex.Message, "Error", MessageBoxButtons.OK, MessageBoxIcon.Warning); } finally { this.Cursor = Cursors.Default; } }