Files
GSS2Rework/GSS2.Test/Worker.cs
T

50 lines
1.7 KiB
C#

using System.Drawing;
using GSS2.Core.Analysis.AmineContent.Database;
using GSS2.Core.Hardware;
namespace GSS2.Test;
public class Worker(
ILogger<Worker> logger,
IHostApplicationLifetime applicationLifetime,
AmineContentCalibrationContext amineCalibrationContext,
AmineContentResultsContext amineResultsContext,
LightsService lightsService,
IlluminatorService illuminatorService,
CameraService cameraService
) : BackgroundService
{
private readonly ILogger<Worker> _logger = logger;
private readonly IHostApplicationLifetime _applicationLifetime = applicationLifetime;
private readonly AmineContentCalibrationContext _amineCalibrationContext = amineCalibrationContext;
private readonly AmineContentResultsContext _amineResultsContext = amineResultsContext;
private readonly LightsService _lightsService = lightsService;
private readonly IlluminatorService _illuminatorService = illuminatorService;
private readonly CameraService _cameraService = cameraService;
protected override async Task ExecuteAsync(CancellationToken cancellationToken)
{
_cameraService.Test();
// _ = _lightsService.Run(cancellationToken);
// _ = _lightsService.SnowfallAsync(0.3, 1, Color.Aqua, cancellationToken);
// _illuminatorService.SetIntensity(0.01, 0, 0);
// _illuminatorService.TurnOn();
// await Task.Delay(1000);
// var img = await _cameraService.CaptureImage(cancellationToken, 50);
// // img?.SaveImage("IMAGE.png");
// await Task.Delay(1000);
// _illuminatorService.TurnOff();
// await _lightsService.DisconnectAsync(cancellationToken);
applicationLifetime.StopApplication();
}
}