コード例 #1
0
        public void Init(IHostedWindowsService hostedService)
        {
            if (hostedService == null)
                throw new ArgumentNullException("hostedService");

            this.SetProperties(hostedService);
            HostedService = hostedService;
        }
コード例 #2
0
        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;
        }