public void startServiceBtn_Click(object sender, System.EventArgs e) { if (service.Running) { RtlAwareMessageBox.Show(this, Strings.ServiceStartedText, Strings.ServiceStartedTitle, MessageBoxButtons.OK, MessageBoxIcon.Information, MessageBoxDefaultButton.Button1, (MessageBoxOptions)0); } else { try { Cursor.Current = Cursors.WaitCursor; service.StartServiceAndWait(); OnServiceStarted(EventArgs.Empty); } catch (System.ServiceProcess.TimeoutException) { RtlAwareMessageBox.Show(this, Strings.ServiceStartTimeoutText, Strings.ServiceStartTimeoutTitle, MessageBoxButtons.OK, MessageBoxIcon.Error, MessageBoxDefaultButton.Button1, (MessageBoxOptions)0); } finally { Cursor.Current = Cursors.Default; } } SetServiceStatus(); }
public void startServiceBtn_Click(object sender, System.EventArgs e) { if (service.Running) { MessageBox.Show(this, "The service is already started.", "Service Started", MessageBoxButtons.OK, MessageBoxIcon.Information); } else { try { Cursor.Current = Cursors.WaitCursor; service.StartServiceAndWait(); } catch (System.ServiceProcess.TimeoutException) { MessageBox.Show(this, "The service did not start in a timely fashion." + "\nMake sure the service is started.", "Service Start Timeout", MessageBoxButtons.OK, MessageBoxIcon.Error); } finally { Cursor.Current = Cursors.Default; } } SetServiceStatus(); }