39 lines
1.2 KiB
C#
39 lines
1.2 KiB
C#
using System;
|
|
using System.Drawing;
|
|
using System.Threading;
|
|
using System.Threading.Tasks;
|
|
using Microsoft.Extensions.Hosting;
|
|
using Microsoft.Extensions.Logging;
|
|
using OpenCvSharp;
|
|
using Squirrowse.Client.Service;
|
|
|
|
namespace Squirrowse.Client
|
|
{
|
|
public class Worker : BackgroundService
|
|
{
|
|
private readonly ILogger<Worker> logger;
|
|
private readonly IConnectionManager _connectionManager;
|
|
private readonly ICameraService camera;
|
|
|
|
public Worker(ILogger<Worker> logger, IConnectionManager connectionManager, ICameraService camera)
|
|
{
|
|
this.logger = logger;
|
|
this._connectionManager = connectionManager;
|
|
this.camera = camera;
|
|
}
|
|
|
|
protected override async Task ExecuteAsync(CancellationToken stoppingToken)
|
|
{
|
|
|
|
while (!stoppingToken.IsCancellationRequested)
|
|
{
|
|
logger.LogInformation("Worker running at: {time}", DateTimeOffset.Now);
|
|
|
|
await _connectionManager.GetConnection();
|
|
//await _connectionManager.SendStreamAsync(camera.GetFramesAsyncEnumerator());
|
|
|
|
// await Task.Delay(50, stoppingToken);
|
|
}
|
|
}
|
|
}
|
|
} |