Fix API che aprte solo se configurata
This commit is contained in:
@@ -1,4 +1,5 @@
|
||||
using EgwMultiEngineManager;
|
||||
using Lux.Data;
|
||||
using Lux.Data.Services;
|
||||
using Microsoft.AspNetCore.Http;
|
||||
using Microsoft.AspNetCore.Mvc;
|
||||
@@ -12,11 +13,17 @@ namespace Lux.API.Controllers
|
||||
{
|
||||
#region Public Constructors
|
||||
|
||||
public WindowController(ILogger<WindowController> logger, ExecProcessManager EgwProcManager, ImageCacheService imgServ)
|
||||
public WindowController(IConfigurationManager config, ILogger<WindowController> logger, ExecProcessManager EgwProcManager, ImageCacheService imgServ)
|
||||
{
|
||||
_logger = logger;
|
||||
ProcessMan = EgwProcManager;
|
||||
ProcessMan.m_AnswerReceived += ProcessMan_m_AnswerReceived;
|
||||
_config = config;
|
||||
// verifico se usare engine
|
||||
enableEgwEng = _config.GetValue<bool>("ServerConf:EgwEngineEnab");
|
||||
if (enableEgwEng)
|
||||
{
|
||||
ProcessMan = EgwProcManager;
|
||||
ProcessMan.m_AnswerReceived += ProcessMan_m_AnswerReceived;
|
||||
}
|
||||
ImgService = imgServ;
|
||||
}
|
||||
|
||||
@@ -40,19 +47,22 @@ namespace Lux.API.Controllers
|
||||
// ...se ricevo percorso --> leggo jwd/svg cablato
|
||||
if (!string.IsNullOrEmpty(currJwd))
|
||||
{
|
||||
Dictionary<string, string> DictExec = new Dictionary<string, string>();
|
||||
DictExec.Add("Mode", "1");
|
||||
DictExec.Add("Jwd", currJwd);
|
||||
int nId = 1;
|
||||
ProcessArgs currArgs = new ProcessArgs(nId, DictExec);
|
||||
bool done = ProcessMan.ArgumentsEnqueue(currArgs);
|
||||
waitResult = true;
|
||||
|
||||
int numWait = 200;
|
||||
while (numWait > 0 && waitResult)
|
||||
if (enableEgwEng && ProcessMan != null)
|
||||
{
|
||||
numWait--;
|
||||
await Task.Delay(waitDelay);
|
||||
Dictionary<string, string> DictExec = new Dictionary<string, string>();
|
||||
DictExec.Add("Mode", "1");
|
||||
DictExec.Add("Jwd", currJwd);
|
||||
int nId = 1;
|
||||
ProcessArgs currArgs = new ProcessArgs(nId, DictExec);
|
||||
bool done = ProcessMan.ArgumentsEnqueue(currArgs);
|
||||
waitResult = true;
|
||||
|
||||
int numWait = 200;
|
||||
while (numWait > 0 && waitResult)
|
||||
{
|
||||
numWait--;
|
||||
await Task.Delay(waitDelay);
|
||||
}
|
||||
}
|
||||
// se ho risultato mostro...
|
||||
if (!string.IsNullOrEmpty(lastSvg))
|
||||
@@ -98,6 +108,8 @@ namespace Lux.API.Controllers
|
||||
#region Private Fields
|
||||
|
||||
private readonly ILogger<WindowController> _logger;
|
||||
private IConfigurationManager _config;
|
||||
private bool enableEgwEng = true;
|
||||
|
||||
//private Dictionary<int, string> listSvg = new Dictionary<int, string>();
|
||||
private string lastSvg = "";
|
||||
@@ -115,7 +127,7 @@ namespace Lux.API.Controllers
|
||||
/// <summary>
|
||||
/// Esecutore di processi generico
|
||||
/// </summary>
|
||||
private ExecProcessManager ProcessMan { get; set; }
|
||||
private ExecProcessManager? ProcessMan { get; set; }
|
||||
|
||||
#endregion Private Properties
|
||||
|
||||
@@ -127,10 +139,7 @@ namespace Lux.API.Controllers
|
||||
/// <param name="ProcessArgsResult"></param>
|
||||
private void ProcessMan_m_AnswerReceived(ProcessArgsResult result)
|
||||
{
|
||||
// verifico che sia la mia richeista con nId cablato a 1
|
||||
if (result.nId == 1)
|
||||
{
|
||||
}
|
||||
// verifico che sia la mia richeista con id immagine... FARE!!!
|
||||
// salvo il risultato...
|
||||
if (result.Args != null && result.Args.Count > 0)
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user