From 6faaa743598803805488a3fdcee37dbba3be77dc Mon Sep 17 00:00:00 2001 From: Samuele Locatelli Date: Wed, 18 Mar 2026 15:38:20 +0100 Subject: [PATCH] Fix test componente --- Test.UI/Components/Pages/EditJWD.razor | 9 +- Test.UI/Components/Pages/EditJWD.razor.cs | 329 ++++++++++-------- WebWindowComplex/WebWindowComplex.csproj | 5 +- .../WebWindowConfigurator.csproj | 6 +- 4 files changed, 191 insertions(+), 158 deletions(-) diff --git a/Test.UI/Components/Pages/EditJWD.razor b/Test.UI/Components/Pages/EditJWD.razor index db522c4..693c30f 100644 --- a/Test.UI/Components/Pages/EditJWD.razor +++ b/Test.UI/Components/Pages/EditJWD.razor @@ -66,7 +66,8 @@ *@ - + @if(doEdit) +{ - +} +else +{ + +} @if (!string.IsNullOrEmpty(outClose)) { diff --git a/Test.UI/Components/Pages/EditJWD.razor.cs b/Test.UI/Components/Pages/EditJWD.razor.cs index 403a9c3..06a5af7 100644 --- a/Test.UI/Components/Pages/EditJWD.razor.cs +++ b/Test.UI/Components/Pages/EditJWD.razor.cs @@ -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 /// protected LivePayload CurrData = new LivePayload(); - /// - /// Livello di accesso - /// -- true: utente base (versione semplificata) - /// -- false: utente avanzato (versione completa) - /// - protected bool User = false; + protected List currElement = new List(); protected Dictionary currGroupShape = new Dictionary(); - protected List currElement = new List(); + protected Dictionary currHwOption = new Dictionary(); + protected string currJwd = "..."; + protected Dictionary m_CurrArgs = new Dictionary(); + protected string prevJwd = ""; + /// + /// Configurazione selezionati + /// + protected SelectPayload SelectList = new SelectPayload(); + /// /// Configurazione elenchi anagrafiche /// protected BaseListPayload SetupList = new BaseListPayload(); /// - /// Configurazione selezionati + /// Livello di accesso + /// -- true: utente base (versione semplificata) + /// -- false: utente avanzato (versione completa) /// - 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, "
").Replace(" ", " "); + } + + 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 { 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 = ""; + /// /// Lista profili da DB /// private List AvailProfileList = new List(); + private string calcTag = ""; - private List ThresholdProfilo78 = new List() - { - { new Threshold(3, "Bottom") }, - { new Threshold(1, "Threshold") } - }; + private string CalcUid = "CurrWindow"; - private List ThresholdProfiloSaomad = new List() - { - { 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 = ""; + + /// + /// Semaforo x definire se sia già in modalità ionterattiva o di prerendering + /// + 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 ParamProfilo78 = new Dictionary() { @@ -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 ThresholdProfilo78 = new List() { - get => (MarkupString)currJwd.Replace(Environment.NewLine, "
").Replace(" ", " "); - } + { 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 ThresholdProfiloSaomad = new List() { - 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 { 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; - - /// - /// Semaforo x definire se sia già in modalità ionterattiva o di prerendering - /// - 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>(currArgs.newMessage); - currGroupShape = rawDict ?? new Dictionary(); - 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>(currArgs.newMessage); + currGroupShape = rawDict ?? new Dictionary(); + 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); diff --git a/WebWindowComplex/WebWindowComplex.csproj b/WebWindowComplex/WebWindowComplex.csproj index 36649d1..dd170d3 100644 --- a/WebWindowComplex/WebWindowComplex.csproj +++ b/WebWindowComplex/WebWindowComplex.csproj @@ -6,7 +6,7 @@ net8.0 enable enable - 3.1.3.1610 + 3.1.3.1815 Annamaria Sassi Egalware Componente gestione Configurazioni avanzate Window per LUX @@ -34,3 +34,6 @@ + + + diff --git a/WebWindowConfigurator/WebWindowConfigurator.csproj b/WebWindowConfigurator/WebWindowConfigurator.csproj index 1763a3d..2b3c764 100644 --- a/WebWindowConfigurator/WebWindowConfigurator.csproj +++ b/WebWindowConfigurator/WebWindowConfigurator.csproj @@ -6,7 +6,7 @@ net8.0 enable enable - 3.1.3.1610 + 3.1.3.1815 Annamaria Sassi Egalware Componente gestione JWD per LUX @@ -35,4 +35,6 @@ - \ No newline at end of file + + +