Пример #1
0
        public void Init(IHostedWindowsService hostedService)
        {
            if (hostedService == null)
                throw new ArgumentNullException("hostedService");

            this.SetProperties(hostedService);
            HostedService = hostedService;
        }
        public static void SetProperties(this ServiceBase service, IHostedWindowsService hostedWindowsService)
        {
            if (service == null)
                throw new ArgumentNullException("service");

            if (hostedWindowsService == null)
                throw new ArgumentNullException("hostedWindowsService");

            service.ServiceName = hostedWindowsService.ServiceName;
            service.CanPauseAndContinue = hostedWindowsService.CanPauseAndContinue;
            service.CanShutdown = hostedWindowsService.CanShutdown;
            service.CanStop = hostedWindowsService.CanStop;
        }