You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
34 lines
800 B
34 lines
800 B
2 years ago
|
namespace tias.deep.CMS;
|
||
|
|
||
|
public class Worker : BackgroundService
|
||
|
{
|
||
|
private tias.deep.server.core.Init _server;
|
||
|
|
||
|
public Worker()
|
||
|
{
|
||
|
this._server = new tias.deep.server.core.Init();
|
||
|
}
|
||
|
|
||
|
public override Task StartAsync(CancellationToken cancellationToken)
|
||
|
{
|
||
|
_server.StartServer(false);
|
||
|
|
||
|
return base.StartAsync(cancellationToken);
|
||
|
}
|
||
|
|
||
|
protected override async Task ExecuteAsync(CancellationToken stoppingToken)
|
||
|
{
|
||
|
while (!stoppingToken.IsCancellationRequested)
|
||
|
{
|
||
|
await Task.Delay(1000, stoppingToken);
|
||
|
}
|
||
|
}
|
||
|
|
||
|
public override Task StopAsync(CancellationToken cancellationToken)
|
||
|
{
|
||
|
_server.StopServer();
|
||
|
|
||
|
return base.StopAsync(cancellationToken);
|
||
|
}
|
||
|
}
|