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 InvokeOnStoppedAsync(int stoppedCode, CancellationToken cancellationToken = default) { await OnStoppedAsync.Invoke(stoppedCode, cancellationToken); }