From c7a151e530f40f6acca749f82428ba61ecfd83f6 Mon Sep 17 00:00:00 2001 From: Annamaria Sassi Date: Mon, 27 Oct 2025 13:19:24 +0100 Subject: [PATCH] - Inizio gestione opzioni hardware - Aggiunta chiamata per opzioni hardware - Aggiunto componente per AGBOptionCombo --- README.md | 2 - Test.UI/Components/Pages/EditJWD.razor.cs | 48 +++--- WebWindowComplex/Compo/CardSashGroup.razor | 66 +++++--- WebWindowComplex/Compo/CardSashGroup.razor.cs | 21 ++- WebWindowComplex/Compo/EditJoint.razor | 2 +- WebWindowComplex/Compo/EditOptionCombo.razor | 9 ++ .../Compo/EditOptionCombo.razor.cs | 36 +++++ .../{ParametriOpzioni.cs => AGBOption.cs} | 4 +- WebWindowComplex/Models/AGBOptionCombo.cs | 2 +- WebWindowComplex/Models/AGBOptionText.cs | 2 +- WebWindowComplex/Models/Area.cs | 138 ++++++++-------- .../Models/OnReqHwOptEventArgs.cs | 28 ++++ WebWindowComplex/Models/Sash.cs | 148 +++++++++--------- WebWindowComplex/ParametriOpzioni.cs | 22 +-- WebWindowComplex/TableComp.razor.cs | 42 +++-- WebWindowComplex/WebWindowComplex.csproj | 16 +- .../WebWindowConfigurator.csproj | 4 +- 17 files changed, 377 insertions(+), 213 deletions(-) create mode 100644 WebWindowComplex/Compo/EditOptionCombo.razor create mode 100644 WebWindowComplex/Compo/EditOptionCombo.razor.cs rename WebWindowComplex/Models/{ParametriOpzioni.cs => AGBOption.cs} (93%) create mode 100644 WebWindowComplex/Models/OnReqHwOptEventArgs.cs diff --git a/README.md b/README.md index 01aafd9..2dd019f 100644 --- a/README.md +++ b/README.md @@ -116,8 +116,6 @@ Descrive il tipo di riempimento: vetro o pannello. ## Roadmap Mancano: - - [ ] Gestione richiesta forma del gruppo di ante; - - [ ] Calcolare svg solo dopo che si hanno i dati bloccanti; - [ ] Gestione e inserimento opzioni hardware in CardSashGroup ; - [ ] Filtrare hardware utilizzando anche la posizione dell'anta battente. diff --git a/Test.UI/Components/Pages/EditJWD.razor.cs b/Test.UI/Components/Pages/EditJWD.razor.cs index 88d3ecc..0e14743 100644 --- a/Test.UI/Components/Pages/EditJWD.razor.cs +++ b/Test.UI/Components/Pages/EditJWD.razor.cs @@ -33,6 +33,7 @@ namespace Test.UI.Components.Pages { DLService.PipeSvg.EA_NewMessage -= PipeSvg_EA_NewMessage; DLService.PipeShape.EA_NewMessage -= PipeShape_EA_NewMessage; + DLService.PipeHwOpt.EA_NewMessage -= PipeHwOption_EA_NewMessage; } #endregion Public Methods @@ -44,11 +45,11 @@ namespace Test.UI.Components.Pages /// protected LivePayload CurrData = new LivePayload(); + protected string prevJwd = ""; protected string currJwd = "..."; protected Dictionary m_CurrArgs = new Dictionary(); - protected string prevJwd = ""; - protected Dictionary currGroupShape = new Dictionary(); + protected string currHwOption = ""; /// /// Configurazione elenchi anagrafiche @@ -136,8 +137,6 @@ namespace Test.UI.Components.Pages ColorMaterial = AvailColorMaterialList, FamilyHardware = AvailFamilyHardwareList, Glass = AvailGlassList, - //FamilyHardware = new List(), - //Material = new List(), Hardware = AvailHardwareList, Material = AvailMaterialList, Profile = AvailProfileList, @@ -147,10 +146,12 @@ namespace Test.UI.Components.Pages { CurrJwd = InitialJwd, SvgPreview = currSvg, - DictShape = currGroupShape + DictShape = currGroupShape, + OptionsXml = currHwOption }; DLService.PipeSvg.EA_NewMessage += PipeSvg_EA_NewMessage; DLService.PipeShape.EA_NewMessage += PipeShape_EA_NewMessage; + DLService.PipeHwOpt.EA_NewMessage += PipeHwOption_EA_NewMessage; } #endregion Protected Methods @@ -193,6 +194,7 @@ namespace Test.UI.Components.Pages private string svgChannel = ""; private string shapeChannel = ""; + private string hwOptionChannel = ""; private string windowUid = "CurrWindow"; @@ -218,7 +220,7 @@ namespace Test.UI.Components.Pages calcTag = Config.GetValue("ServerConf:CalcTag") ?? ""; svgChannel = Config.GetValue("ServerConf:SvgChannel") ?? ""; shapeChannel = Config.GetValue("ServerConf:ShapeChannel") ?? ""; - + hwOptionChannel = Config.GetValue("ServerConf:HwOptChannel") ?? ""; } private async Task ExecRequest(Dictionary CurrArgs) @@ -249,25 +251,12 @@ namespace Test.UI.Components.Pages // aggiorno visualizzazione PubSubEventArgs currArgs = (PubSubEventArgs)e; // conversione on-the-fly SVG da mostrare - if (!string.IsNullOrEmpty(currArgs.newMessage)) + if (!string.IsNullOrEmpty(currArgs.newMessage) && currArgs.newMessage.Length > 2) { if (currArgs.msgUid.StartsWith($"{shapeChannel}:{windowUid}")) { // deserializzo il dizionario delle risposte... var rawDict = JsonConvert.DeserializeObject>(currArgs.newMessage); -#if false - int groupId = 0; - // verifica del groupID... - int.TryParse(currArgs.msgUid.Replace($"{shapeChannel}:{windowUid}:", ""), out groupId); - if (currGroupShape.ContainsKey(groupId)) - { - currGroupShape[groupId] = currArgs.newMessage; - } - else - { - currGroupShape.Add(groupId, currArgs.newMessage); - } -#endif currGroupShape = rawDict ?? new Dictionary(); CurrData.DictShape = currGroupShape; } @@ -276,6 +265,25 @@ namespace Test.UI.Components.Pages await Task.Delay(1); } + private async void PipeHwOption_EA_NewMessage(object? sender, EventArgs e) + { + // aggiorno visualizzazione + PubSubEventArgs currArgs = (PubSubEventArgs)e; + // conversione on-the-fly SVG da mostrare + if (!string.IsNullOrEmpty(currArgs.newMessage)) + { + if (currArgs.msgUid.StartsWith($"{hwOptionChannel}:{windowUid}")) + { + // deserializzo il dizionario delle risposte... + //var rawAns = JsonConvert.DeserializeObject(currArgs.newMessage); + currHwOption = currArgs.newMessage; + CurrData.OptionsXml = currHwOption; + } + await InvokeAsync(StateHasChanged); + } + await Task.Delay(1); + } + private async void PipeSvg_EA_NewMessage(object? sender, EventArgs e) { // aggiorno visualizzazione diff --git a/WebWindowComplex/Compo/CardSashGroup.razor b/WebWindowComplex/Compo/CardSashGroup.razor index 6df14ac..f67b953 100644 --- a/WebWindowComplex/Compo/CardSashGroup.razor +++ b/WebWindowComplex/Compo/CardSashGroup.razor @@ -20,7 +20,7 @@
- Qty sash + Qty sash
@@ -28,8 +28,8 @@
- - @@ -37,7 +37,7 @@
- Qty bottom rail + Qty bottom rail
@@ -77,8 +77,8 @@
- - @if (Sash.s_FamilyHardwareList == null || Sash.s_FamilyHardwareList.Count == 0) { @@ -93,10 +93,10 @@
@if (string.IsNullOrEmpty(CurrItem.SashShape)) - { + {
- -
@@ -104,29 +104,51 @@ else {
- - @foreach (var hlItem in CurrItem.HardwareList) { } - @*@if (CurrItem.HardwareList == null || CurrItem.HardwareList.Count == 0) - { - - } - else - { - @foreach (var hlItem in CurrItem.HardwareList) - { - - } - }*@
}
+
+
+
+
+
Hardware option
+
+
+ @if (CurrItem.HwdOptionList.Count > 0) + { + @foreach (var currOpt in CurrItem.HwdOptionList) + { + switch (currOpt.Type) + { + case AGBOption.HDWOPTIONTYPES.COMBO: + { + AGBOptionCombo currOptCombo = (AGBOptionCombo)currOpt; + + break; + } + case AGBOption.HDWOPTIONTYPES.TEXT: + { + AGBOptionText currOptText = (AGBOptionText)currOpt; +
+ @(currOptText.sName) + +
+ break; + } + } + } + } +
+
diff --git a/WebWindowComplex/Compo/CardSashGroup.razor.cs b/WebWindowComplex/Compo/CardSashGroup.razor.cs index 3c045ee..555ce9f 100644 --- a/WebWindowComplex/Compo/CardSashGroup.razor.cs +++ b/WebWindowComplex/Compo/CardSashGroup.razor.cs @@ -67,12 +67,14 @@ namespace WebWindowComplex.Compo [Parameter] public List SashList { get; set; } = null!; + public AGBOption CurrAGBOpt; + #endregion Public Properties #region Protected Properties /// - /// + /// Selezione hardware /// protected string SelHwType { @@ -162,6 +164,23 @@ namespace WebWindowComplex.Compo } } + /// + /// Report aggiornamento Option Combo + /// + /// + /// + private async Task UpdateOpt(AGBOptionCombo updRec) + { + // cerco il record + var currRec = CurrItem.HwdOptionList.FirstOrDefault(x => x.sName == updRec.sName && x.sDescription == updRec.sDescription); + // lo aggiorno + if (updRec != null) + { + currRec = updRec; + await EC_UpdateSash.InvokeAsync(CurrItem); + } + } + #endregion Private Methods } } \ No newline at end of file diff --git a/WebWindowComplex/Compo/EditJoint.razor b/WebWindowComplex/Compo/EditJoint.razor index 1ffcd67..0d8232c 100644 --- a/WebWindowComplex/Compo/EditJoint.razor +++ b/WebWindowComplex/Compo/EditJoint.razor @@ -1,7 +1,7 @@ @using static WebWindowComplex.LayoutConst
- diff --git a/WebWindowComplex/Compo/EditOptionCombo.razor b/WebWindowComplex/Compo/EditOptionCombo.razor new file mode 100644 index 0000000..e02c3a3 --- /dev/null +++ b/WebWindowComplex/Compo/EditOptionCombo.razor @@ -0,0 +1,9 @@ +
+ + +
\ No newline at end of file diff --git a/WebWindowComplex/Compo/EditOptionCombo.razor.cs b/WebWindowComplex/Compo/EditOptionCombo.razor.cs new file mode 100644 index 0000000..13b0c35 --- /dev/null +++ b/WebWindowComplex/Compo/EditOptionCombo.razor.cs @@ -0,0 +1,36 @@ +using Microsoft.AspNetCore.Components; +using WebWindowComplex.Models; + +namespace WebWindowComplex.Compo +{ + public partial class EditOptionCombo + { + #region Public Properties + + [Parameter] + public AGBOptionCombo CurrOpt { get; set; } = null!; + + [Parameter] + public EventCallback EC_Update { get; set; } + + #endregion Public Properties + + #region Private Properties + + private string CurrValue + { + get => CurrOpt.sValue.sValue; + set + { + if (CurrOpt.sValue.sValue != value) + { + CurrOpt.sValue = CurrOpt.ValueList.FirstOrDefault(x => x.sValue == value); + _ = EC_Update.InvokeAsync(CurrOpt); + } + } + } + + #endregion Private Properties + + } +} \ No newline at end of file diff --git a/WebWindowComplex/Models/ParametriOpzioni.cs b/WebWindowComplex/Models/AGBOption.cs similarity index 93% rename from WebWindowComplex/Models/ParametriOpzioni.cs rename to WebWindowComplex/Models/AGBOption.cs index 5ad6324..e144eb7 100644 --- a/WebWindowComplex/Models/ParametriOpzioni.cs +++ b/WebWindowComplex/Models/AGBOption.cs @@ -7,11 +7,11 @@ using static WebWindowComplex.Json.WindowConst; namespace WebWindowComplex.Models { - public partial class ParametriOpzioni + public partial class AGBOption { #region Public Constructors - public ParametriOpzioni(ParametriOpzioniParametri HdwOptionParam) + public AGBOption(ParametriOpzioniParametri HdwOptionParam) { m_sName = HdwOptionParam.NomeParametro; m_sDescription = HdwOptionParam.DescrizioneParametro; diff --git a/WebWindowComplex/Models/AGBOptionCombo.cs b/WebWindowComplex/Models/AGBOptionCombo.cs index 8413114..dfc41e4 100644 --- a/WebWindowComplex/Models/AGBOptionCombo.cs +++ b/WebWindowComplex/Models/AGBOptionCombo.cs @@ -6,7 +6,7 @@ using System.Threading.Tasks; namespace WebWindowComplex.Models { - public class AGBOptionCombo : ParametriOpzioni + public class AGBOptionCombo : AGBOption { #region Public Constructors diff --git a/WebWindowComplex/Models/AGBOptionText.cs b/WebWindowComplex/Models/AGBOptionText.cs index 252c814..32bcc35 100644 --- a/WebWindowComplex/Models/AGBOptionText.cs +++ b/WebWindowComplex/Models/AGBOptionText.cs @@ -6,7 +6,7 @@ using System.Threading.Tasks; namespace WebWindowComplex.Models { - public class AGBOptionText : ParametriOpzioni + public class AGBOptionText : AGBOption { #region Public Constructors diff --git a/WebWindowComplex/Models/Area.cs b/WebWindowComplex/Models/Area.cs index 719d4eb..65f52d7 100644 --- a/WebWindowComplex/Models/Area.cs +++ b/WebWindowComplex/Models/Area.cs @@ -98,67 +98,86 @@ namespace WebWindowComplex.Models m_CounterGroup++; } - public bool AddFirstSash() + public void AddFirstSash() { - bool answ = false; // Salvo il parent Area ParentArea = AreaList[0].ParentArea; // Creo area sash di default Sash SashArea = Sash.CreateSash(ParentArea); - // ricerco tra tutti gli hw disponibili... - - string sShape = FindSashShape(); - var listHwValid = Sash - .m_HardwareCompleteList - .Where(x => x.Shape == sShape && x.SashQty == 1) - .FirstOrDefault(); - if (listHwValid != null) - { - // seleziono la famiglia del primo hw trovato... - SashArea.SetSelFamilyHardware(listHwValid.FamilyName); -#if false - SashArea.ReqRefreshShape(); -#endif - SashArea.RefreshHardwareList(); - if (SashArea.HardwareList.Count == 0) - { - //answ = true; - SashArea.SetSelHardwareFromId("000000"); - } - else - { - SashArea.SetSelHardwareFromId(SashArea.HardwareList.First().Id); - } - // Salvo gli oggetti già presenti e li cancello da AreaList - List ContentArea = new List(); - ContentArea.Add(AreaList[0]); - AreaList.Remove(AreaList[0]); - // Aggiungo area - AreaList.Add(SashArea); - if (SashArea.nSashQty == 1) - { - // Inserisco il riempimento precedente - AreaList[0].AreaList.Add(ContentArea[0]); - AreaList[0].AreaList[0].SetParentArea(AreaList[0]); - } - else - { - // All'area Sash aggiunto uno Splitted per ogni anta - for (int i = 1; i < SashArea.nSashQty; i++) - { - AreaList[0].AreaList.Add(Splitted.CreateSplitted(SashArea)); - } - Fill fill2 = (Fill)ContentArea[0]; - for (int i = 1; i < SashArea.nSashQty; i++) - { - AreaList[0].AreaList[1].AreaList.Add(Fill.CreateFill(AreaList[0].AreaList[1], fill2.FillType)); - } - } - ParentWindow.OnUpdatePreview(ParentWindow.sSerialized()); - } - return answ; + // Inserisco famiglia hardware vuota + SashArea.SetSelFamilyHardware(""); + // Inserisco hardware di default + SashArea.SetSelHardwareFromId("000000"); + // Salvo gli oggetti già presenti e li cancello da AreaList + List ContentArea = new List(); + ContentArea.Add(AreaList[0]); + AreaList.Remove(AreaList[0]); + // Aggiungo area + AreaList.Add(SashArea); + // Inserisco il riempimento precedente + AreaList[0].AreaList.Add(ContentArea[0]); + AreaList[0].AreaList[0].SetParentArea(AreaList[0]); + ParentWindow.OnUpdatePreview(ParentWindow.sSerialized()); } + // public void AddFirstSash() + // { + // // Salvo il parent + // Area ParentArea = AreaList[0].ParentArea; + // // Creo area sash di default + // Sash SashArea = Sash.CreateSash(ParentArea); + // // ricerco tra tutti gli hw disponibili... + // string sShape = FindSashShape(); + // var listHwValid = Sash + // .m_HardwareCompleteList + // .Where(x => x.Shape == sShape && x.SashQty == 1) + // .FirstOrDefault(); + // if (listHwValid != null) + // { + // // seleziono la famiglia del primo hw trovato... + // SashArea.SetSelFamilyHardware(listHwValid.FamilyName); + //#if false + // SashArea.ReqRefreshShape(); + //#endif + // SashArea.RefreshHardwareList(); + // if (SashArea.HardwareList.Count == 0) + // { + // //answ = true; + // SashArea.SetSelHardwareFromId("000000"); + // } + // else + // { + // SashArea.SetSelHardwareFromId(SashArea.HardwareList.First().Id); + // } + // // Salvo gli oggetti già presenti e li cancello da AreaList + // List ContentArea = new List(); + // ContentArea.Add(AreaList[0]); + // AreaList.Remove(AreaList[0]); + // // Aggiungo area + // AreaList.Add(SashArea); + // if (SashArea.nSashQty == 1) + // { + // // Inserisco il riempimento precedente + // AreaList[0].AreaList.Add(ContentArea[0]); + // AreaList[0].AreaList[0].SetParentArea(AreaList[0]); + // } + // else + // { + // // All'area Sash aggiunto uno Splitted per ogni anta + // for (int i = 1; i < SashArea.nSashQty; i++) + // { + // AreaList[0].AreaList.Add(Splitted.CreateSplitted(SashArea)); + // } + // Fill fill2 = (Fill)ContentArea[0]; + // for (int i = 1; i < SashArea.nSashQty; i++) + // { + // AreaList[0].AreaList[1].AreaList.Add(Fill.CreateFill(AreaList[0].AreaList[1], fill2.FillType)); + // } + // } + // ParentWindow.OnUpdatePreview(ParentWindow.sSerialized()); + // } + // } + public void AddSplit() { // Salvo il parent @@ -254,17 +273,6 @@ namespace WebWindowComplex.Models #endregion Private Fields - #region Private Methods - /// - /// MockUp chiamata a c++ x scelta forma sash per Hw - /// - /// - private string FindSashShape() - { - return "Rectangle"; - } - - #endregion Private Methods } } \ No newline at end of file diff --git a/WebWindowComplex/Models/OnReqHwOptEventArgs.cs b/WebWindowComplex/Models/OnReqHwOptEventArgs.cs new file mode 100644 index 0000000..9e58da1 --- /dev/null +++ b/WebWindowComplex/Models/OnReqHwOptEventArgs.cs @@ -0,0 +1,28 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace WebWindowComplex.Models +{ + public class OnReqHwOptEventArgs : EventArgs + { + #region Public Fields + + public string sJwd; + public string sCodHw; + + #endregion Public Fields + + #region Public Constructors + + public OnReqHwOptEventArgs(string sJwd, string sCodHw) + { + this.sJwd = sJwd; + this.sCodHw = sCodHw; + } + + #endregion Public Constructors + } +} \ No newline at end of file diff --git a/WebWindowComplex/Models/Sash.cs b/WebWindowComplex/Models/Sash.cs index 767a381..2c5dd6e 100644 --- a/WebWindowComplex/Models/Sash.cs +++ b/WebWindowComplex/Models/Sash.cs @@ -1,9 +1,11 @@ using Egw.Window.Data; using System; using System.Collections.Generic; +using System.Data.SqlTypes; using System.Linq; using System.Text; using System.Threading.Tasks; +using System.Xml.Serialization; using WebWindowComplex.Json; using static WebWindowComplex.Json.WindowConst; @@ -32,6 +34,7 @@ namespace WebWindowComplex.Models #region Public Events public event EventHandler OnReqShape = delegate { }; + public event EventHandler OnReqHwOption = delegate { }; #endregion Public Events @@ -77,7 +80,7 @@ namespace WebWindowComplex.Models } } - public List HwdOptionList + public List HwdOptionList { get { @@ -323,75 +326,7 @@ namespace WebWindowComplex.Models set { m_SelHardware = value; - // if (m_SelHardware != null && m_SelHardware.sId != "000000") - // { - // string sHwdOptPath = ""; - // var gf = EgtLuaCreateGlobTable("WDG"); - // var tft = EgtLuaSetGlobIntVar("WDG.AREAID", m_nAreaId); - // var tfy = EgtLuaSetGlobStringVar("WDG.HDWFAVOURITE", value.sId); - // SashDimension HandleSash = m_SashList.FirstOrDefault(x => x.bHasHandle); - // string sHandle = "Dx"; - // switch (GetOpeningSide(HandleSash.OpeningType)) - // { - // case object _ when OpeningSides.LEFT: - // { - // sHandle = "Sx"; - // break; - // } - - // case object _ when OpeningSides.RIGHT: - // { - // sHandle = "Dx"; - // break; - // } - // } - // var tfd = EgtLuaSetGlobStringVar("WDG.HDWHANDLE", sHandle); - // var tlt = EgtLuaCallFunction("WinCreate_GetHardwareOptionPath"); - // var tltf = EgtLuaGetGlobStringVar("WDG.HWDOPTPATH", sHwdOptPath); - // if (!string.IsNullOrWhiteSpace(sHwdOptPath)) - // { - // XmlSerializer serializer = new XmlSerializer(typeof(ParametriOpzioni)); - // ParametriOpzioni HwdOptions = null/* TODO Change to default(_) if this is not a reference type */; - // string sHdwOptPath = Path.ChangeExtension(sHwdOptPath, ".opt"); - // bool bHdwOptFound = false; - // for (var WaitIndex = 0; WaitIndex <= 100; WaitIndex++) - // { - // if (File.Exists(sHdwOptPath)) - // { - // bHdwOptFound = true; - // break; - // } - // System.Threading.Thread.Sleep(100); - // } - // if (bHdwOptFound) - // { - // string sHwdOptText = ""; - // try - // { - // sHwdOptText = File.ReadAllText(sHdwOptPath); - // } - // catch (Exception ex) - // { - // EgtOutLog("Hardware file opt not found or read!"); - // } - // if (!string.IsNullOrWhiteSpace(sHwdOptText)) - // { - // using (TextReader reader = new StringReader(sHwdOptText)) - // { - // HwdOptions = serializer.Deserialize(reader); - // } - // if (!IsNothing(HwdOptions)) - // { - // m_HwdOptionList.Clear(); - // foreach (var HdwOption in HwdOptions.Items) - // m_HwdOptionList.Add(new AGBOption(HdwOption)); - // NotifyPropertyChanged(nameof(HwdOptionList)); - // } - // } - // } - // var ud = EgtLuaResetGlobVar("WDG"); - // } - // } + ReqRefreshHwOption(); } } @@ -404,6 +339,7 @@ namespace WebWindowComplex.Models set { m_SelHardware = m_HardwareList.FirstOrDefault(x => !string.IsNullOrEmpty(value) && x.Id.Equals(value)) ?? new Hardware("", "", "", Enums.OpeningTypes.Null, "", 0, 0); + ReqRefreshHwOption(); ParentWindow.OnUpdatePreview(ParentWindow.sSerialized()); } } @@ -537,6 +473,16 @@ namespace WebWindowComplex.Models } } + /// + /// Richiesta calcolo hardware option list + /// + public void ReqRefreshHwOption() + { + HwdOptionList.Clear(); + // chiamata evento calcolo opzioni hardware + OnReqHwOptionPreview(m_ParentWindow.sSerialized(), SelHardware.Id); + } + public void SetSelFamilyHardware(string sFamilyHw) { m_SelFamilyHardware = sFamilyHw; @@ -556,7 +502,19 @@ namespace WebWindowComplex.Models public void UpdateShape(string newShape) { m_CurrShape = newShape; + // la famiglia hw è vuota seleziono il primo hardware valido e utilizzo la sua famiglia + if(string.IsNullOrEmpty(m_SelFamilyHardware) || m_SelFamilyHardware == "") + { + var listHwValid = Sash + .m_HardwareCompleteList + .Where(x => x.Shape == m_CurrShape && x.SashQty == nSashQty && x.OpeningType == ConvertOpeningType()) + .FirstOrDefault(); + SetSelFamilyHardware(listHwValid.FamilyName); + } RefreshHardwareList(); + // se il vecchio hw selezionato non va più bene viene selezionato il primo della lista + if(!HardwareList.Contains(m_SelHardware) && m_SelHardware.Shape != m_CurrShape) + SetFirstHardware(); } #endregion Public Methods @@ -673,6 +631,16 @@ namespace WebWindowComplex.Models } } + internal void OnReqHwOptionPreview(string sJwd, string codHw) + { + OnReqHwOptEventArgs e = new OnReqHwOptEventArgs(sJwd, codHw); + EventHandler handler = OnReqHwOption; + if (handler != null) + { + handler(this, e); + } + } + internal void RefreshHardwareOptionList() { m_HwdOptionList.Clear(); @@ -697,6 +665,7 @@ namespace WebWindowComplex.Models if (m_HardwareList.Count > 0) { m_SelHardware = m_HardwareList.First(); + ReqRefreshHwOption(); } } @@ -718,6 +687,37 @@ namespace WebWindowComplex.Models } } + internal void SetHardwareOption(string OptionXml) + { + if (!string.IsNullOrEmpty(OptionXml)) + { + ParametriOpzioni HwdOptions = null; + XmlSerializer serializer = new XmlSerializer(typeof(ParametriOpzioni)); + StringReader reader = new StringReader(OptionXml); + HwdOptions = (ParametriOpzioni)serializer.Deserialize(reader); + if (HwdOptions.Items != null) + { + m_HwdOptionList.Clear(); + foreach (var HdwOption in HwdOptions.Items) + { + switch (HdwOption.Tipo) + { + case "Text": + { + m_HwdOptionList.Add(new AGBOptionText(HdwOption)); + break; + } + case "List": + { + m_HwdOptionList.Add(new AGBOptionCombo(HdwOption)); + break; + } + } + } + } + } + } + internal void SetOrientationSashType(OrientationSash value) { m_SelOrientationSashType = value; @@ -794,6 +794,7 @@ namespace WebWindowComplex.Models SelHardware = m_HardwareList.FirstOrDefault(x => x.Id.Equals(sId)) ?? new Hardware(CustomHwId, "", "", Enums.OpeningTypes.Null, "", 0, 0); if (SelHardware.Id == "") SelHardware = m_HardwareList.First(); + ReqRefreshHwOption(); } #endregion Internal Methods @@ -816,7 +817,7 @@ namespace WebWindowComplex.Models private string m_CurrShape = ""; private List m_HardwareList = new List(); - private List m_HwdOptionList = new List(); + private List m_HwdOptionList = new List(); private List m_JointList = new List(); @@ -858,11 +859,6 @@ namespace WebWindowComplex.Models return answ; } - private string FindSashShape() - { - return "Rectangle"; - } - #endregion Private Methods } } \ No newline at end of file diff --git a/WebWindowComplex/ParametriOpzioni.cs b/WebWindowComplex/ParametriOpzioni.cs index b055d1e..90c5c39 100644 --- a/WebWindowComplex/ParametriOpzioni.cs +++ b/WebWindowComplex/ParametriOpzioni.cs @@ -11,7 +11,7 @@ namespace WebWindowComplex private ParametriOpzioniParametri[] itemsField; /// - //[System.Xml.Serialization.XmlElementAttribute("Parametri", Form = System.Xml.Schema.XmlSchemaForm.Unqualified)] + [System.Xml.Serialization.XmlElementAttribute("Parametri", Form = System.Xml.Schema.XmlSchemaForm.Unqualified)] public ParametriOpzioniParametri[] Items { get @@ -42,7 +42,7 @@ namespace WebWindowComplex private ParametriOpzioniParametriOpzioni[] opzioniField; /// - //[System.Xml.Serialization.XmlElementAttribute(Form = System.Xml.Schema.XmlSchemaForm.Unqualified)] + [System.Xml.Serialization.XmlElementAttribute(Form = System.Xml.Schema.XmlSchemaForm.Unqualified)] public string NomeParametro { get @@ -56,7 +56,7 @@ namespace WebWindowComplex } /// - //[System.Xml.Serialization.XmlElementAttribute(Form = System.Xml.Schema.XmlSchemaForm.Unqualified)] + [System.Xml.Serialization.XmlElementAttribute(Form = System.Xml.Schema.XmlSchemaForm.Unqualified)] public string DescrizioneParametro { get @@ -70,7 +70,7 @@ namespace WebWindowComplex } /// - //[System.Xml.Serialization.XmlElementAttribute(Form = System.Xml.Schema.XmlSchemaForm.Unqualified)] + [System.Xml.Serialization.XmlElementAttribute(Form = System.Xml.Schema.XmlSchemaForm.Unqualified)] public string ValoreCorrente { get @@ -84,7 +84,7 @@ namespace WebWindowComplex } /// - //[System.Xml.Serialization.XmlElementAttribute(Form = System.Xml.Schema.XmlSchemaForm.Unqualified)] + [System.Xml.Serialization.XmlElementAttribute(Form = System.Xml.Schema.XmlSchemaForm.Unqualified)] public string Tipo { get @@ -98,7 +98,7 @@ namespace WebWindowComplex } /// - //[System.Xml.Serialization.XmlElementAttribute(Form = System.Xml.Schema.XmlSchemaForm.Unqualified)] + [System.Xml.Serialization.XmlElementAttribute(Form = System.Xml.Schema.XmlSchemaForm.Unqualified)] public string Visible { get @@ -112,7 +112,7 @@ namespace WebWindowComplex } /// - //[System.Xml.Serialization.XmlElementAttribute(Form = System.Xml.Schema.XmlSchemaForm.Unqualified)] + [System.Xml.Serialization.XmlElementAttribute(Form = System.Xml.Schema.XmlSchemaForm.Unqualified)] public string RicalcolaSeModificato { get @@ -126,7 +126,7 @@ namespace WebWindowComplex } /// - //[System.Xml.Serialization.XmlElementAttribute("Opzioni", Form = System.Xml.Schema.XmlSchemaForm.Unqualified)] + [System.Xml.Serialization.XmlElementAttribute("Opzioni", Form = System.Xml.Schema.XmlSchemaForm.Unqualified)] public ParametriOpzioniParametriOpzioni[] Opzioni { get @@ -149,7 +149,7 @@ namespace WebWindowComplex private string valoreField; /// - //[System.Xml.Serialization.XmlElementAttribute(Form = System.Xml.Schema.XmlSchemaForm.Unqualified)] + [System.Xml.Serialization.XmlElementAttribute(Form = System.Xml.Schema.XmlSchemaForm.Unqualified)] public string NomeParametro { get @@ -163,7 +163,7 @@ namespace WebWindowComplex } /// - //[System.Xml.Serialization.XmlElementAttribute(Form = System.Xml.Schema.XmlSchemaForm.Unqualified)] + [System.Xml.Serialization.XmlElementAttribute(Form = System.Xml.Schema.XmlSchemaForm.Unqualified)] public string DescrizioneOpzione { get @@ -177,7 +177,7 @@ namespace WebWindowComplex } /// - //[System.Xml.Serialization.XmlElementAttribute(Form = System.Xml.Schema.XmlSchemaForm.Unqualified)] + [System.Xml.Serialization.XmlElementAttribute(Form = System.Xml.Schema.XmlSchemaForm.Unqualified)] public string Valore { get diff --git a/WebWindowComplex/TableComp.razor.cs b/WebWindowComplex/TableComp.razor.cs index 227d29a..4f7ebb2 100644 --- a/WebWindowComplex/TableComp.razor.cs +++ b/WebWindowComplex/TableComp.razor.cs @@ -696,6 +696,18 @@ namespace WebWindowComplex } if (updRequested) { + // se mancasse xml opzioni hardware lo chiedo + if (string.IsNullOrEmpty(LiveData.OptionsXml)) + { + foreach(var item in SashList) + { + string req = item.SelHardware.Id; + if (string.IsNullOrEmpty(req)) + { + await DoReqOptHardware(); + } + } + } // se mancasse dizionario forme chiamo quello if (LiveData.DictShape.Count == 0) { @@ -750,11 +762,16 @@ namespace WebWindowComplex // Inserisco le forme ricevuto nei sash group foreach (var item in LiveData.DictShape) { - Sash sashNewShape = SashList.Where(x => x.GroupId == item.Key).ToList().First(); - sashNewShape.SashShape = item.Value; - sashNewShape.UpdateShape(item.Value); + Sash sashFromGroupId = SashList.Where(x => x.GroupId == item.Key).ToList().First(); + sashFromGroupId.SashShape = item.Value; + sashFromGroupId.UpdateShape(item.Value); } - // aggiorno SVG + } + // se ho le opzioni hw le aggiungo + if (!string.IsNullOrEmpty(LiveData.OptionsXml)) + { + foreach (var item in SashList) + item.SetHardwareOption(LiveData.OptionsXml); } } @@ -871,16 +888,21 @@ namespace WebWindowComplex ///
/// /// - private async Task AddSashIntoSplit(DataAreaSplitted Args) + private void AddSashIntoSplit(DataAreaSplitted Args) { Splitted currSplitted = Args.splitted; - bError = currSplitted.AddFirstSash(); - await DoPreviewSvg(); + currSplitted.AddFirstSash(); + // ricalcolo liste + UpdateLists(); + // richiedo update shape + List reqList = SashList.Select(x => x.GroupId).ToList(); + _ = DoReqShape(reqList); + //await DoPreviewSvg(); } private void AddSashToFrame(Frame f) { - bError = f.AddFirstSash(); + f.AddFirstSash(); // ricalcolo liste UpdateLists(); // richiedo update shape @@ -1288,7 +1310,9 @@ namespace WebWindowComplex /// nuova sash /// private async Task UpdateHwOptions(Sash newSash) - { + { + // richiesta calcolo opzioni hardware per la singola sash group + string req = newSash.SelHardware.Id; await DoReqOptHardware(); } diff --git a/WebWindowComplex/WebWindowComplex.csproj b/WebWindowComplex/WebWindowComplex.csproj index 63f768a..268a014 100644 --- a/WebWindowComplex/WebWindowComplex.csproj +++ b/WebWindowComplex/WebWindowComplex.csproj @@ -6,7 +6,7 @@ net8.0 enable enable - 2.7.10.2317 + 2.7.10.2713 Annamaria Sassi Egalware Componente gestione Configurazioni avanzate Window per LUX @@ -123,6 +123,20 @@ + + + + + + + + + + + + + + diff --git a/WebWindowConfigurator/WebWindowConfigurator.csproj b/WebWindowConfigurator/WebWindowConfigurator.csproj index 7e103b8..40ee117 100644 --- a/WebWindowConfigurator/WebWindowConfigurator.csproj +++ b/WebWindowConfigurator/WebWindowConfigurator.csproj @@ -6,7 +6,7 @@ net8.0 enable enable - 2.7.10.2317 + 2.7.10.2713 Annamaria Sassi Egalware Componente gestione JWD per LUX @@ -210,6 +210,8 @@ + +