private void ServiceStop() { this.Cursor = Cursors.WaitCursor; if (ServiceMgt.SetServiceStatus(_hostInfo.ServiceName, ServiceStatus.Stopped, Program.Log)) { RefreshServiceStatus(ServiceStatus.Stopped); } this.Cursor = Cursors.Default; }
private void buttonSvcStopLocal_Click(object sender, EventArgs e) { MessageBox.Show( ServiceMgt.SetServiceStatus( this.textBoxNTServiceName.Text.Trim(), ServiceStatus.Stopped, Program.Log).ToString() ); }
public bool SetServiceStatusAndStartStyle(string name, ServiceStatus status) { bool res = ServiceMgt.SetServiceStatus(name, status, Program.Log); if (res) { switch (status) { case ServiceStatus.Running: res = ServiceMgt.SetServiceStartStyle(name, ServiceMgt.Automatic, Program.Log); break; case ServiceStatus.Stopped: res = ServiceMgt.SetServiceStartStyle(name, ServiceMgt.Manual, Program.Log); break; } } return(res); }