Aggiunta e testata rilettura DDF + SVG da missing

This commit is contained in:
Samuele Locatelli
2024-02-16 18:05:43 +01:00
parent 70cd621f80
commit 4585ac4bf8
9 changed files with 58 additions and 13 deletions
@@ -23,6 +23,7 @@ namespace WebDoorCreator.API.Controllers
{
Log.Info("Starting DoorImageController");
_configuration = configuration;
WaitReloadSvg = _configuration.GetValue<int>("RuntimeOpt:WaitReloadSvg");
QDService = cQDService;
WDService = cWDCService;
Log.Info("Avviato DoorImageController");
@@ -48,7 +49,11 @@ namespace WebDoorCreator.API.Controllers
if (string.IsNullOrEmpty(svgContent))
{
// richiede ricalcolo img
await SendRecalcReq(DoorId);
svgContent = await SendRecalcReq(DoorId);
}
// se fosse vuoto...
if (string.IsNullOrEmpty(svgContent))
{
// legge img vuota
svgContent = QDService.DoorGetMissingSvg();
}
@@ -104,6 +109,8 @@ namespace WebDoorCreator.API.Controllers
private static Logger Log = LogManager.GetCurrentClassLogger();
private int WaitReloadSvg = 100;
#endregion Private Fields
#region Private Properties
@@ -121,8 +128,9 @@ namespace WebDoorCreator.API.Controllers
/// </summary>
/// <param name="DoorId"></param>
/// <returns></returns>
private async Task SendRecalcReq(int DoorId)
private async Task<string> SendRecalcReq(int DoorId)
{
string answ = "";
// richiede ricalcolo img
List<string> doorIdList = new List<string>() { $"{DoorId}" };
// chiamo reset richieste
@@ -135,6 +143,12 @@ namespace WebDoorCreator.API.Controllers
// versione corrente del DDF generato
int currVers = await QDService.SendCalcReq(DoorId, currDDF);
}
// attende ...
await Task.Delay(WaitReloadSvg);
// riprova lettura
answ = await QDService.DoorGetLastSvg(DoorId);
return answ;
}
#endregion Private Methods