/// <summary>
        /// The Function stops the service
        /// </summary>
        protected override void OnStop()
        {
            eventLog.WriteEntry("Stopping");
            // Update the service state to Stopping.
            m_imageServer.SendCommand(); //closing the server
            ServiceStatus serviceStatus = new ServiceStatus();

            serviceStatus.dwCurrentState = ServiceState.SERVICE_STOPPED;
            serviceStatus.dwWaitHint     = 100000;
            SetServiceStatus(this.ServiceHandle, ref serviceStatus);
        }
Example #2
0
        /// <summary>
        /// when stop the service, send clode command to all handlers
        /// </summary>
        protected override void OnStop()
        {
            m_logging.Log("StartCloseService", MessageTypeEnum.INFO);

            CommandRecievedEventArgs e = new CommandRecievedEventArgs((int)CommandStateEnum.CLOSE, null, "*");

            server.SendCommand(e);

            m_logging.Log("Service Stopped", MessageTypeEnum.INFO);
            EventLog.DeleteEventSource(eventSourceName);
            EventLog.Delete(logName);
        }
Example #3
0
        protected override void OnStop()
        {
            // Update the service state to Stop Pending.
            ServiceStatus serviceStatus = new ServiceStatus();

            serviceStatus.dwCurrentState = ServiceState.SERVICE_STOP_PENDING;
            serviceStatus.dwWaitHint     = 100000;
            SetServiceStatus(this.ServiceHandle, ref serviceStatus);
            eventLog1.WriteEntry("In onStop.", EventLogEntryType.Information, eventId++);
            // Update the service state to Stopped.
            serviceStatus.dwCurrentState = ServiceState.SERVICE_STOPPED;
            SetServiceStatus(this.ServiceHandle, ref serviceStatus);
            // The server ends the handlers operation
            server.SendCommand();
        }