Exemple #1
0
 internal Win32ServiceHost(string serviceName, IWin32ServiceStateMachine stateMachine, INativeInterop nativeInterop)
 {
     _serviceName   = serviceName ?? throw new ArgumentNullException(nameof(serviceName));
     _stateMachine  = stateMachine ?? throw new ArgumentNullException(nameof(stateMachine));
     _nativeInterop = nativeInterop ?? throw new ArgumentNullException(nameof(nativeInterop));
     _serviceMainFunctionDelegate   = ServiceMainFunction;
     _serviceControlHandlerDelegate = HandleServiceControlCommand;
 }
        internal Win32ServiceHost([NotNull] string serviceName, [NotNull] IWin32ServiceStateMachine stateMachine, [NotNull] INativeInterop nativeInterop)
        {
            this.serviceName   = serviceName ?? throw new System.ArgumentNullException(nameof(serviceName));
            this.stateMachine  = stateMachine ?? throw new System.ArgumentNullException(nameof(stateMachine));
            this.nativeInterop = nativeInterop ?? throw new System.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([NotNull] IPausableWin32Service service, [NotNull] INativeInterop nativeInterop)
        {
            if (service == null)
            {
                throw new System.ArgumentNullException(nameof(service));
            }

            this.nativeInterop = nativeInterop ?? throw new System.ArgumentNullException(nameof(nativeInterop));
            serviceName        = service.ServiceName;
            stateMachine       = new PausableServiceStateMachine(service);

            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;
        }
        internal Win32ServiceHost(string serviceName, IWin32ServiceStateMachine stateMachine, INativeInterop nativeInterop)
        {
            if (serviceName == null)
            {
                throw new ArgumentNullException(nameof(serviceName));
            }
            if (stateMachine == null)
            {
                throw new ArgumentNullException(nameof(stateMachine));
            }
            if (nativeInterop == null)
            {
                throw new ArgumentNullException(nameof(nativeInterop));
            }

            this.serviceName   = serviceName;
            this.stateMachine  = stateMachine;
            this.nativeInterop = nativeInterop;

            serviceMainFunctionDelegate   = ServiceMainFunction;
            serviceControlHandlerDelegate = HandleServiceControlCommand;
        }
 public Win32ServiceHost([NotNull] string serviceName, [NotNull] IWin32ServiceStateMachine stateMachine)
     : this(serviceName, stateMachine, Win32Interop.Wrapper)
 {
 }
Exemple #8
0
 public SimpleServiceStateMachineTests()
 {
     sut = new SimpleServiceStateMachine(serviceImplmentation);
 }
Exemple #9
0
 public PausableServiceStateMachineTests()
 {
     sut = new PausableServiceStateMachine(serviceImplmentation);
 }