Exemplo n.º 1
0
        public DefaultServiceController(DefaultServiceHostController hostController)
        {
            _hostController = hostController;
            _hostController.OnStoppedAsync += async(code, cancellationToken) =>
                                              await OnStoppedAsync.Invoke(code, cancellationToken);

            _hostController.OnStopAsync += async cancellationToken =>
                                           await OnStopAsync.Invoke(cancellationToken);

            _hostController.OnStartedAsync += async(code, cancellationToken) =>
            {
                if (OnStartedAsync != null)
                {
                    await OnStartedAsync.Invoke(code, cancellationToken);
                }
            };
        }
 public async Task InvokeOnStartedAsync(int startedCode,
                                        CancellationToken cancellationToken = default)
 {
     await OnStartedAsync.Invoke(startedCode, cancellationToken);
 }