Exemplo n.º 1
0
        private static void StopServers()
        {
            if (stop != null)
            {
                stop.Set();
            }

            if (deviceServer != null)
            {
                deviceServer.Stop();
            }

            if (dataServer != null)
            {
                dataServer.Stop();
            }
        }
Exemplo n.º 2
0
        protected override void OnStop()
        {
            var serviceStatus = new ServiceStatus();

            serviceStatus.dwCurrentState = ServiceState.SERVICE_STOP_PENDING;
            serviceStatus.dwWaitHint     = 10000;
            SetServiceStatus(this.ServiceHandle, ref serviceStatus);

            if (server != null)
            {
                server.Stop();
            }

            if (dataServer != null)
            {
                dataServer.Stop();
            }

            // Update the service state to Stopped.
            serviceStatus.dwCurrentState = ServiceState.SERVICE_STOPPED;
            SetServiceStatus(this.ServiceHandle, ref serviceStatus);
        }