コード例 #1
0
        protected override void OnStart(string[] args)
        {
            eventLog1.WriteEntry("Starting the Image Service");

            ServiceStatus serviceStatus = new ServiceStatus();

            serviceStatus.dwCurrentState = ServiceState.SERVICE_START_PENDING;
            serviceStatus.dwWaitHint     = 100000;
            SetServiceStatus(this.ServiceHandle, ref serviceStatus);

            string[] dirs = ConfigurationManager.AppSettings[ConfigurationInfrastructure.Node_Handler].Split(';');        // Getting the Node Handlers

            foreach (var dir in dirs)
            {
                m_imageServer.StartDirectoryHandler(dir);   // Starting a Hanlder on the File
            }

            // Code Here
            serviceStatus.dwCurrentState = ServiceState.SERVICE_RUNNING;
            SetServiceStatus(this.ServiceHandle, ref serviceStatus);
        }