Beispiel #1
0
 internal Win32ServiceHost(IWin32Service service, INativeInterop nativeInterop)
 {
     _serviceName   = service?.ServiceName ?? throw new ArgumentNullException(nameof(service));
     _stateMachine  = new SimpleServiceStateMachine(service);
     _nativeInterop = nativeInterop ?? throw new ArgumentNullException(nameof(nativeInterop));
     _serviceMainFunctionDelegate   = ServiceMainFunction;
     _serviceControlHandlerDelegate = HandleServiceControlCommand;
 }
        internal Win32ServiceHost([NotNull] IWin32Service service, [NotNull] INativeInterop nativeInterop)
        {
            serviceName        = service.ServiceName;
            this.stateMachine  = (service == null) ? throw new ArgumentNullException(nameof(service)) : new SimpleServiceStateMachine(service);
            this.nativeInterop = nativeInterop ?? throw new ArgumentNullException(nameof(nativeInterop));

            serviceMainFunctionDelegate   = ServiceMainFunction;
            serviceControlHandlerDelegate = HandleServiceControlCommand;
        }
        internal Win32ServiceHost(IWin32Service service, INativeInterop nativeInterop)
        {
            if (service == null)
            {
                throw new ArgumentNullException(nameof(service));
            }
            if (nativeInterop == null)
            {
                throw new ArgumentNullException(nameof(nativeInterop));
            }

            serviceName        = service.ServiceName;
            stateMachine       = new SimpleServiceStateMachine(service);
            this.nativeInterop = nativeInterop;

            serviceMainFunctionDelegate   = ServiceMainFunction;
            serviceControlHandlerDelegate = HandleServiceControlCommand;
        }
 /// <summary>
 /// Initializes a new <see cref="SimpleServiceStateMachine"/> to run the specified service.
 /// </summary>
 /// <param name="serviceImplementation">The service implementation.</param>
 public SimpleServiceStateMachine(IWin32Service serviceImplementation)
 {
     this.serviceImplementation = serviceImplementation;
 }
 public Win32ServiceHost([NotNull] IWin32Service service)
     : this(service, Win32Interop.Wrapper)
 {
 }