コード例 #1
0
 public void Uninstall()
 {
     using (WinServiceNative native = new WinServiceNative())
     {
         native.Lock();
         native.Open(this.ServiceName);
         native.Delete();
     }
 }
コード例 #2
0
        public new void Stop()
        {
            using (WinServiceNative native = new WinServiceNative())
            {
                native.Lock();
                native.Open(this.ServiceName);

                ApiStructs.ServiceStatus ss = native.QueryStatus();
                if (ss.CurrentState != ApiEnums.ServiceState.SERVICE_RUNNING)
                {
                    throw new Win32Exception("Cannot start the service because it is not running");
                }
            }
        }