Fix test componente

This commit is contained in:
2026-03-18 15:38:20 +01:00
parent cc7bf34ec1
commit 6faaa74359
4 changed files with 191 additions and 158 deletions
+7 -2
View File
@@ -66,7 +66,8 @@
</div>
</div>
*@
@if(doEdit)
{
<WebWindowComplex.TableComp ListPayload="SetupList"
LiveData="CurrData"
SelectionData="SelectList"
@@ -75,7 +76,11 @@
EC_DoUpdate="ExecRequest"
EC_OnClose="CloseObj">
</WebWindowComplex.TableComp>
}
else
{
<button class="brn btn-danger" @onclick="SetEdit">Click per editare</button>
}
@if (!string.IsNullOrEmpty(outClose))
{
+176 -153
View File
@@ -1,13 +1,9 @@
using Egw.Window.Data;
using EgwCoreLib.Lux.Core;
using EgwCoreLib.Lux.Core.RestPayload;
using EgwCoreLib.Lux.Data.DbModel.Config;
using EgwCoreLib.Lux.Data.Services;
using Microsoft.AspNetCore.Components;
using Newtonsoft.Json;
using NLog;
using System.Diagnostics;
using System.Security.AccessControl;
using WebWindowComplex;
using WebWindowComplex.DTO;
using static WebWindowComplex.LayoutConst;
@@ -41,29 +37,34 @@ namespace Test.UI.Components.Pages
/// </summary>
protected LivePayload CurrData = new LivePayload();
/// <summary>
/// Livello di accesso
/// -- true: utente base (versione semplificata)
/// -- false: utente avanzato (versione completa)
/// </summary>
protected bool User = false;
protected List<AreaProfiles> currElement = new List<AreaProfiles>();
protected Dictionary<int, string> currGroupShape = new Dictionary<int, string>();
protected List<AreaProfiles> currElement = new List<AreaProfiles>();
protected Dictionary<int, string> currHwOption = new Dictionary<int, string>();
protected string currJwd = "...";
protected Dictionary<string, string> m_CurrArgs = new Dictionary<string, string>();
protected string prevJwd = "";
/// <summary>
/// Configurazione selezionati
/// </summary>
protected SelectPayload SelectList = new SelectPayload();
/// <summary>
/// Configurazione elenchi anagrafiche
/// </summary>
protected BaseListPayload SetupList = new BaseListPayload();
/// <summary>
/// Configurazione selezionati
/// Livello di accesso
/// -- true: utente base (versione semplificata)
/// -- false: utente avanzato (versione completa)
/// </summary>
protected SelectPayload SelectList = new SelectPayload();
protected bool User = false;
#endregion Protected Fields
@@ -101,24 +102,142 @@ namespace Test.UI.Components.Pages
new string("Abete")
};
[Inject]
protected IConfiguration Config { get; set; } = null!;
[Inject]
protected DataLayerServices DLService { get; set; } = null!;
[Inject]
protected ImageCacheService ICService { get; set; } = null!;
protected MarkupString JsonSer
{
get => (MarkupString)currJwd.Replace(Environment.NewLine, "<br/>").Replace(" ", "&nbsp;");
}
protected string SelColorMaterial { get; set; } = "";
protected string SelFamilyHardware { get; set; } = "";
protected string SelGlass { get; set; } = "";
protected string SelMaterial { get; set; } = "";
#endregion Protected Properties
#region Protected Methods
protected override void OnAfterRender(bool firstRender)
{
if (firstRender)
{
// JS interop or data fetches go here
isInteractive = true;
}
}
protected override async Task OnInitializedAsync()
{
ConfInit();
User = false;
Random random = new Random();
CalcUid = Convert.ToString(random.Next(1000, 10000));
windowUid = CalcUid;
//InitialJwd = File.ReadAllText("Data\\AntaDoppiaInglesine.jwd");
#if false
InitialJwd = File.ReadAllText("Data\\AntaDoppia.jwd");
#endif
InitialJwd = "{}";
currJwd = InitialJwd;
// rileggo altri dati
await ReloadData();
// costruisco lista profili
ProfilePayload pp1 = new ProfilePayload()
{
ProfileName = "Profilo78",
ThresholdList = ThresholdProfilo78,
ParameterDict = ParamProfilo78
};
ProfilePayload pp2 = new ProfilePayload()
{
ProfileName = "ProfiloSaomad",
ThresholdList = ThresholdProfiloSaomad,
ParameterDict = ParamProfiloSaomad
};
AvailProfileList = new List<ProfilePayload> { pp1, pp2 };
// preparo conf oggetti x controllo
SetupList = new BaseListPayload()
{
ColorMaterial = AvailColorMaterialList,
FamilyHardware = AvailFamilyHardwareList,
Glass = AvailGlassList,
Hardware = AvailHardwareList,
Material = AvailMaterialList,
ProfileList = AvailProfileList
};
CurrData = new LivePayload()
{
CurrJwd = InitialJwd,
SvgPreview = currSvg,
DictShape = currGroupShape,
DictOptionsXml = currHwOption
};
DLService.PipeSvg.EA_NewMessage += PipeSvg_EA_NewMessage;
DLService.PipeShape.EA_NewMessage += PipeShape_EA_NewMessage;
DLService.PipeHwOpt.EA_NewMessage += PipeHwOption_EA_NewMessage;
DLService.PipeProfElement.EA_NewMessage += PipeProfElement_EA_NewMessage;
}
#endregion Protected Methods
#region Private Fields
private string apiUrl = "";
/// <summary>
/// Lista profili da DB
/// </summary>
private List<ProfilePayload> AvailProfileList = new List<ProfilePayload>();
private string calcTag = "";
private List<Threshold> ThresholdProfilo78 = new List<Threshold>()
{
{ new Threshold(3, "Bottom") },
{ new Threshold(1, "Threshold") }
};
private string CalcUid = "CurrWindow";
private List<Threshold> ThresholdProfiloSaomad = new List<Threshold>()
{
{ new Threshold(3, "Bottom") },
{ new Threshold(2, "BottomWaterdrip") },
{ new Threshold(1, "Threshold") }
};
private string cFileHardware = "Hardware/Setup.json";
private string channelHwOpt = "";
private string channelProfElem = "";
private string channelProfList = "";
private string channelShape = "";
private string channelSvg = "";
private string currSvg = "";
private bool doEdit = false;
private string GenericBasePath = "";
private string imgBasePath = "";
/// <summary>
/// Semaforo x definire se sia già in modalità ionterattiva o di prerendering
/// </summary>
private bool isInteractive = false;
//private string colorMassUpdate;
//private string familyHWMassUpdate;
//private string glassMassUpdate;
//private Hardware hardwareMassUpdate;
//private string materialMassUpdate;
//private string profileMassUpdate;
private string outClose = "";
private string outSave = "";
private Dictionary<string, double> ParamProfilo78 = new Dictionary<string, double>()
{
@@ -299,121 +418,20 @@ namespace Test.UI.Components.Pages
{"Frame_Rail_Bottom_DimMax", 80}
};
[Inject]
protected IConfiguration Config { get; set; } = null!;
[Inject]
protected DataLayerServices DLService { get; set; } = null!;
[Inject]
protected ImageCacheService ICService { get; set; } = null!;
protected MarkupString JsonSer
private List<Threshold> ThresholdProfilo78 = new List<Threshold>()
{
get => (MarkupString)currJwd.Replace(Environment.NewLine, "<br/>").Replace(" ", "&nbsp;");
}
{ new Threshold(3, "Bottom") },
{ new Threshold(1, "Threshold") }
};
protected string SelColorMaterial { get; set; } = "";
protected string SelFamilyHardware { get; set; } = "";
protected string SelGlass { get; set; } = "";
protected string SelMaterial { get; set; } = "";
#endregion Protected Properties
#region Protected Methods
protected override void OnAfterRender(bool firstRender)
private List<Threshold> ThresholdProfiloSaomad = new List<Threshold>()
{
if (firstRender)
{
// JS interop or data fetches go here
isInteractive = true;
}
}
{ new Threshold(3, "Bottom") },
{ new Threshold(2, "BottomWaterdrip") },
{ new Threshold(1, "Threshold") }
};
protected override async Task OnInitializedAsync()
{
ConfInit();
User = false;
Random random = new Random();
CalcUid = Convert.ToString(random.Next(1000, 10000));
windowUid = CalcUid;
//InitialJwd = File.ReadAllText("Data\\AntaDoppiaInglesine.jwd");
InitialJwd = File.ReadAllText("Data\\AntaDoppia.jwd");
currJwd = InitialJwd;
// rileggo altri dati
await ReloadData();
// costruisco lista profili
ProfilePayload pp1 = new ProfilePayload()
{
ProfileName = "Profilo78",
ThresholdList = ThresholdProfilo78,
ParameterDict = ParamProfilo78
};
ProfilePayload pp2 = new ProfilePayload()
{
ProfileName = "ProfiloSaomad",
ThresholdList = ThresholdProfiloSaomad,
ParameterDict = ParamProfiloSaomad
};
AvailProfileList = new List<ProfilePayload> { pp1, pp2 };
// preparo conf oggetti x controllo
SetupList = new BaseListPayload()
{
ColorMaterial = AvailColorMaterialList,
FamilyHardware = AvailFamilyHardwareList,
Glass = AvailGlassList,
Hardware = AvailHardwareList,
Material = AvailMaterialList,
ProfileList = AvailProfileList
};
CurrData = new LivePayload()
{
CurrJwd = InitialJwd,
SvgPreview = currSvg,
DictShape = currGroupShape,
DictOptionsXml = currHwOption
};
DLService.PipeSvg.EA_NewMessage += PipeSvg_EA_NewMessage;
DLService.PipeShape.EA_NewMessage += PipeShape_EA_NewMessage;
DLService.PipeHwOpt.EA_NewMessage += PipeHwOption_EA_NewMessage;
DLService.PipeProfElement.EA_NewMessage += PipeProfElement_EA_NewMessage;
}
#endregion Protected Methods
#region Private Fields
private string apiUrl = "";
private string calcTag = "";
private string CalcUid = "CurrWindow";
private string windowUid = "CurrWindow";
private string cFileHardware = "Hardware/Setup.json";
private string currSvg = "";
private string GenericBasePath = "";
//private string colorMassUpdate;
//private string familyHWMassUpdate;
//private string glassMassUpdate;
//private Hardware hardwareMassUpdate;
//private string materialMassUpdate;
//private string profileMassUpdate;
/// <summary>
/// Semaforo x definire se sia già in modalità ionterattiva o di prerendering
/// </summary>
private bool isInteractive = false;
private string outClose = "";
private string outSave = "";
private string imgBasePath = "";
private string channelHwOpt = "";
private string channelShape = "";
private string channelProfList = "";
private string channelProfElem = "";
private string channelSvg = "";
#endregion Private Fields
@@ -527,25 +545,6 @@ namespace Test.UI.Components.Pages
await Task.Delay(1);
}
private async void PipeShape_EA_NewMessage(object? sender, EventArgs e)
{
// aggiorno visualizzazione
PubSubEventArgs currArgs = (PubSubEventArgs)e;
// conversione on-the-fly SVG da mostrare
if (!string.IsNullOrEmpty(currArgs.newMessage) && currArgs.newMessage.Length > 2)
{
if (currArgs.msgUid.StartsWith($"{channelShape}:{windowUid}"))
{
// deserializzo il dizionario delle risposte...
var rawDict = JsonConvert.DeserializeObject<Dictionary<int, string>>(currArgs.newMessage);
currGroupShape = rawDict ?? new Dictionary<int, string>();
CurrData.DictShape = currGroupShape;
}
await InvokeAsync(StateHasChanged);
}
await Task.Delay(1);
}
private async void PipeProfElement_EA_NewMessage(object? sender, EventArgs e)
{
// aggiorno visualizzazione
@@ -565,6 +564,25 @@ namespace Test.UI.Components.Pages
await Task.Delay(1);
}
private async void PipeShape_EA_NewMessage(object? sender, EventArgs e)
{
// aggiorno visualizzazione
PubSubEventArgs currArgs = (PubSubEventArgs)e;
// conversione on-the-fly SVG da mostrare
if (!string.IsNullOrEmpty(currArgs.newMessage) && currArgs.newMessage.Length > 2)
{
if (currArgs.msgUid.StartsWith($"{channelShape}:{windowUid}"))
{
// deserializzo il dizionario delle risposte...
var rawDict = JsonConvert.DeserializeObject<Dictionary<int, string>>(currArgs.newMessage);
currGroupShape = rawDict ?? new Dictionary<int, string>();
CurrData.DictShape = currGroupShape;
}
await InvokeAsync(StateHasChanged);
}
await Task.Delay(1);
}
private async void PipeSvg_EA_NewMessage(object? sender, EventArgs e)
{
// aggiorno visualizzazione
@@ -601,6 +619,11 @@ namespace Test.UI.Components.Pages
return Task.Delay(100);
}
private void SetEdit(Microsoft.AspNetCore.Components.Web.MouseEventArgs args)
{
doEdit = true;
}
private void updateInfoJwd(string currSer, string? newFamilyHardware, Hardware? newHardware, string? newColorMaterial, string? newMaterial, string? newGlass, string? newProfile)
{
var newJwd = SerialMan.MassUpdate(currSer, newFamilyHardware, newHardware, newColorMaterial, newMaterial, newGlass, newProfile);
+4 -1
View File
@@ -6,7 +6,7 @@
<TargetFramework>net8.0</TargetFramework>
<Nullable>enable</Nullable>
<ImplicitUsings>enable</ImplicitUsings>
<Version>3.1.3.1610</Version>
<Version>3.1.3.1815</Version>
<Authors>Annamaria Sassi</Authors>
<Company>Egalware</Company>
<Description>Componente gestione Configurazioni avanzate Window per LUX</Description>
@@ -34,3 +34,6 @@
</Target>
</Project>
@@ -6,7 +6,7 @@
<TargetFramework>net8.0</TargetFramework>
<Nullable>enable</Nullable>
<ImplicitUsings>enable</ImplicitUsings>
<Version>3.1.3.1610</Version>
<Version>3.1.3.1815</Version>
<Authors>Annamaria Sassi</Authors>
<Company>Egalware</Company>
<Description>Componente gestione JWD per LUX</Description>
@@ -35,4 +35,6 @@
<Target Name="PostBuild" AfterTargets="PostBuildEvent">
<Exec Command="powershell.exe -ExecutionPolicy Unrestricted -NoProfile -NonInteractive -File $(ProjectDir)\post-build.ps1 -ProjectPath $(ProjectPath)" />
</Target>
</Project>
</Project>