From d63ec149b02757f51b4521e9ca0993b95a37437c Mon Sep 17 00:00:00 2001 From: Annamaria Sassi Date: Thu, 13 Nov 2025 19:05:36 +0100 Subject: [PATCH 01/18] Gestiti i diversi tipi di dimensioni per sash --- Test.UI/Data/AntaDoppia.jwd | 2 + Test.UI/Data/FinestraSplitVert.jwd | 2 + WebWindowComplex/Compo/CardSplit.razor | 44 +- WebWindowComplex/Json/JsonUtility.cs | 32 +- WebWindowComplex/Models/Sash.cs | 29 +- WebWindowComplex/Models/SashDimension.cs | 389 +++++++++++++----- WebWindowComplex/Models/Split.cs | 17 + WebWindowComplex/Models/SplitDimension.cs | 65 ++- WebWindowComplex/TableComp.razor.cs | 88 ++++ WebWindowComplex/WebWindowComplex.csproj | 82 +++- .../WebWindowConfigurator.csproj | 88 +++- 11 files changed, 730 insertions(+), 108 deletions(-) diff --git a/Test.UI/Data/AntaDoppia.jwd b/Test.UI/Data/AntaDoppia.jwd index eeb3733..486ff5f 100644 --- a/Test.UI/Data/AntaDoppia.jwd +++ b/Test.UI/Data/AntaDoppia.jwd @@ -47,12 +47,14 @@ "SashId": 1, "OpeningType": "TILTTURN_LEFT", "HasHandle": true, + "MeasureType": "PERCENTAGE", "Dimension": 50.0 }, { "SashId": 2, "OpeningType": "TURNONLY_RIGHT", "HasHandle": false, + "MeasureType": "PERCENTAGE", "Dimension": 50.0 } ], diff --git a/Test.UI/Data/FinestraSplitVert.jwd b/Test.UI/Data/FinestraSplitVert.jwd index d3feecc..8078d3c 100644 --- a/Test.UI/Data/FinestraSplitVert.jwd +++ b/Test.UI/Data/FinestraSplitVert.jwd @@ -46,10 +46,12 @@ "SplitVertList": [ { "IsRelative": true, + "MeasureType": "PERCENTAGE", "Dimension": 50.0 }, { "IsRelative": true, + "MeasureType": "PERCENTAGE", "Dimension": 50.0 } ], diff --git a/WebWindowComplex/Compo/CardSplit.razor b/WebWindowComplex/Compo/CardSplit.razor index 81551b6..568ba2f 100644 --- a/WebWindowComplex/Compo/CardSplit.razor +++ b/WebWindowComplex/Compo/CardSplit.razor @@ -69,9 +69,18 @@
@if (CurrItem.SplitVertList.Count > 0 && CurrItem.SplitHorizList.Count > 0) { -
+
@foreach (var dim in CurrItem.SplitVertList) { +
+ + +
Width @@ -79,9 +88,18 @@
}
-
+
@foreach (var dim in CurrItem.SplitHorizList) { +
+ + +
Height @@ -94,7 +112,16 @@ { @foreach (var dim in CurrItem.SplitHorizList) { -
+
+
+ + +
Height @@ -107,7 +134,16 @@ { @foreach (var dim in CurrItem.SplitVertList) { -
+
+
+ + +
Width diff --git a/WebWindowComplex/Json/JsonUtility.cs b/WebWindowComplex/Json/JsonUtility.cs index d9310dc..fef03b9 100644 --- a/WebWindowComplex/Json/JsonUtility.cs +++ b/WebWindowComplex/Json/JsonUtility.cs @@ -409,6 +409,7 @@ namespace WebWindowComplex.Json newSash.SashList[SashIndex].SetOpeningType(m_SashList[SashIndex].OpeningType); newSash.SashList[SashIndex].SetHasHandle(m_SashList[SashIndex].HasHandle); newSash.SashList[SashIndex].SetDimension(m_SashList[SashIndex].Dimension); + newSash.SashList[SashIndex].SetMeasureType(m_SashList[SashIndex].MeasureType); } foreach (var Joint in m_JointList) newSash.JointList.Add(Joint.Deserialize((Area)ParentArea)); @@ -511,19 +512,18 @@ namespace WebWindowComplex.Json Split.SetSplitQtyVert(0); else { - //Split.SplitVertList.Clear(); Split.SetSplitQtyVert(m_SplitVertList.Count - 1); for (var SplitIndex = 0; SplitIndex <= m_SplitVertList.Count - 1; SplitIndex++) { Split.SplitVertList[SplitIndex].SetIsRelative(m_SplitVertList[SplitIndex].IsRelative); Split.SplitVertList[SplitIndex].SetDimension(m_SplitVertList[SplitIndex].Dimension); + Split.SplitVertList[SplitIndex].SetMeasureType(m_SplitVertList[SplitIndex].MeasureType); } } if (m_SplitHorizList.Count == 0) Split.SetSplitQtyHoriz(0); else { - //Split.SplitHorizList.Clear(); Split.SetSplitQtyHoriz(m_SplitHorizList.Count - 1); for (var SplitIndex = 0; SplitIndex <= m_SplitHorizList.Count - 1; SplitIndex++) { @@ -769,6 +769,17 @@ namespace WebWindowComplex.Json } } + private MeasureTypes m_MeasureType; + [JsonProperty] + [JsonConverter(typeof(StringEnumConverter))] + public MeasureTypes MeasureType + { + get + { + return m_MeasureType; + } + } + private bool m_bHasHandle; [JsonProperty] public bool HasHandle @@ -797,9 +808,10 @@ namespace WebWindowComplex.Json } } - public JsonSashDimension(Openings OpeningType, bool HasHandle, double Dimension, int SashId) + public JsonSashDimension(Openings OpeningType, MeasureTypes MeasureType, bool HasHandle, double Dimension, int SashId) { m_OpeningType = OpeningType; + m_MeasureType = MeasureType; m_bHasHandle = HasHandle; m_dDimension = Dimension; m_nSashId = SashId; @@ -832,10 +844,22 @@ namespace WebWindowComplex.Json } } - public JsonSplitDimension(bool IsRelative, double Dimension) + private MeasureTypes m_MeasureType; + [JsonProperty] + [JsonConverter(typeof(StringEnumConverter))] + public MeasureTypes MeasureType + { + get + { + return m_MeasureType; + } + } + + public JsonSplitDimension(bool IsRelative, double Dimension, MeasureTypes MeasureType) { m_bIsRelative = IsRelative; m_dDimension = Dimension; + m_MeasureType = MeasureType; } } diff --git a/WebWindowComplex/Models/Sash.cs b/WebWindowComplex/Models/Sash.cs index 1ba799b..c7f82af 100644 --- a/WebWindowComplex/Models/Sash.cs +++ b/WebWindowComplex/Models/Sash.cs @@ -34,6 +34,21 @@ namespace WebWindowComplex.Models #region Public Properties + /// + /// Larghezza gruppo ante + /// + public double Width + { + get + { + return m_Width; + } + set + { + m_Width = value; + } + } + public bool bIsMeasureGlass { get @@ -128,7 +143,7 @@ namespace WebWindowComplex.Models // aggiungo area Sash di default for (var SplitIndex = m_SashList.Count; SplitIndex <= value - 1; SplitIndex++) { - SashList.Add(new SashDimension(dNewDimension, MeasureTypes.PERCENTAGE, this, SplitIndex + 1)); + SashList.Add(new SashDimension(dNewDimension, m_SashList[m_SashList.Count - 1].MeasureType, this, SplitIndex + 1)); } } else if (value < m_SashList.Count) @@ -136,12 +151,16 @@ namespace WebWindowComplex.Models if (value > 0) { double dLastDimension = 0; + SashDimension itemDelete = null; for (var SplitIndex = m_SashList.Count - 1; SplitIndex >= value; SplitIndex += -1) { - dLastDimension += m_SashList[SplitIndex].dDimension; + //dLastDimension += m_SashList[SplitIndex].dDimension; + itemDelete = m_SashList[SplitIndex]; SashList.RemoveAt(SplitIndex); } - dLastDimension += m_SashList[SashList.Count - 1].dDimension; + double deleteDim = itemDelete.ConvertDimension(itemDelete.SelMeasureType, m_SashList[SashList.Count - 1].SelMeasureType); + //dLastDimension += m_SashList[SashList.Count - 1].dDimension; + dLastDimension = deleteDim + m_SashList[SashList.Count - 1].dDimension; SashList[SashList.Count - 1].SetDimension(dLastDimension); if (value == 1) SashList.First().SetHasHandle(true); @@ -886,10 +905,12 @@ namespace WebWindowComplex.Models private List m_SashList = new List(); private SashTypes m_SashType; - private string m_SelFamilyHardware; + private string m_SelFamilyHardware = ""; private Hardware m_SelHardware; private OrientationSash m_SelOrientationSashType; + private double m_Width = 0; + #endregion Private Fields #region Private Methods diff --git a/WebWindowComplex/Models/SashDimension.cs b/WebWindowComplex/Models/SashDimension.cs index 1f3350b..bf27283 100644 --- a/WebWindowComplex/Models/SashDimension.cs +++ b/WebWindowComplex/Models/SashDimension.cs @@ -104,7 +104,7 @@ namespace WebWindowComplex.Models //m_Parent.ParentWindow.OnUpdatePreview(m_Parent.ParentWindow.sSerialized()); } } - + public double dDimension { get @@ -119,13 +119,14 @@ namespace WebWindowComplex.Models { case MeasureTypes.ABSOLUT: { - valMax = m_Parent.SashList.Sum(x => x.dDimension); - valueAccept = (value < valMax && value > 0) ? true: false; + valMax = m_Parent.Width; + valueAccept = (value < valMax && value > 0) ? true : false; break; } case MeasureTypes.PROPORTIONAL: { - valMax = m_Parent.SashList.Sum(x => x.dDimension); + valMax = 20; + valueAccept = true ; break; } case MeasureTypes.PERCENTAGE: @@ -135,69 +136,87 @@ namespace WebWindowComplex.Models break; } } - if (!MeasureType.Equals(MeasureTypes.PROPORTIONAL)) + if (valueAccept) { - if (valueAccept) + double widthTot = m_Parent.Width; + List dimensions = m_Parent.SashList; + List absolutValList = new List(); + foreach(var item in m_Parent.SashList) { - - // verifico se ci sono altri in percentuale - List DimList = m_Parent.SashList.Where(x => x.MeasureType.Equals(MeasureType)).ToList(); - if (DimList.Count > 0) + absolutValList.Add(item.CalculateAbsolutValue(widthTot)); + } + int nIndex = dimensions.IndexOf(this); + int proportionalCount = dimensions.Where(x => x.MeasureType.Equals(MeasureTypes.PROPORTIONAL)).ToList().Count; + // Le altre dimensioni non sono solo in proporzionale + if ( proportionalCount == 0 || proportionalCount < absolutValList.Count - 1) + { + double valueInAbsolute = 0; + switch (MeasureType) { - int nIndex = DimList.IndexOf(this); - // se diminuisce dimensione - if (value < m_dDimension) - { - if (nIndex < DimList.Count - 1) - DimList[nIndex + 1].SetDimension(DimList[nIndex + 1].dDimension + (m_dDimension - value)); - else if (DimList.Count > 1) - DimList[nIndex - 1].SetDimension(DimList[nIndex - 1].dDimension + (m_dDimension - value)); - else + case MeasureTypes.ABSOLUT: { - m_dDimension = valMax; - return; + valueInAbsolute = value; + break; } + case MeasureTypes.PROPORTIONAL: + { + var pesi = value + dimensions + .Where(x => x.MeasureType.Equals(MeasureTypes.PROPORTIONAL) && !x.Equals(this)) + .Sum(x => x.m_dDimension); + valueInAbsolute = widthTot / pesi * value; + break; + } + case MeasureTypes.PERCENTAGE: + { + valueInAbsolute = (value / 100) * widthTot; + break; + } + } + if (value < dDimension) + { + // L'anta modificata non è l'ultima + if (nIndex < absolutValList.Count - 1) + { + absolutValList[nIndex + 1] = absolutValList[nIndex + 1] + (absolutValList[nIndex] - valueInAbsolute); + absolutValList[nIndex] = valueInAbsolute; } - // se aumenta dimensione - else + // L'anta modificata è l'ultima + else if (dimensions.Count > 1) { - double dRes = value; - // se non ultima anta - if (nIndex < DimList.Count - 1) - { - for (var nInd = 0; nInd <= nIndex - 1; nInd++) - dRes += DimList[nInd].dDimension; - dRes = (100 - dRes) / (DimList.Count - nIndex - 1); - for (var Ind = nIndex + 1; Ind <= DimList.Count - 1; Ind++) - DimList[Ind].SetDimension(dRes); - } - // se ultima anta - else if (DimList.Count > 1) - { - if (DimList.Count > 2) - { - for (var Ind = 0; Ind <= nIndex - 2; Ind++) - dRes += DimList[Ind].dDimension; - } - dRes = (valMax - dRes); - DimList[nIndex - 1].SetDimension(dRes); - } - else - { - m_dDimension = valMax; - return; - } + absolutValList[nIndex - 1] = absolutValList[nIndex - 1] + (absolutValList[nIndex] - valueInAbsolute); + absolutValList[nIndex] = valueInAbsolute; } } - m_dDimension = value; - m_Parent.ParentWindow.OnUpdatePreview(m_Parent.ParentWindow.sSerialized()); + else + { + // L'anta modificata non è l'ultima + if (nIndex < absolutValList.Count - 1) + { + absolutValList[nIndex + 1] = absolutValList[nIndex + 1] - (valueInAbsolute - absolutValList[nIndex]); + absolutValList[nIndex] = valueInAbsolute; + } + // L'anta modificata è l'ultima + else if (dimensions.Count > 1) + { + absolutValList[nIndex - 1] = absolutValList[nIndex - 1] - (valueInAbsolute - absolutValList[nIndex]); + absolutValList[nIndex] = valueInAbsolute; + } + } + if (MeasureType.Equals(MeasureTypes.PROPORTIONAL)) + m_dDimension = value; + for(int i = 0; i < absolutValList.Count; i++) + { + var item = m_Parent.SashList.ElementAt(i); + item.SetDimension(ConvertIn(absolutValList[i], (MeasureTypes)item.SelMeasureTypeIndex, widthTot)); + } + } + else + { + m_dDimension = value; } - } - else - { - m_dDimension = value; m_Parent.ParentWindow.OnUpdatePreview(m_Parent.ParentWindow.sSerialized()); } + //// se sono in percentuale //if (m_MeasureType.Equals(MeasureTypes.PERCENTAGE)) //{ @@ -359,7 +378,13 @@ namespace WebWindowComplex.Models } set { - m_SelMeasureType = (MeasureTypes)value; + if(m_SelMeasureType != (MeasureTypes)value) + { + MeasureTypes newType = (MeasureTypes)value; + m_dDimension = ConvertDimension(m_SelMeasureType, newType); + m_SelMeasureType = (MeasureTypes)value; + m_Parent.ParentWindow.OnUpdatePreview(m_Parent.ParentWindow.sSerialized()); + } } } @@ -367,6 +392,57 @@ namespace WebWindowComplex.Models #region Public Methods + /// + /// Metodo per convertire la dimensione dal vecchio tipo al nuovo tipo + /// + /// Vecchio tipo + /// Nuovo tipo + /// + public double ConvertDimension(MeasureTypes oldType, MeasureTypes newType) + { + switch (oldType) + { + case MeasureTypes.ABSOLUT: + { + if (newType.Equals(MeasureTypes.PERCENTAGE)) + { + return Double.Round((m_dDimension / m_Parent.Width) * 100, 0); + } + else + { + return ricalculatePropVal(); + } + } + case MeasureTypes.PROPORTIONAL: + { + if (newType.Equals(MeasureTypes.ABSOLUT)) + { + return Double.Round(convertFromPropVal(newType), 2); + } + else + { + return Double.Round(convertFromPropVal(newType)); + } + } + case MeasureTypes.PERCENTAGE: + { + if (newType.Equals(MeasureTypes.ABSOLUT)) + { + return Double.Round((m_dDimension * m_Parent.Width) / 100); + } + else + { + return Double.Round(ricalculatePropVal()); + } + } + } + return -1; + } + + /// + /// Metodo per copiare l'intero oggetto + /// + /// public SashDimension Copy() { SashDimension newSashDim = new SashDimension(dDimension, MeasureType, m_Parent, m_nSashId); @@ -382,7 +458,7 @@ namespace WebWindowComplex.Models internal JsonSashDimension Serialize() { - JsonSashDimension JsonSashDimension = new JsonSashDimension(OpeningType, m_bHasHandle, m_dDimension, m_nSashId); + JsonSashDimension JsonSashDimension = new JsonSashDimension(OpeningType, MeasureType, m_bHasHandle, m_dDimension, m_nSashId); return JsonSashDimension; } @@ -406,6 +482,169 @@ namespace WebWindowComplex.Models m_SelMeasureType = value; } + /// + /// Metodo per trasformare una dimensione in valore assoluto rispetto alla larghezza totale + /// + /// Larghezza totale + /// + internal double CalculateAbsolutValue(double widthTot) + { + switch (MeasureType) + { + case MeasureTypes.ABSOLUT: + { + return dDimension; + } + case MeasureTypes.PROPORTIONAL: + { + return calculatePropVal(); + } + case MeasureTypes.PERCENTAGE: + { + return (dDimension / 100) * widthTot; + } + } + return 0; + } + + /// + /// Metodo per convertire una dimensione da un valore assoluto al suo rispettivo tipo + /// + /// Valore assoluto + /// Tipo di misura della dimensione + /// Larghezza totale + /// + internal double ConvertIn(double absolutVal, MeasureTypes type, double widthTot) + { + switch (type) + { + case MeasureTypes.ABSOLUT: + { + return absolutVal; + } + case MeasureTypes.PROPORTIONAL: + { + return calculatePropVal(); + } + case MeasureTypes.PERCENTAGE: + { + return (absolutVal / widthTot) * 100; + } + } + return -1; + } + + /// + /// Metodo per convertire da misura proporzionale a misura assoluta o percentuale + /// + /// + /// + internal double convertFromPropVal(MeasureTypes newType) + { + double tot = m_Parent.Width; + //Somma misura non proporzionali + double sumNotProp = m_Parent.SashList + .Where(m => m.MeasureType != MeasureTypes.PROPORTIONAL && !m.Equals(this)) + .Sum(m => m.CalculateAbsolutValue(tot)); + //Calcolo residuo + double res = tot - sumNotProp; + if (res < 0) res = 0; + //Misure proporzionali + var proportionalList = m_Parent.SashList + .Where(m => m.SelMeasureType == MeasureTypes.PROPORTIONAL) + .ToList(); + + double sumPesi = proportionalList.Sum(p => p.dDimension); + if (sumPesi == 0) sumPesi = 1; + if (newType.Equals(MeasureTypes.ABSOLUT)) + { + return res / sumPesi * dDimension; + } + else + { + return (res / sumPesi * dDimension) / tot * 100; + } + } + + /// + /// Metodo per calcolare il valore proporzionale + /// + /// + internal double calculatePropVal() + { + double tot = m_Parent.Width; + //Somma misura non proporzionali + double sumNotProp = m_Parent.SashList + .Where(m => m.MeasureType != MeasureTypes.PROPORTIONAL) + .Sum(m => m.CalculateAbsolutValue(tot)); + //Calcolo residuo + double res = tot - sumNotProp; + if (res < 0) res = 0; + //Misure proporzionali + var proportionalList = m_Parent.SashList + .Where(m => m.SelMeasureType == MeasureTypes.PROPORTIONAL) + .ToList(); + double sumPesi = proportionalList.Sum(p => p.dDimension); + if (sumPesi == 0) sumPesi = 1; + return res / sumPesi*dDimension; + } + + /// + /// Calcolo MCD + /// + /// + /// + /// + public static double CalcolaMCD(double a, double b) + { + while (b != 0) + { + double temp = b; + b = a % b; + a = temp; + } + return a; + } + + /// + /// Metodo per ricalcolare i valori proporzionali a causa della modifica di uno + /// + /// + internal double ricalculatePropVal() + { + if(m_Parent.SashList.Where(m => m.MeasureType.Equals(MeasureTypes.PROPORTIONAL)).ToList().Count == 0) + { + return 1; + } + List absolutValue = new List(); + foreach (var item in m_Parent.SashList) + { + absolutValue.Add(item.CalculateAbsolutValue(m_Parent.Width)); + } + for(int i = 0; i < m_Parent.SashList.Count; i++) + { + if(!m_Parent.SashList.ElementAt(i).Equals(this) && + m_Parent.SashList.ElementAt(i).MeasureType.Equals(MeasureTypes.PROPORTIONAL)) + { + int nIndex = m_Parent.SashList.IndexOf(this); + if (absolutValue.ElementAt(nIndex) <= absolutValue.ElementAt(i)) + { + var mcd = CalcolaMCD(absolutValue.ElementAt(nIndex), absolutValue.ElementAt(i)); + m_Parent.SashList.ElementAt(i).m_dDimension = absolutValue.ElementAt(i) / mcd; + m_dDimension = absolutValue.ElementAt(nIndex) / mcd; + } + else + { + var mcd = CalcolaMCD(absolutValue.ElementAt(nIndex), absolutValue.ElementAt(i)); + m_Parent.SashList.ElementAt(i).m_dDimension = absolutValue.ElementAt(i) / mcd; + m_dDimension = absolutValue.ElementAt(nIndex) / mcd; + } + break; + } + } + return m_dDimension; + } + #endregion Internal Methods #region Private Fields @@ -461,41 +700,5 @@ namespace WebWindowComplex.Models #endregion Private Fields - #region Private Methods - - /// - /// Recupero della larghezza del frame - /// - /// - private double GetWidth() - { - double width = 0; - int indexSash = 0; - if (m_Parent.ParentArea != null && m_Parent.ParentArea.ParentArea != null && m_Parent.ParentArea.ParentArea is Split) - { - Split splitParent = (Split)m_Parent.ParentArea.ParentArea; - if(splitParent.SplitVertList.Count > 0) - { - for(int i = 0; i < splitParent.AreaList.Count; i++) - { - if (splitParent.AreaList[i].AreaList[0].Equals(this)) - { - indexSash = i; - } - - } - } - //int indexSash = splitParent.AreaList.Where(x => x.AreaList[0].Equals(this)); - } - else - { - Frame a = m_Parent.ParentWindow.AreaList[0]; - FrameDimension? fd = a.DimensionList.Where(x => x.sName == "Width").SingleOrDefault(); - width = fd.dValue; - } - return width; - } - - #endregion Private Methods } } \ No newline at end of file diff --git a/WebWindowComplex/Models/Split.cs b/WebWindowComplex/Models/Split.cs index 084f696..7f876c0 100644 --- a/WebWindowComplex/Models/Split.cs +++ b/WebWindowComplex/Models/Split.cs @@ -20,6 +20,21 @@ namespace WebWindowComplex.Models #region Public Properties + /// + /// Larghezza gruppo split + /// + public double Width + { + get + { + return m_Width; + } + set + { + m_Width = value; + } + } + public bool bIsPercentage { get @@ -472,6 +487,8 @@ namespace WebWindowComplex.Models private List m_SplitVertList = new List(); + private double m_Width = 0; + #endregion Private Fields } } \ No newline at end of file diff --git a/WebWindowComplex/Models/SplitDimension.cs b/WebWindowComplex/Models/SplitDimension.cs index 8849369..70b6dfe 100644 --- a/WebWindowComplex/Models/SplitDimension.cs +++ b/WebWindowComplex/Models/SplitDimension.cs @@ -4,6 +4,7 @@ using System.Linq; using System.Text; using System.Threading.Tasks; using WebWindowComplex.Json; +using static WebWindowComplex.Json.WindowConst; namespace WebWindowComplex.Models { @@ -136,6 +137,54 @@ namespace WebWindowComplex.Models } } + public MeasureTypes MeasureType + { + get + { + return m_SelMeasureType; + } + } + + public List MeasureTypeList + { + get + { + return m_MeasureTypeList; + } + } + + public MeasureTypes SelMeasureType + { + get + { + return m_SelMeasureType; + } + set + { + m_SelMeasureType = value; + } + } + + public int SelMeasureTypeIndex + { + get + { + return (int)m_SelMeasureType; + } + set + { + if (m_SelMeasureType != (MeasureTypes)value) + { + m_SelMeasureType = (MeasureTypes)value; + if (m_SelMeasureType.Equals(MeasureTypes.PROPORTIONAL)) + { + dDimension = 1; + } + m_Parent.ParentWindow.OnUpdatePreview(m_Parent.ParentWindow.sSerialized()); + } + } + } + #endregion Public Properties #region Public Methods @@ -152,7 +201,7 @@ namespace WebWindowComplex.Models internal JsonSplitDimension Serialize() { - JsonSplitDimension JsonSplitDimension = new JsonSplitDimension(m_bIsRelative, m_dDimension); + JsonSplitDimension JsonSplitDimension = new JsonSplitDimension(m_bIsRelative, m_dDimension, MeasureType); return JsonSplitDimension; } @@ -171,6 +220,11 @@ namespace WebWindowComplex.Models m_bIsVertListDim = value; } + internal void SetMeasureType(MeasureTypes value) + { + m_SelMeasureType = value; + } + #endregion Internal Methods #region Private Fields @@ -181,6 +235,15 @@ namespace WebWindowComplex.Models private double m_dDimension; + private List m_MeasureTypeList = new List + { + new IdNameStruct((int)MeasureTypes.ABSOLUT, "Absolut"), + new IdNameStruct((int)MeasureTypes.PROPORTIONAL, "Proportional"), + new IdNameStruct((int)MeasureTypes.PERCENTAGE, "Percentage"), + }; + + private MeasureTypes m_SelMeasureType; + // reference private Split m_Parent; diff --git a/WebWindowComplex/TableComp.razor.cs b/WebWindowComplex/TableComp.razor.cs index 0d1b445..551f02e 100644 --- a/WebWindowComplex/TableComp.razor.cs +++ b/WebWindowComplex/TableComp.razor.cs @@ -424,6 +424,7 @@ namespace WebWindowComplex case AreaTypes.SASH: { m_SashList.Add((Sash)node); + calculateWidth((Sash)node); break; } case AreaTypes.FILL: @@ -434,6 +435,7 @@ namespace WebWindowComplex case AreaTypes.SPLIT: { m_SplitList.Add((Split)node); + calculateWidth((Split)node); break; } case AreaTypes.SPLITTED: @@ -452,6 +454,92 @@ namespace WebWindowComplex } } + protected void calculateWidth(Area area) + { + if (area is Sash) + { + Sash sash = (Sash)area; + if (area.ParentArea is Frame) + { + Frame frame = (Frame)area.ParentArea; + sash.Width = (frame.DimensionList.Where(x => x.sName == "Width").FirstOrDefault())!.dValue; + } + else if (sash.ParentArea.ParentArea is Split) + { + Split split = (Split)sash.ParentArea.ParentArea; + if (split.SplitVertList.Count > 0) + { + int indexSplit = 0; + for(int i = 0; i < split.AreaList.Count; i++) + { + if (split.AreaList.ElementAt(i).AreaList.First().Equals(sash)) + indexSplit = i; + } + switch (split.SplitVertList.ElementAt(indexSplit).MeasureType) + { + case MeasureTypes.ABSOLUT: + { + sash.Width = split.SplitVertList.ElementAt(indexSplit).dDimension; + break; + } + case MeasureTypes.PROPORTIONAL: + { + /// TO DO!!!!! + break; + } + case MeasureTypes.PERCENTAGE: + { + sash.Width = split.SplitVertList.ElementAt(indexSplit).dDimension / 100 * split.Width; + break; + } + } + } + else + { + Frame frame = (Frame)sash.ParentWindow.AreaList[0]; + sash.Width = (frame.DimensionList.Where(x => x.sName == "Width").FirstOrDefault())!.dValue; + } + } + } + else if (area is Split) + { + Split split = (Split)area; + if (area.ParentArea is Frame) + { + Frame frame = (Frame)area.ParentArea; + split.Width = (frame.DimensionList.Where(x => x.sName == "Width").FirstOrDefault())!.dValue; + } + else if (split.ParentArea.ParentArea is Sash) + { + Sash sash = (Sash)split.ParentArea.ParentArea; + int indexSash = 0; + for (int i = 0; i < sash.AreaList.Count; i++) + { + if (sash.AreaList.ElementAt(i).AreaList.First().Equals(split)) + indexSash = i; + } + switch (sash.SashList.ElementAt(indexSash).MeasureType) + { + case MeasureTypes.ABSOLUT: + { + split.Width = sash.SashList.ElementAt(indexSash).dDimension; + break; + } + case MeasureTypes.PROPORTIONAL: + { + /// TO DO!!!!! + break; + } + case MeasureTypes.PERCENTAGE: + { + split.Width = sash.SashList.ElementAt(indexSash).dDimension / 100 * sash.Width; + break; + } + } + } + } + } + /// /// Calcola CSS warning /// diff --git a/WebWindowComplex/WebWindowComplex.csproj b/WebWindowComplex/WebWindowComplex.csproj index bf62610..ca61afe 100644 --- a/WebWindowComplex/WebWindowComplex.csproj +++ b/WebWindowComplex/WebWindowComplex.csproj @@ -6,7 +6,7 @@ net8.0 enable enable - 2.7.11.1109 + 2.7.11.1318 Annamaria Sassi Egalware Componente gestione Configurazioni avanzate Window per LUX @@ -49,6 +49,86 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/WebWindowConfigurator/WebWindowConfigurator.csproj b/WebWindowConfigurator/WebWindowConfigurator.csproj index 4240629..e554af6 100644 --- a/WebWindowConfigurator/WebWindowConfigurator.csproj +++ b/WebWindowConfigurator/WebWindowConfigurator.csproj @@ -6,7 +6,7 @@ net8.0 enable enable - 2.7.11.1109 + 2.7.11.1318 Annamaria Sassi Egalware Componente gestione JWD per LUX @@ -69,6 +69,92 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + From 3c0f8a27f510d6455727f1c8591c869ec03a1005 Mon Sep 17 00:00:00 2001 From: Annamaria Sassi Date: Fri, 14 Nov 2025 15:38:12 +0100 Subject: [PATCH 02/18] Aggiunto campo MeasureType in Split (non gestito) --- WebWindowComplex/Models/Split.cs | 8 ++++---- WebWindowComplex/Models/SplitDimension.cs | 5 +++-- 2 files changed, 7 insertions(+), 6 deletions(-) diff --git a/WebWindowComplex/Models/Split.cs b/WebWindowComplex/Models/Split.cs index 7f876c0..b07be20 100644 --- a/WebWindowComplex/Models/Split.cs +++ b/WebWindowComplex/Models/Split.cs @@ -96,7 +96,7 @@ namespace WebWindowComplex.Models dNewDimension = dLastDimension / (value + 1 - nSplitQtyHoriz); // aggiungo area Split di default for (var SplitIndex = m_SplitHorizList.Count; SplitIndex <= value; SplitIndex++) - m_SplitHorizList.Add(new SplitDimension(dNewDimension, true, this, false)); + m_SplitHorizList.Add(new SplitDimension(dNewDimension, MeasureTypes.PERCENTAGE, true, this, false)); } // Ricalcolo dimensioni rimuovendo split else @@ -182,7 +182,7 @@ namespace WebWindowComplex.Models dNewDimension = dLastDimension / (value + 1 - nSplitQtyVert); // aggiungo area Split di default for (var SplitIndex = m_SplitVertList.Count; SplitIndex <= value; SplitIndex++) - m_SplitVertList.Add(new SplitDimension(dNewDimension, true, this, true)); + m_SplitVertList.Add(new SplitDimension(dNewDimension, MeasureTypes.PERCENTAGE, true, this, true)); } else if (value == 0) { @@ -420,7 +420,7 @@ namespace WebWindowComplex.Models dNewDimension = dLastDimension / (QtyHoriz + 1 - nSplitQtyHoriz); // aggiungo area Split di default for (var SplitIndex = m_SplitHorizList.Count; SplitIndex <= QtyHoriz; SplitIndex++) - m_SplitHorizList.Add(new SplitDimension(dNewDimension, true, this, false)); + m_SplitHorizList.Add(new SplitDimension(dNewDimension, MeasureTypes.PERCENTAGE, true, this, false)); } else if (QtyHoriz < m_SplitHorizList.Count) { @@ -446,7 +446,7 @@ namespace WebWindowComplex.Models dNewDimension = dLastDimension / (QtyVert + 1 - nSplitQtyVert); // aggiungo area Split di default for (var SplitIndex = m_SplitVertList.Count; SplitIndex <= QtyVert; SplitIndex++) - m_SplitVertList.Add(new SplitDimension(dNewDimension, true, this, true)); + m_SplitVertList.Add(new SplitDimension(dNewDimension, MeasureTypes.PERCENTAGE, true, this, true)); } else if (QtyVert < m_SplitVertList.Count) { diff --git a/WebWindowComplex/Models/SplitDimension.cs b/WebWindowComplex/Models/SplitDimension.cs index 70b6dfe..d31d81c 100644 --- a/WebWindowComplex/Models/SplitDimension.cs +++ b/WebWindowComplex/Models/SplitDimension.cs @@ -12,9 +12,10 @@ namespace WebWindowComplex.Models { #region Public Constructors - public SplitDimension(double dDimension, bool bIsRelative, Split Parent, bool IsVertList) + public SplitDimension(double dDimension, MeasureTypes MeasureType, bool bIsRelative, Split Parent, bool IsVertList) { m_dDimension = dDimension; + m_SelMeasureType = MeasureType; m_bIsRelative = bIsRelative; m_Parent = Parent; m_bIsVertListDim = IsVertList; @@ -191,7 +192,7 @@ namespace WebWindowComplex.Models public SplitDimension Copy() { - SplitDimension newSplitDim = new SplitDimension(dDimension, bIsRelative, m_Parent, bIsVertListDim); + SplitDimension newSplitDim = new SplitDimension(dDimension, MeasureTypes.PERCENTAGE, bIsRelative, m_Parent, bIsVertListDim); return newSplitDim; } From 576404e6f1c38e73e40764983e3eaa91d3f7caf4 Mon Sep 17 00:00:00 2001 From: Annamaria Sassi Date: Tue, 18 Nov 2025 15:42:58 +0100 Subject: [PATCH 03/18] Update settings & altro --- Test.UI/Components/Pages/EditJWD.razor.cs | 2 +- Test.UI/appsettings.json | 16 +- WebWindowComplex/Compo/AreaSash.razor | 48 ++- WebWindowComplex/Compo/AreaSash.razor.cs | 25 +- WebWindowComplex/Compo/CardSplit.razor | 148 +++++--- WebWindowComplex/Models/FrameDimension.cs | 112 ++++++ WebWindowComplex/Models/Sash.cs | 123 ++++++- WebWindowComplex/Models/SashDimension.cs | 328 ++++++++++++------ WebWindowComplex/Models/Split.cs | 24 +- WebWindowComplex/TableComp.razor.cs | 172 +++++---- .../WebWindowConfigurator.csproj | 12 +- 11 files changed, 724 insertions(+), 286 deletions(-) diff --git a/Test.UI/Components/Pages/EditJWD.razor.cs b/Test.UI/Components/Pages/EditJWD.razor.cs index 3891743..3e41df8 100644 --- a/Test.UI/Components/Pages/EditJWD.razor.cs +++ b/Test.UI/Components/Pages/EditJWD.razor.cs @@ -126,7 +126,7 @@ namespace Test.UI.Components.Pages protected override async Task OnInitializedAsync() { ConfInit(); - //InitialJwd = File.ReadAllText("Data\\FinestraDueAnteSeparate.jwd"); + //InitialJwd = File.ReadAllText("Data\\FinestraSplitVert.jwd"); InitialJwd = File.ReadAllText("Data\\AntaDoppia.jwd"); currJwd = InitialJwd; // rileggo altri dati diff --git a/Test.UI/appsettings.json b/Test.UI/appsettings.json index 4dfc168..4c35289 100644 --- a/Test.UI/appsettings.json +++ b/Test.UI/appsettings.json @@ -10,14 +10,14 @@ "Redis": "redis.ufficio:26379, serviceName=devel, DefaultDatabase=6, keepAlive=180, connectTimeout=15000, syncTimeout=15000, asyncTimeout=15000, abortConnect=false, ssl=false, allowAdmin=true" }, "ServerConf": { - "ChannelPng": "Egw:png:img", - "ChannelSvg": "Egw:svg:img", - "ChannelShape": "Egw:shape:curr", - "ChannelHwList": "Egw:hw:list", - "ChannelHwOpt": "Egw:hw:opt", - "ChannelProfList": "Egw:prof:list", - "ChannelBom": "Egw:bom", - "ChannelUpdate": "Egw:update", + "ChannelPng": "lux:png:img", + "ChannelSvg": "lux:svg:img", + "ChannelShape": "lux:shape:curr", + "ChannelHwList": "lux:hw:list", + "ChannelHwOpt": "lux:hw:opt", + "ChannelProfList": "lux:prof:list", + "ChannelBom": "lux:bom", + "ChannelUpdate": "lux:update", "ChannelPub": "EgwEngineInput", "ChannelSub": "EgwEngineOutput", diff --git a/WebWindowComplex/Compo/AreaSash.razor b/WebWindowComplex/Compo/AreaSash.razor index da9d293..0d9473e 100644 --- a/WebWindowComplex/Compo/AreaSash.razor +++ b/WebWindowComplex/Compo/AreaSash.razor @@ -1,4 +1,5 @@ -
+@using EgwCoreLib.Razor +
Sash @(CurrSashGroup.SashList.Count == 1 ? "" : (IndexSash + 1))
@@ -11,7 +12,7 @@ }
-
+ @*
-
+
*@
Dimension - - @switch (CurrSashDim.MeasureType) - { - case Json.WindowConst.MeasureTypes.ABSOLUT: - { - mm - break; - } - case Json.WindowConst.MeasureTypes.PERCENTAGE: - { - % - break; - } - } + + @* *@ +
diff --git a/WebWindowComplex/Compo/AreaSash.razor.cs b/WebWindowComplex/Compo/AreaSash.razor.cs index 997b23d..f217e26 100644 --- a/WebWindowComplex/Compo/AreaSash.razor.cs +++ b/WebWindowComplex/Compo/AreaSash.razor.cs @@ -1,4 +1,7 @@ +using EgwCoreLib.Razor; using Microsoft.AspNetCore.Components; +using Newtonsoft.Json.Linq; +using System; using WebWindowComplex.Models; namespace WebWindowComplex.Compo @@ -43,7 +46,7 @@ namespace WebWindowComplex.Compo get { if(CurrSashGroup.AreaList[IndexSash] is Splitted) -{ + { return CurrSashGroup.AreaList[IndexSash]; } else @@ -57,6 +60,26 @@ namespace WebWindowComplex.Compo } } + public int CssDecimals() + { + switch (CurrSashDim.MeasureType) + { + case Json.WindowConst.MeasureTypes.ABSOLUT: + { + return 2; + } + case Json.WindowConst.MeasureTypes.PROPORTIONAL: + { + return 0; + } + case Json.WindowConst.MeasureTypes.PERCENTAGE: + { + return 1; + } + } + return 0; + } + /// /// Sollevo evento per cambiare l'anta su cui è presente la maniglia /// diff --git a/WebWindowComplex/Compo/CardSplit.razor b/WebWindowComplex/Compo/CardSplit.razor index 568ba2f..df5adc9 100644 --- a/WebWindowComplex/Compo/CardSplit.razor +++ b/WebWindowComplex/Compo/CardSplit.razor @@ -69,41 +69,71 @@
@if (CurrItem.SplitVertList.Count > 0 && CurrItem.SplitHorizList.Count > 0) { -
+
@foreach (var dim in CurrItem.SplitVertList) { -
- - -
Width - % +
}
-
+
@foreach (var dim in CurrItem.SplitHorizList) { -
- - -
Height - % +
}
@@ -112,20 +142,35 @@ { @foreach (var dim in CurrItem.SplitHorizList) { -
-
- - -
+
Height - % +
} @@ -134,20 +179,35 @@ { @foreach (var dim in CurrItem.SplitVertList) { -
-
- - -
+
Width - % +
} diff --git a/WebWindowComplex/Models/FrameDimension.cs b/WebWindowComplex/Models/FrameDimension.cs index 6c6feac..2a71c14 100644 --- a/WebWindowComplex/Models/FrameDimension.cs +++ b/WebWindowComplex/Models/FrameDimension.cs @@ -4,6 +4,7 @@ using System.Linq; using System.Text; using System.Threading.Tasks; using WebWindowComplex.Json; +using static WebWindowComplex.Json.WindowConst; namespace WebWindowComplex.Models { @@ -41,6 +42,8 @@ namespace WebWindowComplex.Models { m_dValue = MinDim; } + //if(ParentFrame.AreaList.Count > 0) + // SearchAreaList(ParentFrame); m_ParentFrame.ParentWindow.OnUpdatePreview(m_ParentFrame.ParentWindow.sSerialized()); } } @@ -73,6 +76,115 @@ namespace WebWindowComplex.Models #region Internal Methods + /// + /// Cerca nell'albero gli oggetti Sash e Split per associare la larghezza + /// + /// + //protected void SearchAreaList(Area node) + //{ + // if (node != null) + // { + // if(node.AreaType.Equals(AreaTypes.SASH)) + // calculateWidth((Sash)node); + // else if(node.AreaType.Equals(AreaTypes.SPLIT)) + // calculateWidth((Split)node); + // foreach (var item in node.AreaList) + // { + // SearchAreaList(item); + // } + // } + //} + + /// + /// Ricalcolo larghezza Sash e SPlit + /// + /// + //protected void calculateWidth(Area area) + //{ + // if (area is Sash) + // { + // Sash sash = (Sash)area; + // if (area.ParentArea is Frame) + // { + // Frame frame = (Frame)area.ParentArea; + // sash.Width = (frame.DimensionList.Where(x => x.sName == "Width").FirstOrDefault())!.dValue; + // } + // else if (sash.ParentArea.ParentArea is Split) + // { + // Split split = (Split)sash.ParentArea.ParentArea; + // if (split.SplitVertList.Count > 0) + // { + // int indexSplit = 0; + // for (int i = 0; i < split.AreaList.Count; i++) + // { + // if (split.AreaList.ElementAt(i).AreaList.First().Equals(sash)) + // indexSplit = i; + // } + // switch (split.SplitVertList.ElementAt(indexSplit).MeasureType) + // { + // case MeasureTypes.ABSOLUT: + // { + // sash.Width = split.SplitVertList.ElementAt(indexSplit).dDimension; + // break; + // } + // case MeasureTypes.PROPORTIONAL: + // { + // /// TO DO!!!!! + // break; + // } + // case MeasureTypes.PERCENTAGE: + // { + // sash.Width = split.SplitVertList.ElementAt(indexSplit).dDimension / 100 * split.Width; + // break; + // } + // } + // } + // else + // { + // Frame frame = (Frame)sash.ParentWindow.AreaList[0]; + // sash.Width = (frame.DimensionList.Where(x => x.sName == "Width").FirstOrDefault())!.dValue; + // } + // } + // } + // else if (area is Split) + // { + // Split split = (Split)area; + // if (area.ParentArea is Frame) + // { + // Frame frame = (Frame)area.ParentArea; + // split.Width = (frame.DimensionList.Where(x => x.sName == "Width").FirstOrDefault())!.dValue; + // } + // else if (split.ParentArea.ParentArea is Sash) + // { + // Sash sash = (Sash)split.ParentArea.ParentArea; + // int indexSash = 0; + // for (int i = 0; i < sash.AreaList.Count; i++) + // { + // if (sash.AreaList.ElementAt(i).AreaList.First().Equals(split)) + // indexSash = i; + // } + // switch (sash.SashList.ElementAt(indexSash).MeasureType) + // { + // case MeasureTypes.ABSOLUT: + // { + // split.Width = sash.SashList.ElementAt(indexSash).dDimension; + // break; + // } + // case MeasureTypes.PROPORTIONAL: + // { + // /// TO DO!!!!! + // break; + // } + // case MeasureTypes.PERCENTAGE: + // { + // split.Width = sash.SashList.ElementAt(indexSash).dDimension / 100 * sash.Width; + // break; + // } + // } + // } + // } + //} + internal JsonFrameDimension Serialize() { JsonFrameDimension JsonFrameDimension = new JsonFrameDimension(m_nIndex, m_sName, m_dValue); diff --git a/WebWindowComplex/Models/Sash.cs b/WebWindowComplex/Models/Sash.cs index c7f82af..0255e20 100644 --- a/WebWindowComplex/Models/Sash.cs +++ b/WebWindowComplex/Models/Sash.cs @@ -34,20 +34,51 @@ namespace WebWindowComplex.Models #region Public Properties - /// - /// Larghezza gruppo ante - /// - public double Width - { - get - { - return m_Width; - } - set - { - m_Width = value; - } - } + ///// + ///// Larghezza gruppo ante + ///// + //public double Width + //{ + // get + // { + // return m_Width; + // } + // set + // { + // if (m_Width != value && m_Width != 0) + // { + // // Se larghezza aumentata + // if (SashList.Sum(x => x.CalculateAbsolutValue(m_Width)) < value) + // { + // if (SashList.Where(x => x.MeasureType.Equals(MeasureTypes.PROPORTIONAL)).ToList().Count == 0 && + // SashList.Where(x => x.MeasureType.Equals(MeasureTypes.PERCENTAGE)).ToList().Count != SashList.Count) + // { + // double res = value - m_Width; + // foreach (var item in SashList) + // item.SetDimension(item.ConvertIn(item.CalculateAbsolutValue(m_Width) + res / SashList.Count, (MeasureTypes)item.SelMeasureTypeIndex, value)); + // } + // } + // // Larghezza diminuita + // else if (SashList.Sum(x => x.CalculateAbsolutValue(m_Width)) > value) + // { + // if (SashList.Where(x => x.MeasureType.Equals(MeasureTypes.PROPORTIONAL)).ToList().Count == 0 && + // SashList.Where(x => x.MeasureType.Equals(MeasureTypes.PERCENTAGE)).ToList().Count != SashList.Count) + // { + // double res = m_Width - value; + // foreach (var item in SashList) + // item.SetDimension(item.ConvertIn(item.CalculateAbsolutValue(m_Width) - res / SashList.Count, (MeasureTypes)item.SelMeasureTypeIndex, value)); + // } + // } + // m_Width = value; + // m_ParentWindow.OnUpdatePreview(m_ParentWindow.sSerialized()); + // } + // else + // { + // m_Width = value; + // m_ParentWindow.OnUpdatePreview(m_ParentWindow.sSerialized()); + // } + // } + //} public bool bIsMeasureGlass { @@ -158,7 +189,8 @@ namespace WebWindowComplex.Models itemDelete = m_SashList[SplitIndex]; SashList.RemoveAt(SplitIndex); } - double deleteDim = itemDelete.ConvertDimension(itemDelete.SelMeasureType, m_SashList[SashList.Count - 1].SelMeasureType); + double widthTot = CalculateWidthSashGroup(ParentWindow.AreaList.First(), ParentWindow.AreaList.FirstOrDefault().DimensionList.Where(x => x.sName == "Width").First().dValue); + double deleteDim = itemDelete.ConvertDimension(itemDelete.SelMeasureType, m_SashList[SashList.Count - 1].SelMeasureType, widthTot); //dLastDimension += m_SashList[SashList.Count - 1].dDimension; dLastDimension = deleteDim + m_SashList[SashList.Count - 1].dDimension; SashList[SashList.Count - 1].SetDimension(dLastDimension); @@ -570,7 +602,64 @@ namespace WebWindowComplex.Models #endregion Public Methods #region Internal Methods - + internal double CalculateWidthSashGroup(Area area, double width) + { + if (area.Equals(this)) + return width; + for (int i = 0; i < area.AreaList.Count; i++) + { + Area item = area.AreaList[i]; + if (area is Split) + { + Split split = (Split)area; + switch (split.SplitVertList.ElementAt(i).SelMeasureType) + { + case MeasureTypes.ABSOLUT: + { + CalculateWidthSashGroup(item, split.SplitVertList.ElementAt(i).dDimension); + break; + } + case MeasureTypes.PROPORTIONAL: + { + //CalculateWidthSashGroup(item, split.SplitVertList.ElementAt(i).dDimension); + break; + } + case MeasureTypes.PERCENTAGE: + { + CalculateWidthSashGroup(item, split.SplitVertList.ElementAt(i).dDimension * width / 100); + break; + } + } + } + else if (area is Sash) + { + Sash sash = (Sash)area; + switch (sash.SashList.ElementAt(i).SelMeasureType) + { + case MeasureTypes.ABSOLUT: + { + CalculateWidthSashGroup(item, sash.SashList.ElementAt(i).dDimension); + break; + } + case MeasureTypes.PROPORTIONAL: + { + //CalculateWidthSashGroup(item, sash.SashList.ElementAt(i).dDimension); + break; + } + case MeasureTypes.PERCENTAGE: + { + CalculateWidthSashGroup(item, sash.SashList.ElementAt(i).dDimension * width / 100); + break; + } + } + } + else + { + CalculateWidthSashGroup(item, width); + } + } + return -1; + } internal static Sash CreateSash(Area Area) { Sash newSash = new Sash(Area, Area.ParentWindow); @@ -909,8 +998,6 @@ namespace WebWindowComplex.Models private Hardware m_SelHardware; private OrientationSash m_SelOrientationSashType; - private double m_Width = 0; - #endregion Private Fields #region Private Methods diff --git a/WebWindowComplex/Models/SashDimension.cs b/WebWindowComplex/Models/SashDimension.cs index bf27283..16161f3 100644 --- a/WebWindowComplex/Models/SashDimension.cs +++ b/WebWindowComplex/Models/SashDimension.cs @@ -1,4 +1,5 @@ -using WebWindowComplex.Json; +using System.Security.Principal; +using WebWindowComplex.Json; using static WebWindowComplex.Json.WindowConst; namespace WebWindowComplex.Models @@ -113,42 +114,96 @@ namespace WebWindowComplex.Models } set { - double valMax = 0; + double widthTot = CalculateWidthSashGroup(m_Parent.ParentWindow.AreaList.FirstOrDefault(), m_Parent.ParentWindow.AreaList.FirstOrDefault().DimensionList.Where(x => x.sName == "Width").First().dValue); + double valMinAbsolut = 100; + double valMaxAbsolut = widthTot - valMinAbsolut * (m_Parent.SashList.Count - 1); bool valueAccept = false; switch (MeasureType) { case MeasureTypes.ABSOLUT: { - valMax = m_Parent.Width; - valueAccept = (value < valMax && value > 0) ? true : false; + valueAccept = (value < valMaxAbsolut && value > valMinAbsolut) ? true : false; break; } case MeasureTypes.PROPORTIONAL: { - valMax = 20; - valueAccept = true ; + valMaxAbsolut = 20; + valueAccept = (value > 1) ? true : false; break; } case MeasureTypes.PERCENTAGE: { - valMax = 100; - valueAccept = (value < valMax && value > 0) ? true : false; + valMaxAbsolut = valMaxAbsolut / widthTot * 100; + valMinAbsolut = valMinAbsolut / widthTot * 100; + valueAccept = (value < valMaxAbsolut && value > valMinAbsolut) ? true : false; break; } } if (valueAccept) { - double widthTot = m_Parent.Width; - List dimensions = m_Parent.SashList; + List dimensions = m_Parent.SashList; List absolutValList = new List(); - foreach(var item in m_Parent.SashList) + foreach (var item in m_Parent.SashList) { absolutValList.Add(item.CalculateAbsolutValue(widthTot)); } int nIndex = dimensions.IndexOf(this); int proportionalCount = dimensions.Where(x => x.MeasureType.Equals(MeasureTypes.PROPORTIONAL)).ToList().Count; - // Le altre dimensioni non sono solo in proporzionale - if ( proportionalCount == 0 || proportionalCount < absolutValList.Count - 1) + int percentageCount = dimensions.Where(x => x.MeasureType.Equals(MeasureTypes.PERCENTAGE)).ToList().Count; + // Le dimensioni sono solo in proporzionale + if (proportionalCount == absolutValList.Count) + { + m_dDimension = value; + } + // Le dimensioni sono solo in percentuale + else if (percentageCount == dimensions.Count) + { + if (value < dDimension) + { + // L'anta modificata non è l'ultima + if (nIndex < dimensions.Count - 1) + dimensions[nIndex + 1].SetDimension(dimensions[nIndex + 1].dDimension + (m_dDimension - value)); + else if (dimensions.Count > 1) + dimensions[nIndex - 1].SetDimension(dimensions[nIndex - 1].dDimension + (m_dDimension - value)); + else + { + m_dDimension = 100; + return; + } + } + else + { + double dRes = value; + // se non ultima anta + if (nIndex < dimensions.Count - 1) + { + for (var nInd = 0; nInd <= nIndex - 1; nInd++) + dRes += dimensions[nInd].dDimension; + dRes = (100 - dRes) / (dimensions.Count - nIndex - 1); + for (var Ind = nIndex + 1; Ind <= dimensions.Count - 1; Ind++) + dimensions[Ind].SetDimension(dRes); + } + // se ultima anta + else if (dimensions.Count > 1) + { + if (dimensions.Count > 2) + { + for (var Ind = 0; Ind <= nIndex - 2; Ind++) + dRes += dimensions[Ind].dDimension; + } + dRes = (100 - dRes); + dimensions[nIndex - 1].SetDimension(dRes); + } + else + { + m_dDimension = 100; + return; + } + } + m_dDimension = value; + } + // Le dimensioni sono miste o solo in assoluto + else { double valueInAbsolute = 0; switch (MeasureType) @@ -204,78 +259,75 @@ namespace WebWindowComplex.Models } if (MeasureType.Equals(MeasureTypes.PROPORTIONAL)) m_dDimension = value; - for(int i = 0; i < absolutValList.Count; i++) + for (int i = 0; i < absolutValList.Count; i++) { var item = m_Parent.SashList.ElementAt(i); item.SetDimension(ConvertIn(absolutValList[i], (MeasureTypes)item.SelMeasureTypeIndex, widthTot)); } } - else - { - m_dDimension = value; - } + m_Parent.ParentWindow.OnUpdatePreview(m_Parent.ParentWindow.sSerialized()); } - //// se sono in percentuale - //if (m_MeasureType.Equals(MeasureTypes.PERCENTAGE)) - //{ - // // Controllo che il valore inserito sia compreso tra 0 e 100 - // if (value > 0 && value < 100) - // { - // // verifico se ci sono altri in percentuale - // List RelativeDimList = m_Parent.SashList.Where(x => x.MeasureType.Equals(MeasureTypes.PERCENTAGE)).ToList(); - // if (RelativeDimList.Count > 0) - // { - // int nIndex = RelativeDimList.IndexOf(this); - // // se diminuisce dimensione - // if (value < m_dDimension) - // { - // if (nIndex < RelativeDimList.Count - 1) - // RelativeDimList[nIndex + 1].SetDimension(RelativeDimList[nIndex + 1].dDimension + (m_dDimension - value)); - // else if (RelativeDimList.Count > 1) - // RelativeDimList[nIndex - 1].SetDimension(RelativeDimList[nIndex - 1].dDimension + (m_dDimension - value)); - // else - // { - // m_dDimension = 100; - // return; - // } - // } - // // se aumenta dimensione - // else - // { - // double dRes = value; - // // se non ultima anta - // if (nIndex < RelativeDimList.Count - 1) - // { - // for (var nInd = 0; nInd <= nIndex - 1; nInd++) - // dRes += RelativeDimList[nInd].dDimension; - // dRes = (100 - dRes) / (RelativeDimList.Count - nIndex - 1); - // for (var Ind = nIndex + 1; Ind <= RelativeDimList.Count - 1; Ind++) - // RelativeDimList[Ind].SetDimension(dRes); - // } - // // se ultima anta - // else if (RelativeDimList.Count > 1) - // { - // if (RelativeDimList.Count > 2) - // { - // for (var Ind = 0; Ind <= nIndex - 2; Ind++) - // dRes += RelativeDimList[Ind].dDimension; - // } - // dRes = (100 - dRes); - // RelativeDimList[nIndex - 1].SetDimension(dRes); - // } - // else - // { - // m_dDimension = 100; - // return; - // } - // } - // } - // } - // m_dDimension = value; - // m_Parent.ParentWindow.OnUpdatePreview(m_Parent.ParentWindow.sSerialized()); - //} + //// se sono in percentuale + //if (m_MeasureType.Equals(MeasureTypes.PERCENTAGE)) + //{ + // // Controllo che il valore inserito sia compreso tra 0 e 100 + // if (value > 0 && value < 100) + // { + // // verifico se ci sono altri in percentuale + // List RelativeDimList = m_Parent.SashList.Where(x => x.MeasureType.Equals(MeasureTypes.PERCENTAGE)).ToList(); + // if (RelativeDimList.Count > 0) + // { + // int nIndex = RelativeDimList.IndexOf(this); + // // se diminuisce dimensione + // if (value < m_dDimension) + // { + // if (nIndex < RelativeDimList.Count - 1) + // RelativeDimList[nIndex + 1].SetDimension(RelativeDimList[nIndex + 1].dDimension + (m_dDimension - value)); + // else if (RelativeDimList.Count > 1) + // RelativeDimList[nIndex - 1].SetDimension(RelativeDimList[nIndex - 1].dDimension + (m_dDimension - value)); + // else + // { + // m_dDimension = 100; + // return; + // } + // } + // // se aumenta dimensione + // else + // { + // double dRes = value; + // // se non ultima anta + // if (nIndex < RelativeDimList.Count - 1) + // { + // for (var nInd = 0; nInd <= nIndex - 1; nInd++) + // dRes += RelativeDimList[nInd].dDimension; + // dRes = (100 - dRes) / (RelativeDimList.Count - nIndex - 1); + // for (var Ind = nIndex + 1; Ind <= RelativeDimList.Count - 1; Ind++) + // RelativeDimList[Ind].SetDimension(dRes); + // } + // // se ultima anta + // else if (RelativeDimList.Count > 1) + // { + // if (RelativeDimList.Count > 2) + // { + // for (var Ind = 0; Ind <= nIndex - 2; Ind++) + // dRes += RelativeDimList[Ind].dDimension; + // } + // dRes = (100 - dRes); + // RelativeDimList[nIndex - 1].SetDimension(dRes); + // } + // else + // { + // m_dDimension = 100; + // return; + // } + // } + // } + // } + // m_dDimension = value; + // m_Parent.ParentWindow.OnUpdatePreview(m_Parent.ParentWindow.sSerialized()); + //} } } @@ -381,7 +433,8 @@ namespace WebWindowComplex.Models if(m_SelMeasureType != (MeasureTypes)value) { MeasureTypes newType = (MeasureTypes)value; - m_dDimension = ConvertDimension(m_SelMeasureType, newType); + double widthTot = CalculateWidthSashGroup(m_Parent.ParentWindow.AreaList.FirstOrDefault(), m_Parent.ParentWindow.AreaList.FirstOrDefault().DimensionList.Where(x => x.sName == "Width").First().dValue); + m_dDimension = ConvertDimension(m_SelMeasureType, newType, widthTot); m_SelMeasureType = (MeasureTypes)value; m_Parent.ParentWindow.OnUpdatePreview(m_Parent.ParentWindow.sSerialized()); } @@ -398,7 +451,7 @@ namespace WebWindowComplex.Models /// Vecchio tipo /// Nuovo tipo /// - public double ConvertDimension(MeasureTypes oldType, MeasureTypes newType) + public double ConvertDimension(MeasureTypes oldType, MeasureTypes newType, double widthTot) { switch (oldType) { @@ -406,33 +459,37 @@ namespace WebWindowComplex.Models { if (newType.Equals(MeasureTypes.PERCENTAGE)) { - return Double.Round((m_dDimension / m_Parent.Width) * 100, 0); + //return Double.Round((m_dDimension / m_Parent.Width) * 100, 1); + return (m_dDimension / widthTot) * 100; } else { - return ricalculatePropVal(); + return CalculatePropVal(widthTot); } } case MeasureTypes.PROPORTIONAL: { if (newType.Equals(MeasureTypes.ABSOLUT)) { - return Double.Round(convertFromPropVal(newType), 2); + //return Double.Round(ConvertFromPropVal(newType), 2); + return ConvertFromPropVal(newType, widthTot); } else { - return Double.Round(convertFromPropVal(newType)); + //return Double.Round(ConvertFromPropVal(newType), 1); + return ConvertFromPropVal(newType, widthTot); } } case MeasureTypes.PERCENTAGE: { if (newType.Equals(MeasureTypes.ABSOLUT)) { - return Double.Round((m_dDimension * m_Parent.Width) / 100); + //return Double.Round((m_dDimension * m_Parent.Width) / 100, 2); + return (m_dDimension * widthTot) / 100; } else { - return Double.Round(ricalculatePropVal()); + return CalculatePropVal(widthTot); } } } @@ -456,6 +513,72 @@ namespace WebWindowComplex.Models #region Internal Methods + internal double CalculateWidthSashGroup(Area area, double width) + { + for(int i = 0; i < area.AreaList.Count; i++) + { + double risultato = -1; + if (area.Equals(m_Parent)) + return width; + Area item = area.AreaList[i]; + if(area is Split) + { + Split split = (Split)area; + switch (split.SplitVertList.ElementAt(i).SelMeasureType) + { + case MeasureTypes.ABSOLUT: + { + risultato = CalculateWidthSashGroup(item, split.SplitVertList.ElementAt(i).dDimension); + break; + } + case MeasureTypes.PROPORTIONAL: + { + //risultato = CalculateWidthSashGroup(item, split.SplitVertList.ElementAt(i).dDimension); + break; + } + case MeasureTypes.PERCENTAGE: + { + risultato = CalculateWidthSashGroup(item, split.SplitVertList.ElementAt(i).dDimension * width / 100); + break; + } + } + if (risultato != -1) + return risultato; + } + else if (area is Sash) + { + Sash sash = (Sash)area; + switch (sash.SashList.ElementAt(i).SelMeasureType) + { + case MeasureTypes.ABSOLUT: + { + risultato = CalculateWidthSashGroup(item, sash.SashList.ElementAt(i).dDimension); + break; + } + case MeasureTypes.PROPORTIONAL: + { + //risultato = CalculateWidthSashGroup(item, sash.SashList.ElementAt(i).dDimension); + break; + } + case MeasureTypes.PERCENTAGE: + { + risultato = CalculateWidthSashGroup(item, sash.SashList.ElementAt(i).dDimension * width / 100); + break; + } + } + if (risultato != -1) + return risultato; + } + else + { + risultato = CalculateWidthSashGroup(item, width); + if (risultato != -1) + return risultato; + } + } + return width; + } + internal JsonSashDimension Serialize() { JsonSashDimension JsonSashDimension = new JsonSashDimension(OpeningType, MeasureType, m_bHasHandle, m_dDimension, m_nSashId); @@ -487,20 +610,23 @@ namespace WebWindowComplex.Models /// /// Larghezza totale /// - internal double CalculateAbsolutValue(double widthTot) + public double CalculateAbsolutValue(double widthTot) { switch (MeasureType) { case MeasureTypes.ABSOLUT: { + //return Double.Round(dDimension, 2); return dDimension; } case MeasureTypes.PROPORTIONAL: { - return calculatePropVal(); + //return Double.Round(Proportional2AbsolutVal(), 2); + return Proportional2AbsolutVal(widthTot); } case MeasureTypes.PERCENTAGE: { + //return Double.Round((dDimension / 100) * widthTot, 1); return (dDimension / 100) * widthTot; } } @@ -514,20 +640,23 @@ namespace WebWindowComplex.Models /// Tipo di misura della dimensione /// Larghezza totale /// - internal double ConvertIn(double absolutVal, MeasureTypes type, double widthTot) + public double ConvertIn(double absolutVal, MeasureTypes type, double widthTot) { switch (type) { case MeasureTypes.ABSOLUT: { + //return Double.Round(absolutVal, 2); return absolutVal; } case MeasureTypes.PROPORTIONAL: { - return calculatePropVal(); + //return Proportional2AbsolutVal(); + return Proportional2AbsolutVal(widthTot); } case MeasureTypes.PERCENTAGE: { + //return Double.Round((absolutVal / widthTot) * 100, 1); return (absolutVal / widthTot) * 100; } } @@ -539,9 +668,9 @@ namespace WebWindowComplex.Models /// /// /// - internal double convertFromPropVal(MeasureTypes newType) + internal double ConvertFromPropVal(MeasureTypes newType, double widthTot) { - double tot = m_Parent.Width; + double tot = widthTot; //Somma misura non proporzionali double sumNotProp = m_Parent.SashList .Where(m => m.MeasureType != MeasureTypes.PROPORTIONAL && !m.Equals(this)) @@ -570,9 +699,9 @@ namespace WebWindowComplex.Models /// Metodo per calcolare il valore proporzionale /// /// - internal double calculatePropVal() + internal double Proportional2AbsolutVal(double widthTot) { - double tot = m_Parent.Width; + double tot = widthTot; //Somma misura non proporzionali double sumNotProp = m_Parent.SashList .Where(m => m.MeasureType != MeasureTypes.PROPORTIONAL) @@ -595,14 +724,15 @@ namespace WebWindowComplex.Models /// /// /// - public static double CalcolaMCD(double a, double b) + internal static double CalcolaMCD(double a, double b) { - while (b != 0) + while (b >= 0.01) { double temp = b; b = a % b; a = temp; } + //return Double.Round(a,2); return a; } @@ -610,7 +740,7 @@ namespace WebWindowComplex.Models /// Metodo per ricalcolare i valori proporzionali a causa della modifica di uno /// /// - internal double ricalculatePropVal() + internal double CalculatePropVal(double widthTot) { if(m_Parent.SashList.Where(m => m.MeasureType.Equals(MeasureTypes.PROPORTIONAL)).ToList().Count == 0) { @@ -619,7 +749,7 @@ namespace WebWindowComplex.Models List absolutValue = new List(); foreach (var item in m_Parent.SashList) { - absolutValue.Add(item.CalculateAbsolutValue(m_Parent.Width)); + absolutValue.Add(item.CalculateAbsolutValue(widthTot)); } for(int i = 0; i < m_Parent.SashList.Count; i++) { @@ -630,12 +760,16 @@ namespace WebWindowComplex.Models if (absolutValue.ElementAt(nIndex) <= absolutValue.ElementAt(i)) { var mcd = CalcolaMCD(absolutValue.ElementAt(nIndex), absolutValue.ElementAt(i)); + //m_Parent.SashList.ElementAt(i).m_dDimension = Double.Round(absolutValue.ElementAt(i) / mcd, 2); + //m_dDimension = Double.Round(absolutValue.ElementAt(nIndex) / mcd, 2); m_Parent.SashList.ElementAt(i).m_dDimension = absolutValue.ElementAt(i) / mcd; m_dDimension = absolutValue.ElementAt(nIndex) / mcd; } else { var mcd = CalcolaMCD(absolutValue.ElementAt(nIndex), absolutValue.ElementAt(i)); + //m_Parent.SashList.ElementAt(i).m_dDimension = Double.Round(absolutValue.ElementAt(i) / mcd, 2); + //m_dDimension = Double.Round(absolutValue.ElementAt(nIndex) / mcd, 2); m_Parent.SashList.ElementAt(i).m_dDimension = absolutValue.ElementAt(i) / mcd; m_dDimension = absolutValue.ElementAt(nIndex) / mcd; } diff --git a/WebWindowComplex/Models/Split.cs b/WebWindowComplex/Models/Split.cs index b07be20..6833f1c 100644 --- a/WebWindowComplex/Models/Split.cs +++ b/WebWindowComplex/Models/Split.cs @@ -23,17 +23,17 @@ namespace WebWindowComplex.Models /// /// Larghezza gruppo split /// - public double Width - { - get - { - return m_Width; - } - set - { - m_Width = value; - } - } + //public double Width + //{ + // get + // { + // return m_Width; + // } + // set + // { + // m_Width = value; + // } + //} public bool bIsPercentage { @@ -487,7 +487,7 @@ namespace WebWindowComplex.Models private List m_SplitVertList = new List(); - private double m_Width = 0; + //private double m_Width = 0; #endregion Private Fields } diff --git a/WebWindowComplex/TableComp.razor.cs b/WebWindowComplex/TableComp.razor.cs index 551f02e..0557c97 100644 --- a/WebWindowComplex/TableComp.razor.cs +++ b/WebWindowComplex/TableComp.razor.cs @@ -424,7 +424,6 @@ namespace WebWindowComplex case AreaTypes.SASH: { m_SashList.Add((Sash)node); - calculateWidth((Sash)node); break; } case AreaTypes.FILL: @@ -435,7 +434,6 @@ namespace WebWindowComplex case AreaTypes.SPLIT: { m_SplitList.Add((Split)node); - calculateWidth((Split)node); break; } case AreaTypes.SPLITTED: @@ -454,91 +452,91 @@ namespace WebWindowComplex } } - protected void calculateWidth(Area area) - { - if (area is Sash) - { - Sash sash = (Sash)area; - if (area.ParentArea is Frame) - { - Frame frame = (Frame)area.ParentArea; - sash.Width = (frame.DimensionList.Where(x => x.sName == "Width").FirstOrDefault())!.dValue; - } - else if (sash.ParentArea.ParentArea is Split) - { - Split split = (Split)sash.ParentArea.ParentArea; - if (split.SplitVertList.Count > 0) - { - int indexSplit = 0; - for(int i = 0; i < split.AreaList.Count; i++) - { - if (split.AreaList.ElementAt(i).AreaList.First().Equals(sash)) - indexSplit = i; - } - switch (split.SplitVertList.ElementAt(indexSplit).MeasureType) - { - case MeasureTypes.ABSOLUT: - { - sash.Width = split.SplitVertList.ElementAt(indexSplit).dDimension; - break; - } - case MeasureTypes.PROPORTIONAL: - { - /// TO DO!!!!! - break; - } - case MeasureTypes.PERCENTAGE: - { - sash.Width = split.SplitVertList.ElementAt(indexSplit).dDimension / 100 * split.Width; - break; - } - } - } - else - { - Frame frame = (Frame)sash.ParentWindow.AreaList[0]; - sash.Width = (frame.DimensionList.Where(x => x.sName == "Width").FirstOrDefault())!.dValue; - } - } - } - else if (area is Split) - { - Split split = (Split)area; - if (area.ParentArea is Frame) - { - Frame frame = (Frame)area.ParentArea; - split.Width = (frame.DimensionList.Where(x => x.sName == "Width").FirstOrDefault())!.dValue; - } - else if (split.ParentArea.ParentArea is Sash) - { - Sash sash = (Sash)split.ParentArea.ParentArea; - int indexSash = 0; - for (int i = 0; i < sash.AreaList.Count; i++) - { - if (sash.AreaList.ElementAt(i).AreaList.First().Equals(split)) - indexSash = i; - } - switch (sash.SashList.ElementAt(indexSash).MeasureType) - { - case MeasureTypes.ABSOLUT: - { - split.Width = sash.SashList.ElementAt(indexSash).dDimension; - break; - } - case MeasureTypes.PROPORTIONAL: - { - /// TO DO!!!!! - break; - } - case MeasureTypes.PERCENTAGE: - { - split.Width = sash.SashList.ElementAt(indexSash).dDimension / 100 * sash.Width; - break; - } - } - } - } - } + //protected void calculateWidth(Area area) + //{ + // if (area is Sash) + // { + // Sash sash = (Sash)area; + // if (area.ParentArea is Frame) + // { + // Frame frame = (Frame)area.ParentArea; + // sash.Width = (frame.DimensionList.Where(x => x.sName == "Width").FirstOrDefault())!.dValue; + // } + // else if (sash.ParentArea.ParentArea is Split) + // { + // Split split = (Split)sash.ParentArea.ParentArea; + // if (split.SplitVertList.Count > 0) + // { + // int indexSplit = 0; + // for(int i = 0; i < split.AreaList.Count; i++) + // { + // if (split.AreaList.ElementAt(i).AreaList.First().Equals(sash)) + // indexSplit = i; + // } + // switch (split.SplitVertList.ElementAt(indexSplit).MeasureType) + // { + // case MeasureTypes.ABSOLUT: + // { + // sash.Width = split.SplitVertList.ElementAt(indexSplit).dDimension; + // break; + // } + // case MeasureTypes.PROPORTIONAL: + // { + // /// TO DO!!!!! + // break; + // } + // case MeasureTypes.PERCENTAGE: + // { + // sash.Width = split.SplitVertList.ElementAt(indexSplit).dDimension / 100 * split.Width; + // break; + // } + // } + // } + // else + // { + // Frame frame = (Frame)sash.ParentWindow.AreaList[0]; + // sash.Width = (frame.DimensionList.Where(x => x.sName == "Width").FirstOrDefault())!.dValue; + // } + // } + // } + // else if (area is Split) + // { + // Split split = (Split)area; + // if (area.ParentArea is Frame) + // { + // Frame frame = (Frame)area.ParentArea; + // split.Width = (frame.DimensionList.Where(x => x.sName == "Width").FirstOrDefault())!.dValue; + // } + // else if (split.ParentArea.ParentArea is Sash) + // { + // Sash sash = (Sash)split.ParentArea.ParentArea; + // int indexSash = 0; + // for (int i = 0; i < sash.AreaList.Count; i++) + // { + // if (sash.AreaList.ElementAt(i).AreaList.First().Equals(split)) + // indexSash = i; + // } + // switch (sash.SashList.ElementAt(indexSash).MeasureType) + // { + // case MeasureTypes.ABSOLUT: + // { + // split.Width = sash.SashList.ElementAt(indexSash).dDimension; + // break; + // } + // case MeasureTypes.PROPORTIONAL: + // { + // //split.Width = Proportional2AbsolutVal(split); + // break; + // } + // case MeasureTypes.PERCENTAGE: + // { + // split.Width = sash.SashList.ElementAt(indexSash).dDimension / 100 * sash.Width; + // break; + // } + // } + // } + // } + //} /// /// Calcola CSS warning diff --git a/WebWindowConfigurator/WebWindowConfigurator.csproj b/WebWindowConfigurator/WebWindowConfigurator.csproj index e554af6..99e62b5 100644 --- a/WebWindowConfigurator/WebWindowConfigurator.csproj +++ b/WebWindowConfigurator/WebWindowConfigurator.csproj @@ -6,7 +6,7 @@ net8.0 enable enable - 2.7.11.1318 + 2.7.11.1815 Annamaria Sassi Egalware Componente gestione JWD per LUX @@ -165,6 +165,16 @@ + + + + + + + + + + From d823112bed1ba478b9ac6a589d302db003dcdabb Mon Sep 17 00:00:00 2001 From: Annamaria Sassi Date: Tue, 18 Nov 2025 15:47:30 +0100 Subject: [PATCH 04/18] Aggiornati nomi canali e nuget --- Test.UI/Test.UI.csproj | 4 ++-- WebWindowComplex/WebWindowComplex.csproj | 4 +++- WebWindowConfigurator/WebWindowConfigurator.csproj | 2 ++ 3 files changed, 7 insertions(+), 3 deletions(-) diff --git a/Test.UI/Test.UI.csproj b/Test.UI/Test.UI.csproj index bd45e8e..8cf883b 100644 --- a/Test.UI/Test.UI.csproj +++ b/Test.UI/Test.UI.csproj @@ -34,8 +34,8 @@ - - + + diff --git a/WebWindowComplex/WebWindowComplex.csproj b/WebWindowComplex/WebWindowComplex.csproj index ca61afe..9a3897c 100644 --- a/WebWindowComplex/WebWindowComplex.csproj +++ b/WebWindowComplex/WebWindowComplex.csproj @@ -6,7 +6,7 @@ net8.0 enable enable - 2.7.11.1318 + 2.7.11.1815 Annamaria Sassi Egalware Componente gestione Configurazioni avanzate Window per LUX @@ -140,6 +140,8 @@ + + diff --git a/WebWindowConfigurator/WebWindowConfigurator.csproj b/WebWindowConfigurator/WebWindowConfigurator.csproj index 99e62b5..c797584 100644 --- a/WebWindowConfigurator/WebWindowConfigurator.csproj +++ b/WebWindowConfigurator/WebWindowConfigurator.csproj @@ -182,6 +182,8 @@ + + From 8c906a7b0063c77bd44938ce50e5e97835b9e3b6 Mon Sep 17 00:00:00 2001 From: Annamaria Sassi Date: Thu, 20 Nov 2025 17:47:05 +0100 Subject: [PATCH 05/18] - Gestito tipi misura in split - spostato joint in ogni anta - cambiato interfaccia della singola anta --- Test.UI/Data/AntaDoppia.jwd | 54 +- WebWindowComplex/Compo/AreaHwOption.razor | 2 +- WebWindowComplex/Compo/AreaSash.razor | 319 +++++++--- WebWindowComplex/Compo/AreaSash.razor.cs | 79 ++- WebWindowComplex/Compo/CardFrame.razor | 14 +- WebWindowComplex/Compo/CardFrame.razor.cs | 10 + WebWindowComplex/Compo/CardSashGroup.razor | 43 +- WebWindowComplex/Compo/CardSashGroup.razor.cs | 85 +-- WebWindowComplex/Json/JsonUtility.cs | 54 +- WebWindowComplex/Models/FrameDimension.cs | 179 +++--- WebWindowComplex/Models/Sash.cs | 155 ++--- WebWindowComplex/Models/SashDimension.cs | 266 ++++---- WebWindowComplex/Models/SplitDimension.cs | 588 ++++++++++++++++-- WebWindowComplex/TableComp.razor | 3 +- WebWindowComplex/TableComp.razor.cs | 8 - WebWindowComplex/WebWindowComplex.csproj | 6 +- .../WebWindowConfigurator.csproj | 39 +- 17 files changed, 1315 insertions(+), 589 deletions(-) diff --git a/Test.UI/Data/AntaDoppia.jwd b/Test.UI/Data/AntaDoppia.jwd index 486ff5f..ee77baa 100644 --- a/Test.UI/Data/AntaDoppia.jwd +++ b/Test.UI/Data/AntaDoppia.jwd @@ -47,6 +47,24 @@ "SashId": 1, "OpeningType": "TILTTURN_LEFT", "HasHandle": true, + "JointList": [ + { + "Index": 1, + "JointType": "FULL_H" + }, + { + "Index": 2, + "JointType": "FULL_H" + }, + { + "Index": 3, + "JointType": "FULL_H" + }, + { + "Index": 4, + "JointType": "FULL_H" + } + ], "MeasureType": "PERCENTAGE", "Dimension": 50.0 }, @@ -54,29 +72,29 @@ "SashId": 2, "OpeningType": "TURNONLY_RIGHT", "HasHandle": false, + "JointList": [ + { + "Index": 1, + "JointType": "FULL_H" + }, + { + "Index": 2, + "JointType": "FULL_H" + }, + { + "Index": 3, + "JointType": "FULL_H" + }, + { + "Index": 4, + "JointType": "FULL_H" + } + ], "MeasureType": "PERCENTAGE", "Dimension": 50.0 } ], "SashType": "NULL", - "JointList": [ - { - "Index": 1, - "JointType": "FULL_H" - }, - { - "Index": 2, - "JointType": "FULL_H" - }, - { - "Index": 3, - "JointType": "FULL_H" - }, - { - "Index": 4, - "JointType": "FULL_H" - } - ], "BottomRail": false, "BottomRailQty": 0, "Hardware": "000633", diff --git a/WebWindowComplex/Compo/AreaHwOption.razor b/WebWindowComplex/Compo/AreaHwOption.razor index f468647..a6a1b40 100644 --- a/WebWindowComplex/Compo/AreaHwOption.razor +++ b/WebWindowComplex/Compo/AreaHwOption.razor @@ -1,6 +1,6 @@ @using static WebWindowComplex.Json.WindowConst -
+
Hardware option
diff --git a/WebWindowComplex/Compo/AreaSash.razor b/WebWindowComplex/Compo/AreaSash.razor index 0d9473e..08ac786 100644 --- a/WebWindowComplex/Compo/AreaSash.razor +++ b/WebWindowComplex/Compo/AreaSash.razor @@ -1,92 +1,249 @@ @using EgwCoreLib.Razor -
-
-
Sash @(CurrSashGroup.SashList.Count == 1 ? "" : (IndexSash + 1))
-
-
- - -
- @*
- - -
*@ -
- Dimension - - @* *@ - -
-
-
- +@if(mode == ModeView.View) +{ +
+
+
Sash @(CurrSashGroup.SashList.Count == 1 ? "" : (IndexSash + 1))
+
-
- +
+ +
-
- @if (!(CurrAnta.AreaList[0] is Split)) - { -
-
-
- +
+ Dimension + + @* *@ + +
+ @*
+
+
+
Joints
+
+
+
-
-
- -
-
-
- } -
- @for (int k = 0; k <= CurrSashGroup.SashList.Count - 1; k++) - { - @if (k != IndexSash) + @if (!JointCollapsed) { - int IndexCopy = k; - int IndexModify = IndexSash; -
-
- +
+
+
+ +
+
+
+
+ +
+
+
+
+ +
} + @if (!JointCollapsed) + { + @foreach (Joint joint in CurrSashDim.JointList) + { + + } + } +
+
+
+ +
+
+ +
+
+ @if (!(CurrAnta.AreaList[0] is Split)) + { +
+
+
+ +
+
+
+
+ +
+
+
} +
+ @for (int k = 0; k <= CurrSashGroup.SashList.Count - 1; k++) + { + @if (k != IndexSash) + { + int IndexCopy = k; + int IndexModify = IndexSash; +
+
+ +
+
+ } + } +
*@
-
+} +else +{ + +} \ No newline at end of file diff --git a/WebWindowComplex/Compo/AreaSash.razor.cs b/WebWindowComplex/Compo/AreaSash.razor.cs index f217e26..4b7ddda 100644 --- a/WebWindowComplex/Compo/AreaSash.razor.cs +++ b/WebWindowComplex/Compo/AreaSash.razor.cs @@ -3,6 +3,7 @@ using Microsoft.AspNetCore.Components; using Newtonsoft.Json.Linq; using System; using WebWindowComplex.Models; +using static WebWindowComplex.Json.WindowConst; namespace WebWindowComplex.Compo { @@ -32,6 +33,12 @@ namespace WebWindowComplex.Compo [Parameter] public EventCallback EC_ChangeHandle { get; set; } + /// + /// Evento per aggiornare sash dimension + /// + [Parameter] + public EventCallback EC_UpdateSashDim { get; set; } + /// /// Evento per cambiare l'anta su cui è presente la maniglia /// @@ -80,6 +87,34 @@ namespace WebWindowComplex.Compo return 0; } + /// + /// Sollevo evento richiesta per cambiare tutti i Joint + /// + /// + private async Task ChangeAllJoints(Json.WindowConst.Joints JointType) + { + foreach(var item in CurrSashDim.JointList) + item.SetSelJointType(JointType); + await EC_UpdateSashDim.InvokeAsync(CurrSashDim); + } + + /// + /// Report aggiornamento joint + /// + /// + /// + private async Task UpdateJoint(Joint updRec) + { + // cerco il record + var currRec = CurrSashDim.JointList.FirstOrDefault(x => x.ParentArea == updRec.ParentArea && x.nIndex == updRec.nIndex); + // lo aggiorno + if (updRec != null) + { + currRec = updRec; + await EC_UpdateSashDim.InvokeAsync(CurrSashDim); + } + } + /// /// Sollevo evento per cambiare l'anta su cui è presente la maniglia /// @@ -98,16 +133,56 @@ namespace WebWindowComplex.Compo /// Sollevo evento per cambiare l'anta su cui è presente la maniglia ///
/// - private async Task RaiseCopyContentSash(Sash currSash, int indexC, int indexM) + private async Task RaiseCopyContentSash(int indexC, int indexM) { var Args = new DataCopyContentSash { - currItem = currSash, + currItem = CurrSashGroup, indexCopy = indexC, indexModify = indexM, }; await EC_CopyContentSash.InvokeAsync(Args); } + + private bool JointCollapsed { get; set; } = true; + + private async Task changeCollapsed() + { + JointCollapsed = !JointCollapsed; + } + + private string jointCollapsedIcon + { + get => JointCollapsed ? "↓" : "↑"; + } + + private string ButtonJointCss(WebWindowComplex.Json.WindowConst.Joints type) + { + foreach (var item in CurrSashDim.JointList) + { + if (!item.SelJointType.Equals(type)) + return "btn btn-outline-secondary btn-sm"; + } + return "btn btn-secondary btn-sm"; + } + + private enum ModeView + { + NULL = 0, + View = 1, + Edit = 2 + } + + private ModeView mode = ModeView.View; + private void doEdit() + { + mode = ModeView.Edit; + StateHasChanged(); + } + protected void ClosePopup() + { + mode = ModeView.View; + } } public class DataChangeHandle diff --git a/WebWindowComplex/Compo/CardFrame.razor b/WebWindowComplex/Compo/CardFrame.razor index 15ac48b..ea02118 100644 --- a/WebWindowComplex/Compo/CardFrame.razor +++ b/WebWindowComplex/Compo/CardFrame.razor @@ -21,14 +21,6 @@ { } - @* - - - - - - - *@
@@ -66,17 +58,17 @@
- +
- +
- +
diff --git a/WebWindowComplex/Compo/CardFrame.razor.cs b/WebWindowComplex/Compo/CardFrame.razor.cs index be02a74..162f3de 100644 --- a/WebWindowComplex/Compo/CardFrame.razor.cs +++ b/WebWindowComplex/Compo/CardFrame.razor.cs @@ -170,6 +170,16 @@ namespace WebWindowComplex.Compo } } + private string ButtonJointCss(WebWindowComplex.Json.WindowConst.Joints type) + { + foreach (var item in FrameWindow.JointList) + { + if (!item.SelJointType.Equals(type)) + return "btn btn-outline-secondary btn-sm"; + } + return "btn btn-secondary btn-sm"; + } + #endregion Private Methods } diff --git a/WebWindowComplex/Compo/CardSashGroup.razor b/WebWindowComplex/Compo/CardSashGroup.razor index 5077b35..53403ea 100644 --- a/WebWindowComplex/Compo/CardSashGroup.razor +++ b/WebWindowComplex/Compo/CardSashGroup.razor @@ -91,14 +91,16 @@ }
- - }
+ + +
+ @*
Joints
@@ -123,13 +125,41 @@ { } -
+
*@
+
+
+
Measure type
+
+
+
+ +
+
+
+ +@* + *@
+
+ +
+
@for (int i = 0; i < CurrItem.SashList.Count; i++) { @@ -137,6 +167,7 @@ CurrSashGroup="CurrItem" IndexSash="i" EC_ChangeHandle="ChangeHandle" + EC_UpdateSashDim="UpdateSashDimension" EC_CopyContentSash="CopyContentSash"> } diff --git a/WebWindowComplex/Compo/CardSashGroup.razor.cs b/WebWindowComplex/Compo/CardSashGroup.razor.cs index 534b447..cecba4b 100644 --- a/WebWindowComplex/Compo/CardSashGroup.razor.cs +++ b/WebWindowComplex/Compo/CardSashGroup.razor.cs @@ -20,11 +20,11 @@ namespace WebWindowComplex.Compo [Parameter] public Sash CurrItem { get; set; } = null!; - /// - /// Evento per cambiare tutti i Joints - /// - [Parameter] - public EventCallback EC_ChangeAllJoints { get; set; } + ///// + ///// Evento per cambiare tutti i Joints + ///// + //[Parameter] + //public EventCallback EC_ChangeAllJoints { get; set; } /// /// Evento per cambiare l'anta su cui è presente la maniglia @@ -116,24 +116,29 @@ namespace WebWindowComplex.Compo await EC_RemoveArea.InvokeAsync(currArea); } + protected async Task SetMeasureType(MeasureTypes type) + { + foreach(var item in CurrItem.SashList) + { + item.SetSelMeasureType(type); + } + await EC_UpdateSash.InvokeAsync(CurrItem); + } + + protected async Task UpdateSashDimension(SashDimension updateSD) + { + var currRec = CurrItem.SashList.Where(x => x.nSashId == updateSD.nSashId).FirstOrDefault(); + if(currRec != null) + { + currRec = updateSD; + await EC_UpdateSash.InvokeAsync(CurrItem); + } + } + #endregion Protected Methods #region Private Methods - /// - /// Sollevo evento richiesta per cambiare tutti i Joint - /// - /// - private async Task ChangeAllJoints(Json.WindowConst.Joints JointType, Area a) - { - var Args = new DataChangeJoints - { - currJointType = JointType, - currArea = a, - }; - await EC_ChangeAllJoints.InvokeAsync(Args); - } - /// /// Sollevo evento per cambiare l'anta su cui è presente la maniglia /// @@ -160,22 +165,22 @@ namespace WebWindowComplex.Compo _ = EC_ReqClose.InvokeAsync(true); } - /// - /// Report aggiornamento joint - /// - /// - /// - private async Task UpdateJoint(Joint updRec) - { - // cerco il record - var currRec = CurrItem.JointList.FirstOrDefault(x => x.ParentArea == updRec.ParentArea && x.nIndex == updRec.nIndex); - // lo aggiorno - if (updRec != null) - { - currRec = updRec; - await EC_UpdateSash.InvokeAsync(CurrItem); - } - } + ///// + ///// Report aggiornamento joint + ///// + ///// + ///// + //private async Task UpdateJoint(Joint updRec) + //{ + // // cerco il record + // var currRec = CurrItem.JointList.FirstOrDefault(x => x.ParentArea == updRec.ParentArea && x.nIndex == updRec.nIndex); + // // lo aggiorno + // if (updRec != null) + // { + // currRec = updRec; + // await EC_UpdateSash.InvokeAsync(CurrItem); + // } + //} /// /// Report aggiornamento Option Combo @@ -221,6 +226,16 @@ namespace WebWindowComplex.Compo await EC_CallFirstHwOpt.InvokeAsync(groupId); } + private string ButtonMeasureCss(MeasureTypes type) + { + foreach(var item in CurrItem.SashList) + { + if (!item.SelMeasureType.Equals(type)) + return "btn btn-outline-secondary btn-sm"; + } + return "btn btn-secondary btn-sm"; + } + #endregion Private Methods } } \ No newline at end of file diff --git a/WebWindowComplex/Json/JsonUtility.cs b/WebWindowComplex/Json/JsonUtility.cs index fef03b9..44983d1 100644 --- a/WebWindowComplex/Json/JsonUtility.cs +++ b/WebWindowComplex/Json/JsonUtility.cs @@ -311,19 +311,19 @@ namespace WebWindowComplex.Json } } - private List m_JointList = new List(); - [JsonProperty] - public List JointList - { - get - { - return m_JointList; - } - set - { - m_JointList = value; - } - } + //private List m_JointList = new List(); + //[JsonProperty] + //public List JointList + //{ + // get + // { + // return m_JointList; + // } + // set + // { + // m_JointList = value; + // } + //} private bool m_bBottomRail; [JsonProperty] @@ -410,9 +410,11 @@ namespace WebWindowComplex.Json newSash.SashList[SashIndex].SetHasHandle(m_SashList[SashIndex].HasHandle); newSash.SashList[SashIndex].SetDimension(m_SashList[SashIndex].Dimension); newSash.SashList[SashIndex].SetMeasureType(m_SashList[SashIndex].MeasureType); + foreach (var Joint in m_SashList[SashIndex].JointList) + newSash.SashList[SashIndex].JointList.Add(Joint.Deserialize((Area)ParentArea)); } - foreach (var Joint in m_JointList) - newSash.JointList.Add(Joint.Deserialize((Area)ParentArea)); + //foreach (var Joint in m_JointList) + // newSash.JointList.Add(Joint.Deserialize((Area)ParentArea)); newSash.SetSelFamilyHardwareFromIndex(Hardware); newSash.ReqRefreshShape(); newSash.SetSelHardwareFromId(Hardware); @@ -780,6 +782,20 @@ namespace WebWindowComplex.Json } } + private double m_dDimension; + [JsonProperty] + public double Dimension + { + get + { + return m_dDimension; + } + set + { + m_dDimension = value; + } + } + private bool m_bHasHandle; [JsonProperty] public bool HasHandle @@ -794,17 +810,17 @@ namespace WebWindowComplex.Json } } - private double m_dDimension; + private List m_JointList = new List(); [JsonProperty] - public double Dimension + public List JointList { get { - return m_dDimension; + return m_JointList; } set { - m_dDimension = value; + m_JointList = value; } } diff --git a/WebWindowComplex/Models/FrameDimension.cs b/WebWindowComplex/Models/FrameDimension.cs index 2a71c14..9636022 100644 --- a/WebWindowComplex/Models/FrameDimension.cs +++ b/WebWindowComplex/Models/FrameDimension.cs @@ -42,8 +42,8 @@ namespace WebWindowComplex.Models { m_dValue = MinDim; } - //if(ParentFrame.AreaList.Count > 0) - // SearchAreaList(ParentFrame); + if (ParentFrame.AreaList.Count > 0) + SearchAreaList(ParentFrame); m_ParentFrame.ParentWindow.OnUpdatePreview(m_ParentFrame.ParentWindow.sSerialized()); } } @@ -80,110 +80,79 @@ namespace WebWindowComplex.Models /// Cerca nell'albero gli oggetti Sash e Split per associare la larghezza /// /// - //protected void SearchAreaList(Area node) - //{ - // if (node != null) - // { - // if(node.AreaType.Equals(AreaTypes.SASH)) - // calculateWidth((Sash)node); - // else if(node.AreaType.Equals(AreaTypes.SPLIT)) - // calculateWidth((Split)node); - // foreach (var item in node.AreaList) - // { - // SearchAreaList(item); - // } - // } - //} + protected void SearchAreaList(Area node) + { + if (node != null) + { + if (node.AreaType.Equals(AreaTypes.SASH)) + calculateWidth((Sash)node); + else if (node.AreaType.Equals(AreaTypes.SPLIT)) + calculateWidth((Split)node); + foreach (var item in node.AreaList) + { + SearchAreaList(item); + } + } + } - /// - /// Ricalcolo larghezza Sash e SPlit - /// - /// - //protected void calculateWidth(Area area) - //{ - // if (area is Sash) - // { - // Sash sash = (Sash)area; - // if (area.ParentArea is Frame) - // { - // Frame frame = (Frame)area.ParentArea; - // sash.Width = (frame.DimensionList.Where(x => x.sName == "Width").FirstOrDefault())!.dValue; - // } - // else if (sash.ParentArea.ParentArea is Split) - // { - // Split split = (Split)sash.ParentArea.ParentArea; - // if (split.SplitVertList.Count > 0) - // { - // int indexSplit = 0; - // for (int i = 0; i < split.AreaList.Count; i++) - // { - // if (split.AreaList.ElementAt(i).AreaList.First().Equals(sash)) - // indexSplit = i; - // } - // switch (split.SplitVertList.ElementAt(indexSplit).MeasureType) - // { - // case MeasureTypes.ABSOLUT: - // { - // sash.Width = split.SplitVertList.ElementAt(indexSplit).dDimension; - // break; - // } - // case MeasureTypes.PROPORTIONAL: - // { - // /// TO DO!!!!! - // break; - // } - // case MeasureTypes.PERCENTAGE: - // { - // sash.Width = split.SplitVertList.ElementAt(indexSplit).dDimension / 100 * split.Width; - // break; - // } - // } - // } - // else - // { - // Frame frame = (Frame)sash.ParentWindow.AreaList[0]; - // sash.Width = (frame.DimensionList.Where(x => x.sName == "Width").FirstOrDefault())!.dValue; - // } - // } - // } - // else if (area is Split) - // { - // Split split = (Split)area; - // if (area.ParentArea is Frame) - // { - // Frame frame = (Frame)area.ParentArea; - // split.Width = (frame.DimensionList.Where(x => x.sName == "Width").FirstOrDefault())!.dValue; - // } - // else if (split.ParentArea.ParentArea is Sash) - // { - // Sash sash = (Sash)split.ParentArea.ParentArea; - // int indexSash = 0; - // for (int i = 0; i < sash.AreaList.Count; i++) - // { - // if (sash.AreaList.ElementAt(i).AreaList.First().Equals(split)) - // indexSash = i; - // } - // switch (sash.SashList.ElementAt(indexSash).MeasureType) - // { - // case MeasureTypes.ABSOLUT: - // { - // split.Width = sash.SashList.ElementAt(indexSash).dDimension; - // break; - // } - // case MeasureTypes.PROPORTIONAL: - // { - // /// TO DO!!!!! - // break; - // } - // case MeasureTypes.PERCENTAGE: - // { - // split.Width = sash.SashList.ElementAt(indexSash).dDimension / 100 * sash.Width; - // break; - // } - // } - // } - // } - //} + protected void calculateWidth(Area area) + { + if(area is Sash && sName.Equals("Width")) + { + Sash sash = (Sash)area; + int countAbsolute = sash.SashList.Where(x => x.MeasureType.Equals(MeasureTypes.ABSOLUT)).Count(); + if(countAbsolute == sash.SashList.Count) + { + double sum = sash.SashList.Sum(x => x.dDimension); + double res = dValue - sum; + if(res > 0) + { + foreach (var sashDim in sash.SashList) + { + sashDim.SetDimension(sashDim.dDimension + res / countAbsolute); + } + } + else + { + foreach (var sashDim in sash.SashList) + { + // Sommo perchè res è negativo + sashDim.SetDimension(sashDim.dDimension + res / countAbsolute); + } + } + } + } + else if(area is Split) + { + Split split = (Split)area; + List splitList = null; + if (sName.Equals("Width")) + splitList = split.SplitVertList; + else + splitList = split.SplitHorizList; + int countAbsolute = splitList.Where(x => x.MeasureType.Equals(MeasureTypes.ABSOLUT)).Count(); + if (countAbsolute != 0 && countAbsolute == splitList.Count) + { + double sum = splitList.Sum(x => x.dDimension); + double res = dValue - sum; + if (res > 0) + { + foreach (var sashDim in splitList) + { + sashDim.SetDimension(sashDim.dDimension + res / countAbsolute); + } + } + else + { + foreach (var sashDim in splitList) + { + // Sommo perchè res è negativo + sashDim.SetDimension(sashDim.dDimension + res / countAbsolute); + } + } + } + } + } internal JsonFrameDimension Serialize() { diff --git a/WebWindowComplex/Models/Sash.cs b/WebWindowComplex/Models/Sash.cs index 0255e20..8fba15b 100644 --- a/WebWindowComplex/Models/Sash.cs +++ b/WebWindowComplex/Models/Sash.cs @@ -34,52 +34,6 @@ namespace WebWindowComplex.Models #region Public Properties - ///// - ///// Larghezza gruppo ante - ///// - //public double Width - //{ - // get - // { - // return m_Width; - // } - // set - // { - // if (m_Width != value && m_Width != 0) - // { - // // Se larghezza aumentata - // if (SashList.Sum(x => x.CalculateAbsolutValue(m_Width)) < value) - // { - // if (SashList.Where(x => x.MeasureType.Equals(MeasureTypes.PROPORTIONAL)).ToList().Count == 0 && - // SashList.Where(x => x.MeasureType.Equals(MeasureTypes.PERCENTAGE)).ToList().Count != SashList.Count) - // { - // double res = value - m_Width; - // foreach (var item in SashList) - // item.SetDimension(item.ConvertIn(item.CalculateAbsolutValue(m_Width) + res / SashList.Count, (MeasureTypes)item.SelMeasureTypeIndex, value)); - // } - // } - // // Larghezza diminuita - // else if (SashList.Sum(x => x.CalculateAbsolutValue(m_Width)) > value) - // { - // if (SashList.Where(x => x.MeasureType.Equals(MeasureTypes.PROPORTIONAL)).ToList().Count == 0 && - // SashList.Where(x => x.MeasureType.Equals(MeasureTypes.PERCENTAGE)).ToList().Count != SashList.Count) - // { - // double res = m_Width - value; - // foreach (var item in SashList) - // item.SetDimension(item.ConvertIn(item.CalculateAbsolutValue(m_Width) - res / SashList.Count, (MeasureTypes)item.SelMeasureTypeIndex, value)); - // } - // } - // m_Width = value; - // m_ParentWindow.OnUpdatePreview(m_ParentWindow.sSerialized()); - // } - // else - // { - // m_Width = value; - // m_ParentWindow.OnUpdatePreview(m_ParentWindow.sSerialized()); - // } - // } - //} - public bool bIsMeasureGlass { get @@ -92,14 +46,6 @@ namespace WebWindowComplex.Models } } - //public bool bIsPercentage - //{ - // get - // { - // return m_bIsPercentage; - // } - //} - public bool bIsSashVertical { get @@ -136,17 +82,17 @@ namespace WebWindowComplex.Models } } - public List JointList - { - get - { - return m_JointList; - } - set - { - m_JointList = value; - } - } + //public List JointList + //{ + // get + // { + // return m_JointList; + // } + // set + // { + // m_JointList = value; + // } + //} public int nSashQty { @@ -158,11 +104,12 @@ namespace WebWindowComplex.Models { if (value > 0 && value <= 3) { + double widthTot = CalculateWidthSashGroup(ParentWindow.AreaList.First(), ParentWindow.AreaList.FirstOrDefault().DimensionList.Where(x => x.sName == "Width").First().dValue); if (value > m_SashList.Count) { // recupero larghezza ultimo - double dLastDimension = 100; - double dNewDimension = 100; + double dLastDimension = widthTot; + double dNewDimension = widthTot; if (m_SashList.Count > 0) { dLastDimension = m_SashList[m_SashList.Count - 1].dDimension; @@ -174,7 +121,12 @@ namespace WebWindowComplex.Models // aggiungo area Sash di default for (var SplitIndex = m_SashList.Count; SplitIndex <= value - 1; SplitIndex++) { - SashList.Add(new SashDimension(dNewDimension, m_SashList[m_SashList.Count - 1].MeasureType, this, SplitIndex + 1)); + var addSashDim = new SashDimension(dNewDimension, m_SashList[m_SashList.Count - 1].MeasureType, this, SplitIndex + 1); + for(int i = 1; i <= 4; i++) + { + addSashDim.JointList.Add(new Joint(this, i, Joints.FULL_H)); + } + SashList.Add(addSashDim); } } else if (value < m_SashList.Count) @@ -189,7 +141,6 @@ namespace WebWindowComplex.Models itemDelete = m_SashList[SplitIndex]; SashList.RemoveAt(SplitIndex); } - double widthTot = CalculateWidthSashGroup(ParentWindow.AreaList.First(), ParentWindow.AreaList.FirstOrDefault().DimensionList.Where(x => x.sName == "Width").First().dValue); double deleteDim = itemDelete.ConvertDimension(itemDelete.SelMeasureType, m_SashList[SashList.Count - 1].SelMeasureType, widthTot); //dLastDimension += m_SashList[SashList.Count - 1].dDimension; dLastDimension = deleteDim + m_SashList[SashList.Count - 1].dDimension; @@ -473,11 +424,11 @@ namespace WebWindowComplex.Models SashDimension newSashDim = SashList[i].Copy(); newSash.SashList.Insert(i, newSashDim); } - foreach (var item in JointList) - { - Joint newJoint = item.Copy(); - newSash.JointList.Add(newJoint); - } + //foreach (var item in JointList) + //{ + // Joint newJoint = item.Copy(); + // newSash.JointList.Add(newJoint); + //} foreach (var item in AreaList) { Area newArea = item.Copy(newSash); @@ -602,12 +553,20 @@ namespace WebWindowComplex.Models #endregion Public Methods #region Internal Methods + + /// + /// Metodo per calcolare larghezza intera sash group + /// + /// area di partenza + /// larghezza di partenza + /// internal double CalculateWidthSashGroup(Area area, double width) { - if (area.Equals(this)) - return width; for (int i = 0; i < area.AreaList.Count; i++) { + double risultato = -1; + if (area.Equals(this)) + return width; Area item = area.AreaList[i]; if (area is Split) { @@ -616,20 +575,22 @@ namespace WebWindowComplex.Models { case MeasureTypes.ABSOLUT: { - CalculateWidthSashGroup(item, split.SplitVertList.ElementAt(i).dDimension); + risultato = CalculateWidthSashGroup(item, split.SplitVertList.ElementAt(i).dDimension); break; } case MeasureTypes.PROPORTIONAL: { - //CalculateWidthSashGroup(item, split.SplitVertList.ElementAt(i).dDimension); + //risultato = CalculateWidthSashGroup(item, split.SplitVertList.ElementAt(i).dDimension); break; } case MeasureTypes.PERCENTAGE: { - CalculateWidthSashGroup(item, split.SplitVertList.ElementAt(i).dDimension * width / 100); + risultato = CalculateWidthSashGroup(item, split.SplitVertList.ElementAt(i).dDimension * width / 100); break; } } + if (risultato != -1) + return risultato; } else if (area is Sash) { @@ -638,27 +599,31 @@ namespace WebWindowComplex.Models { case MeasureTypes.ABSOLUT: { - CalculateWidthSashGroup(item, sash.SashList.ElementAt(i).dDimension); + risultato = CalculateWidthSashGroup(item, sash.SashList.ElementAt(i).dDimension); break; } case MeasureTypes.PROPORTIONAL: { - //CalculateWidthSashGroup(item, sash.SashList.ElementAt(i).dDimension); + //risultato = CalculateWidthSashGroup(item, sash.SashList.ElementAt(i).dDimension); break; } case MeasureTypes.PERCENTAGE: { - CalculateWidthSashGroup(item, sash.SashList.ElementAt(i).dDimension * width / 100); + risultato = CalculateWidthSashGroup(item, sash.SashList.ElementAt(i).dDimension * width / 100); break; } } + if (risultato != -1) + return risultato; } else { - CalculateWidthSashGroup(item, width); + risultato = CalculateWidthSashGroup(item, width); + if (risultato != -1) + return risultato; } } - return -1; + return width; } internal static Sash CreateSash(Area Area) { @@ -669,8 +634,13 @@ namespace WebWindowComplex.Models newSash.SetSashQty(1); newSash.SetOrientationSashType(OrientationSash.VERTICAL); newSash.SetIsSashVertical(true); - for (var JointIndex = 0; JointIndex <= 3; JointIndex++) - newSash.JointList.Add(new Joint(newSash, JointIndex + 1, Joints.FULL_H)); + foreach(var sashDim in newSash.SashList) + { + for (var JointIndex = 0; JointIndex <= 3; JointIndex++) + sashDim.JointList.Add(new Joint(newSash, JointIndex + 1, Joints.FULL_H)); + } + //for (var JointIndex = 0; JointIndex <= 3; JointIndex++) + // newSash.JointList.Add(new Joint(newSash, JointIndex + 1, Joints.FULL_H)); newSash.SetSashBottomRail(false); newSash.SetSashBottomRailQty(0); newSash.SetSelFamilyHardware(Sash.s_FamilyHardwareList.First()); @@ -773,8 +743,8 @@ namespace WebWindowComplex.Models JsonSash JsonSash = new JsonSash(m_bIsSashVertical, m_SashType, m_bSashBottomRail, m_nSashBottomRailQty, currHwId, GroupId); foreach (var SashDimension in SashList) JsonSash.SashList.Add(SashDimension.Serialize()); - foreach (var Joint in JointList) - JsonSash.JointList.Add(Joint.Serialize()); + //foreach (var Joint in JointList) + // JsonSash.JointList.Add(Joint.Serialize()); if(HwOptionList.Count > 0) { foreach (var HwOption in HwOptionList) @@ -912,7 +882,12 @@ namespace WebWindowComplex.Models dNewDimension = dLastDimension / (Qty + 1 - nSashQty); // aggiungo area Sash di default for (var SplitIndex = m_SashList.Count; SplitIndex <= Qty - 1; SplitIndex++) - SashList.Add(new SashDimension(dNewDimension, MeasureTypes.PERCENTAGE, this, SplitIndex + 1)); + { + SashDimension newSashDim = new SashDimension(dNewDimension, MeasureTypes.PERCENTAGE, this, SplitIndex + 1); + //for (var JointIndex = 0; JointIndex <= 3; JointIndex++) + // newSashDim.JointList.Add(new Joint(this, JointIndex + 1, Joints.FULL_H)); + SashList.Add(newSashDim); + } } else if (Qty < m_SashList.Count) { @@ -982,7 +957,7 @@ namespace WebWindowComplex.Models private List m_HwdOptionList = new List(); private Dictionary m_SelHwdOptionList = new Dictionary(); - private List m_JointList = new List(); + //private List m_JointList = new List(); private int m_nSashBottomRailQty; diff --git a/WebWindowComplex/Models/SashDimension.cs b/WebWindowComplex/Models/SashDimension.cs index 16161f3..9058f22 100644 --- a/WebWindowComplex/Models/SashDimension.cs +++ b/WebWindowComplex/Models/SashDimension.cs @@ -1,4 +1,5 @@ -using System.Security.Principal; +using System.Runtime.InteropServices; +using System.Security.Principal; using WebWindowComplex.Json; using static WebWindowComplex.Json.WindowConst; @@ -105,7 +106,19 @@ namespace WebWindowComplex.Models //m_Parent.ParentWindow.OnUpdatePreview(m_Parent.ParentWindow.sSerialized()); } } - + + public List JointList + { + get + { + return m_JointList; + } + set + { + m_JointList = value; + } + } + public double dDimension { get @@ -115,7 +128,7 @@ namespace WebWindowComplex.Models set { double widthTot = CalculateWidthSashGroup(m_Parent.ParentWindow.AreaList.FirstOrDefault(), m_Parent.ParentWindow.AreaList.FirstOrDefault().DimensionList.Where(x => x.sName == "Width").First().dValue); - double valMinAbsolut = 100; + double valMinAbsolut = 200; double valMaxAbsolut = widthTot - valMinAbsolut * (m_Parent.SashList.Count - 1); bool valueAccept = false; switch (MeasureType) @@ -265,69 +278,8 @@ namespace WebWindowComplex.Models item.SetDimension(ConvertIn(absolutValList[i], (MeasureTypes)item.SelMeasureTypeIndex, widthTot)); } } - m_Parent.ParentWindow.OnUpdatePreview(m_Parent.ParentWindow.sSerialized()); } - - //// se sono in percentuale - //if (m_MeasureType.Equals(MeasureTypes.PERCENTAGE)) - //{ - // // Controllo che il valore inserito sia compreso tra 0 e 100 - // if (value > 0 && value < 100) - // { - // // verifico se ci sono altri in percentuale - // List RelativeDimList = m_Parent.SashList.Where(x => x.MeasureType.Equals(MeasureTypes.PERCENTAGE)).ToList(); - // if (RelativeDimList.Count > 0) - // { - // int nIndex = RelativeDimList.IndexOf(this); - // // se diminuisce dimensione - // if (value < m_dDimension) - // { - // if (nIndex < RelativeDimList.Count - 1) - // RelativeDimList[nIndex + 1].SetDimension(RelativeDimList[nIndex + 1].dDimension + (m_dDimension - value)); - // else if (RelativeDimList.Count > 1) - // RelativeDimList[nIndex - 1].SetDimension(RelativeDimList[nIndex - 1].dDimension + (m_dDimension - value)); - // else - // { - // m_dDimension = 100; - // return; - // } - // } - // // se aumenta dimensione - // else - // { - // double dRes = value; - // // se non ultima anta - // if (nIndex < RelativeDimList.Count - 1) - // { - // for (var nInd = 0; nInd <= nIndex - 1; nInd++) - // dRes += RelativeDimList[nInd].dDimension; - // dRes = (100 - dRes) / (RelativeDimList.Count - nIndex - 1); - // for (var Ind = nIndex + 1; Ind <= RelativeDimList.Count - 1; Ind++) - // RelativeDimList[Ind].SetDimension(dRes); - // } - // // se ultima anta - // else if (RelativeDimList.Count > 1) - // { - // if (RelativeDimList.Count > 2) - // { - // for (var Ind = 0; Ind <= nIndex - 2; Ind++) - // dRes += RelativeDimList[Ind].dDimension; - // } - // dRes = (100 - dRes); - // RelativeDimList[nIndex - 1].SetDimension(dRes); - // } - // else - // { - // m_dDimension = 100; - // return; - // } - // } - // } - // } - // m_dDimension = value; - // m_Parent.ParentWindow.OnUpdatePreview(m_Parent.ParentWindow.sSerialized()); - //} } } @@ -379,7 +331,6 @@ namespace WebWindowComplex.Models } set { - //Openings newOpening = (Openings)IdNameStruct.IdFromInd(value, m_OpeningTypeList); Openings newOpening = (Openings)value; if ((newOpening != Openings.TILTTURN_LEFT && newOpening != Openings.TILTTURN_RIGHT) || (newOpening == Openings.TILTTURN_LEFT && m_bHasHandle) || @@ -506,6 +457,11 @@ namespace WebWindowComplex.Models newSashDim.SetMeasureType(MeasureType); newSashDim.SetOpeningType(SelOpeningType); newSashDim.SetHasHandle(bHasHandle); + foreach (var item in JointList) + { + Joint newJoint = item.Copy(); + newSashDim.JointList.Add(newJoint); + } return newSashDim; } @@ -513,6 +469,12 @@ namespace WebWindowComplex.Models #region Internal Methods + /// + /// Metodo per calcolare larghezza intera sash group + /// + /// area di partenza + /// larghezza di partenza + /// internal double CalculateWidthSashGroup(Area area, double width) { for(int i = 0; i < area.AreaList.Count; i++) @@ -579,30 +541,65 @@ namespace WebWindowComplex.Models return width; } - internal JsonSashDimension Serialize() + /// + /// Calcolo MCD + /// + /// + /// + /// + internal static double CalculateMCD(double a, double b) { - JsonSashDimension JsonSashDimension = new JsonSashDimension(OpeningType, MeasureType, m_bHasHandle, m_dDimension, m_nSashId); - return JsonSashDimension; + while (b >= 0.01) + { + double temp = b; + b = a % b; + a = temp; + } + //return Double.Round(a,2); + return a; } - internal void SetDimension(double dValue) + /// + /// Metodo per ricalcolare i valori proporzionali a causa della modifica di uno + /// + /// + internal double CalculatePropVal(double widthTot) { - m_dDimension = dValue; - } - - internal void SetHasHandle(bool value) - { - m_bHasHandle = value; - } - - internal void SetOpeningType(Openings value) - { - m_SelOpeningType = value; - } - - internal void SetMeasureType(MeasureTypes value) - { - m_SelMeasureType = value; + if (m_Parent.SashList.Where(m => m.MeasureType.Equals(MeasureTypes.PROPORTIONAL)).ToList().Count == 0) + { + return 1; + } + List absolutValue = new List(); + foreach (var item in m_Parent.SashList) + { + absolutValue.Add(item.CalculateAbsolutValue(widthTot)); + } + for (int i = 0; i < m_Parent.SashList.Count; i++) + { + if (!m_Parent.SashList.ElementAt(i).Equals(this) && + m_Parent.SashList.ElementAt(i).MeasureType.Equals(MeasureTypes.PROPORTIONAL)) + { + int nIndex = m_Parent.SashList.IndexOf(this); + if (absolutValue.ElementAt(nIndex) <= absolutValue.ElementAt(i)) + { + var mcd = CalculateMCD(absolutValue.ElementAt(nIndex), absolutValue.ElementAt(i)); + //m_Parent.SashList.ElementAt(i).m_dDimension = Double.Round(absolutValue.ElementAt(i) / mcd, 2); + //m_dDimension = Double.Round(absolutValue.ElementAt(nIndex) / mcd, 2); + m_Parent.SashList.ElementAt(i).m_dDimension = absolutValue.ElementAt(i) / mcd; + m_dDimension = absolutValue.ElementAt(nIndex) / mcd; + } + else + { + var mcd = CalculateMCD(absolutValue.ElementAt(nIndex), absolutValue.ElementAt(i)); + //m_Parent.SashList.ElementAt(i).m_dDimension = Double.Round(absolutValue.ElementAt(i) / mcd, 2); + //m_dDimension = Double.Round(absolutValue.ElementAt(nIndex) / mcd, 2); + m_Parent.SashList.ElementAt(i).m_dDimension = absolutValue.ElementAt(i) / mcd; + m_dDimension = absolutValue.ElementAt(nIndex) / mcd; + } + break; + } + } + return m_dDimension; } /// @@ -610,7 +607,7 @@ namespace WebWindowComplex.Models /// /// Larghezza totale /// - public double CalculateAbsolutValue(double widthTot) + internal double CalculateAbsolutValue(double widthTot) { switch (MeasureType) { @@ -640,7 +637,7 @@ namespace WebWindowComplex.Models /// Tipo di misura della dimensione /// Larghezza totale /// - public double ConvertIn(double absolutVal, MeasureTypes type, double widthTot) + internal double ConvertIn(double absolutVal, MeasureTypes type, double widthTot) { switch (type) { @@ -682,7 +679,7 @@ namespace WebWindowComplex.Models var proportionalList = m_Parent.SashList .Where(m => m.SelMeasureType == MeasureTypes.PROPORTIONAL) .ToList(); - + double sumPesi = proportionalList.Sum(p => p.dDimension); if (sumPesi == 0) sumPesi = 1; if (newType.Equals(MeasureTypes.ABSOLUT)) @@ -694,9 +691,9 @@ namespace WebWindowComplex.Models return (res / sumPesi * dDimension) / tot * 100; } } - + /// - /// Metodo per calcolare il valore proporzionale + /// Metodo per trasformare il valore proporzionale in assoluto /// /// internal double Proportional2AbsolutVal(double widthTot) @@ -715,68 +712,47 @@ namespace WebWindowComplex.Models .ToList(); double sumPesi = proportionalList.Sum(p => p.dDimension); if (sumPesi == 0) sumPesi = 1; - return res / sumPesi*dDimension; + return res / sumPesi * dDimension; } - /// - /// Calcolo MCD - /// - /// - /// - /// - internal static double CalcolaMCD(double a, double b) + internal JsonSashDimension Serialize() { - while (b >= 0.01) - { - double temp = b; - b = a % b; - a = temp; - } - //return Double.Round(a,2); - return a; + JsonSashDimension JsonSashDimension = new JsonSashDimension(OpeningType, MeasureType, m_bHasHandle, m_dDimension, m_nSashId); + foreach (var Joint in JointList) + JsonSashDimension.JointList.Add(Joint.Serialize()); + return JsonSashDimension; } - /// - /// Metodo per ricalcolare i valori proporzionali a causa della modifica di uno - /// - /// - internal double CalculatePropVal(double widthTot) + internal void SetDimension(double dValue) { - if(m_Parent.SashList.Where(m => m.MeasureType.Equals(MeasureTypes.PROPORTIONAL)).ToList().Count == 0) + m_dDimension = dValue; + } + + internal void SetHasHandle(bool value) + { + m_bHasHandle = value; + } + + internal void SetOpeningType(Openings value) + { + m_SelOpeningType = value; + } + + internal void SetMeasureType(MeasureTypes value) + { + m_SelMeasureType = value; + } + + internal void SetSelMeasureType(MeasureTypes value) + { + if (m_SelMeasureType != (MeasureTypes)value) { - return 1; + MeasureTypes newType = (MeasureTypes)value; + double widthTot = CalculateWidthSashGroup(m_Parent.ParentWindow.AreaList.FirstOrDefault(), m_Parent.ParentWindow.AreaList.FirstOrDefault().DimensionList.Where(x => x.sName == "Width").First().dValue); + m_dDimension = ConvertDimension(m_SelMeasureType, newType, widthTot); + m_SelMeasureType = (MeasureTypes)value; + //m_Parent.ParentWindow.OnUpdatePreview(m_Parent.ParentWindow.sSerialized()); } - List absolutValue = new List(); - foreach (var item in m_Parent.SashList) - { - absolutValue.Add(item.CalculateAbsolutValue(widthTot)); - } - for(int i = 0; i < m_Parent.SashList.Count; i++) - { - if(!m_Parent.SashList.ElementAt(i).Equals(this) && - m_Parent.SashList.ElementAt(i).MeasureType.Equals(MeasureTypes.PROPORTIONAL)) - { - int nIndex = m_Parent.SashList.IndexOf(this); - if (absolutValue.ElementAt(nIndex) <= absolutValue.ElementAt(i)) - { - var mcd = CalcolaMCD(absolutValue.ElementAt(nIndex), absolutValue.ElementAt(i)); - //m_Parent.SashList.ElementAt(i).m_dDimension = Double.Round(absolutValue.ElementAt(i) / mcd, 2); - //m_dDimension = Double.Round(absolutValue.ElementAt(nIndex) / mcd, 2); - m_Parent.SashList.ElementAt(i).m_dDimension = absolutValue.ElementAt(i) / mcd; - m_dDimension = absolutValue.ElementAt(nIndex) / mcd; - } - else - { - var mcd = CalcolaMCD(absolutValue.ElementAt(nIndex), absolutValue.ElementAt(i)); - //m_Parent.SashList.ElementAt(i).m_dDimension = Double.Round(absolutValue.ElementAt(i) / mcd, 2); - //m_dDimension = Double.Round(absolutValue.ElementAt(nIndex) / mcd, 2); - m_Parent.SashList.ElementAt(i).m_dDimension = absolutValue.ElementAt(i) / mcd; - m_dDimension = absolutValue.ElementAt(nIndex) / mcd; - } - break; - } - } - return m_dDimension; } #endregion Internal Methods @@ -828,6 +804,8 @@ namespace WebWindowComplex.Models // reference private Sash m_Parent; + private List m_JointList = new List(); + private Openings m_SelOpeningType; private MeasureTypes m_SelMeasureType; diff --git a/WebWindowComplex/Models/SplitDimension.cs b/WebWindowComplex/Models/SplitDimension.cs index d31d81c..fef0c3b 100644 --- a/WebWindowComplex/Models/SplitDimension.cs +++ b/WebWindowComplex/Models/SplitDimension.cs @@ -49,80 +49,237 @@ namespace WebWindowComplex.Models } set { - // Controllo che il valore inserito sia compreso tra 0 e 100 - if (value > 0 && value < 100) + double widthTot = CalculateWidthSplitGroup(m_Parent.ParentWindow.AreaList.FirstOrDefault(), m_Parent.ParentWindow.AreaList.FirstOrDefault().DimensionList.Where(x => x.sName == "Width").First().dValue); + List dimensions = null; + if (bIsVertListDim) + dimensions = m_Parent.SplitVertList; + else + dimensions = m_Parent.SplitHorizList; + double valMinAbsolut = 100; + double valMaxAbsolut = widthTot - valMinAbsolut * (dimensions.Count - 1); + bool valueAccept = false; + switch (MeasureType) { - // se sono in percentuale - if (m_bIsRelative) - { - List RelativeDimList = new List(); - if (bIsVertListDim) - RelativeDimList = m_Parent.SplitVertList.Where(x => x.bIsRelative).ToList(); - else - RelativeDimList = m_Parent.SplitHorizList.Where(x => x.bIsRelative).ToList(); - // verifico se ci sono assoluti - //List RelativeDimList = m_Parent.SplitPositionList.Where(x => x.bIsRelative).ToList(); - if (RelativeDimList.Count > 0) + case MeasureTypes.ABSOLUT: { - if (m_Parent.bIsPercentage) + valueAccept = (value < valMaxAbsolut && value > valMinAbsolut) ? true : false; + break; + } + case MeasureTypes.PROPORTIONAL: + { + valMaxAbsolut = 20; + valueAccept = (value > 1) ? true : false; + break; + } + case MeasureTypes.PERCENTAGE: + { + valMaxAbsolut = valMaxAbsolut / widthTot * 100; + valMinAbsolut = valMinAbsolut / widthTot * 100; + valueAccept = (value < valMaxAbsolut && value > valMinAbsolut) ? true : false; + break; + } + } + if (valueAccept) + { + List absolutValList = new List(); + foreach (var item in dimensions) + { + absolutValList.Add(item.CalculateAbsolutValue(widthTot, dimensions)); + } + int nIndex = dimensions.IndexOf(this); + int proportionalCount = dimensions.Where(x => x.MeasureType.Equals(MeasureTypes.PROPORTIONAL)).ToList().Count; + int percentageCount = dimensions.Where(x => x.MeasureType.Equals(MeasureTypes.PERCENTAGE)).ToList().Count; + // Le dimensioni sono solo in proporzionale + if (proportionalCount == absolutValList.Count) + { + m_dDimension = value; + } + // Le dimensioni sono solo in percentuale + else if (percentageCount == dimensions.Count) + { + if (value < dDimension) + { + // L'anta modificata non è l'ultima + if (nIndex < dimensions.Count - 1) + dimensions[nIndex + 1].SetDimension(dimensions[nIndex + 1].dDimension + (m_dDimension - value)); + else if (dimensions.Count > 1) + dimensions[nIndex - 1].SetDimension(dimensions[nIndex - 1].dDimension + (m_dDimension - value)); + else { - int nIndex = RelativeDimList.IndexOf(this); - if (value < m_dDimension) + m_dDimension = 100; + return; + } + } + else + { + double dRes = value; + // se non ultima anta + if (nIndex < dimensions.Count - 1) + { + for (var nInd = 0; nInd <= nIndex - 1; nInd++) + dRes += dimensions[nInd].dDimension; + dRes = (100 - dRes) / (dimensions.Count - nIndex - 1); + for (var Ind = nIndex + 1; Ind <= dimensions.Count - 1; Ind++) + dimensions[Ind].SetDimension(dRes); + } + // se ultima anta + else if (dimensions.Count > 1) + { + if (dimensions.Count > 2) { - if (nIndex < RelativeDimList.Count - 1) - RelativeDimList[nIndex + 1].SetDimension(RelativeDimList[nIndex + 1].dDimension + (m_dDimension - value)); - else if (RelativeDimList.Count > 1) - RelativeDimList[nIndex - 1].SetDimension(RelativeDimList[nIndex - 1].dDimension + (m_dDimension - value)); - else - { - m_dDimension = 100; - return; - } - } - else - { - double dRes = value; - if (nIndex < RelativeDimList.Count - 1) - { - for (var nInd = 0; nInd <= nIndex - 1; nInd++) - dRes += RelativeDimList[nInd].dDimension; - dRes = (100 - dRes) / (RelativeDimList.Count - nIndex - 1); - if (dRes != 0) - { - for (var Ind = nIndex + 1; Ind <= RelativeDimList.Count - 1; Ind++) - RelativeDimList[Ind].SetDimension(dRes); - } - else - return; - } - else if (RelativeDimList.Count > 1) - { - if (RelativeDimList.Count > 2) - { - for (var Ind = 0; Ind <= nIndex - 2; Ind++) - dRes += RelativeDimList[Ind].dDimension; - } - dRes = (100 - dRes); - if (dRes != 0) - RelativeDimList[nIndex - 1].SetDimension(dRes); - else - return; - } - else - { - m_dDimension = 100; - return; - } + for (var Ind = 0; Ind <= nIndex - 2; Ind++) + dRes += dimensions[Ind].dDimension; } + dRes = (100 - dRes); + dimensions[nIndex - 1].SetDimension(dRes); } else { + m_dDimension = 100; + return; } } + m_dDimension = value; + } + // Le dimensioni sono miste o solo in assoluto + else + { + double valueInAbsolute = 0; + switch (MeasureType) + { + case MeasureTypes.ABSOLUT: + { + valueInAbsolute = value; + break; + } + case MeasureTypes.PROPORTIONAL: + { + var pesi = value + dimensions + .Where(x => x.MeasureType.Equals(MeasureTypes.PROPORTIONAL) && !x.Equals(this)) + .Sum(x => x.m_dDimension); + valueInAbsolute = widthTot / pesi * value; + break; + } + case MeasureTypes.PERCENTAGE: + { + valueInAbsolute = (value / 100) * widthTot; + break; + } + } + if (value < dDimension) + { + // L'anta modificata non è l'ultima + if (nIndex < absolutValList.Count - 1) + { + absolutValList[nIndex + 1] = absolutValList[nIndex + 1] + (absolutValList[nIndex] - valueInAbsolute); + absolutValList[nIndex] = valueInAbsolute; + } + // L'anta modificata è l'ultima + else if (dimensions.Count > 1) + { + absolutValList[nIndex - 1] = absolutValList[nIndex - 1] + (absolutValList[nIndex] - valueInAbsolute); + absolutValList[nIndex] = valueInAbsolute; + } + } + else + { + // L'anta modificata non è l'ultima + if (nIndex < absolutValList.Count - 1) + { + absolutValList[nIndex + 1] = absolutValList[nIndex + 1] - (valueInAbsolute - absolutValList[nIndex]); + absolutValList[nIndex] = valueInAbsolute; + } + // L'anta modificata è l'ultima + else if (dimensions.Count > 1) + { + absolutValList[nIndex - 1] = absolutValList[nIndex - 1] - (valueInAbsolute - absolutValList[nIndex]); + absolutValList[nIndex] = valueInAbsolute; + } + } + if (MeasureType.Equals(MeasureTypes.PROPORTIONAL)) + m_dDimension = value; + for (int i = 0; i < absolutValList.Count; i++) + { + var item = dimensions.ElementAt(i); + item.SetDimension(ConvertIn(absolutValList[i], (MeasureTypes)item.SelMeasureTypeIndex, widthTot, dimensions)); + } } - m_dDimension = value; m_Parent.ParentWindow.OnUpdatePreview(m_Parent.ParentWindow.sSerialized()); } + //// Controllo che il valore inserito sia compreso tra 0 e 100 + //if (value > 0 && value < 100) + //{ + // // se sono in percentuale + // if (m_bIsRelative) + // { + // List RelativeDimList = new List(); + // if (bIsVertListDim) + // RelativeDimList = m_Parent.SplitVertList.Where(x => x.bIsRelative).ToList(); + // else + // RelativeDimList = m_Parent.SplitHorizList.Where(x => x.bIsRelative).ToList(); + // // verifico se ci sono assoluti + // //List RelativeDimList = m_Parent.SplitPositionList.Where(x => x.bIsRelative).ToList(); + // if (RelativeDimList.Count > 0) + // { + // if (m_Parent.bIsPercentage) + // { + // int nIndex = RelativeDimList.IndexOf(this); + // if (value < m_dDimension) + // { + // if (nIndex < RelativeDimList.Count - 1) + // RelativeDimList[nIndex + 1].SetDimension(RelativeDimList[nIndex + 1].dDimension + (m_dDimension - value)); + // else if (RelativeDimList.Count > 1) + // RelativeDimList[nIndex - 1].SetDimension(RelativeDimList[nIndex - 1].dDimension + (m_dDimension - value)); + // else + // { + // m_dDimension = 100; + // return; + // } + // } + // else + // { + // double dRes = value; + // if (nIndex < RelativeDimList.Count - 1) + // { + // for (var nInd = 0; nInd <= nIndex - 1; nInd++) + // dRes += RelativeDimList[nInd].dDimension; + // dRes = (100 - dRes) / (RelativeDimList.Count - nIndex - 1); + // if (dRes != 0) + // { + // for (var Ind = nIndex + 1; Ind <= RelativeDimList.Count - 1; Ind++) + // RelativeDimList[Ind].SetDimension(dRes); + // } + // else + // return; + // } + // else if (RelativeDimList.Count > 1) + // { + // if (RelativeDimList.Count > 2) + // { + // for (var Ind = 0; Ind <= nIndex - 2; Ind++) + // dRes += RelativeDimList[Ind].dDimension; + // } + // dRes = (100 - dRes); + // if (dRes != 0) + // RelativeDimList[nIndex - 1].SetDimension(dRes); + // else + // return; + // } + // else + // { + // m_dDimension = 100; + // return; + // } + // } + // } + // else + // { + // } + // } + // } + // m_dDimension = value; + // m_Parent.ParentWindow.OnUpdatePreview(m_Parent.ParentWindow.sSerialized()); + //} } } @@ -176,11 +333,15 @@ namespace WebWindowComplex.Models { if (m_SelMeasureType != (MeasureTypes)value) { + MeasureTypes newType = (MeasureTypes)value; + List splitList = null; + if (bIsVertListDim) + splitList = m_Parent.SplitVertList; + else + splitList = m_Parent.SplitHorizList; + double widthTot = CalculateWidthSplitGroup(m_Parent.ParentWindow.AreaList.FirstOrDefault(), m_Parent.ParentWindow.AreaList.FirstOrDefault().DimensionList.Where(x => x.sName == "Width").First().dValue); + m_dDimension = ConvertDimension(m_SelMeasureType, newType, widthTot, splitList); m_SelMeasureType = (MeasureTypes)value; - if (m_SelMeasureType.Equals(MeasureTypes.PROPORTIONAL)) - { - dDimension = 1; - } m_Parent.ParentWindow.OnUpdatePreview(m_Parent.ParentWindow.sSerialized()); } } @@ -190,6 +351,57 @@ namespace WebWindowComplex.Models #region Public Methods + /// + /// Metodo per convertire la dimensione dal vecchio tipo al nuovo tipo + /// + /// Vecchio tipo + /// Nuovo tipo + /// + public double ConvertDimension(MeasureTypes oldType, MeasureTypes newType, double widthTot, List splitList) + { + switch (oldType) + { + case MeasureTypes.ABSOLUT: + { + if (newType.Equals(MeasureTypes.PERCENTAGE)) + { + //return Double.Round((m_dDimension / m_Parent.Width) * 100, 1); + return (m_dDimension / widthTot) * 100; + } + else + { + return CalculatePropVal(widthTot, splitList); + } + } + case MeasureTypes.PROPORTIONAL: + { + if (newType.Equals(MeasureTypes.ABSOLUT)) + { + //return Double.Round(ConvertFromPropVal(newType), 2); + return ConvertFromPropVal(newType, widthTot, splitList); + } + else + { + //return Double.Round(ConvertFromPropVal(newType), 1); + return ConvertFromPropVal(newType, widthTot, splitList); + } + } + case MeasureTypes.PERCENTAGE: + { + if (newType.Equals(MeasureTypes.ABSOLUT)) + { + //return Double.Round((m_dDimension * m_Parent.Width) / 100, 2); + return (m_dDimension * widthTot) / 100; + } + else + { + return CalculatePropVal(widthTot, splitList); + } + } + } + return -1; + } + public SplitDimension Copy() { SplitDimension newSplitDim = new SplitDimension(dDimension, MeasureTypes.PERCENTAGE, bIsRelative, m_Parent, bIsVertListDim); @@ -200,6 +412,252 @@ namespace WebWindowComplex.Models #region Internal Methods + /// + /// Metodo per calcolare larghezza intera split group + /// + /// area di partenza + /// larghezza di partenza + /// + internal double CalculateWidthSplitGroup(Area area, double width) + { + for (int i = 0; i < area.AreaList.Count; i++) + { + double risultato = -1; + if (area.Equals(m_Parent)) + return width; + Area item = area.AreaList[i]; + if (area is Split) + { + Split split = (Split)area; + switch (split.SplitVertList.ElementAt(i).SelMeasureType) + { + case MeasureTypes.ABSOLUT: + { + risultato = CalculateWidthSplitGroup(item, split.SplitVertList.ElementAt(i).dDimension); + break; + } + case MeasureTypes.PROPORTIONAL: + { + //risultato = CalculateWidthSplitGroup(item, split.SplitVertList.ElementAt(i).dDimension); + break; + } + case MeasureTypes.PERCENTAGE: + { + risultato = CalculateWidthSplitGroup(item, split.SplitVertList.ElementAt(i).dDimension * width / 100); + break; + } + } + if (risultato != -1) + return risultato; + } + else if (area is Sash) + { + Sash sash = (Sash)area; + switch (sash.SashList.ElementAt(i).SelMeasureType) + { + case MeasureTypes.ABSOLUT: + { + risultato = CalculateWidthSplitGroup(item, sash.SashList.ElementAt(i).dDimension); + break; + } + case MeasureTypes.PROPORTIONAL: + { + //risultato = CalculateWidthSplitGroup(item, sash.SashList.ElementAt(i).dDimension); + break; + } + case MeasureTypes.PERCENTAGE: + { + risultato = CalculateWidthSplitGroup(item, sash.SashList.ElementAt(i).dDimension * width / 100); + break; + } + } + if (risultato != -1) + return risultato; + } + else + { + risultato = CalculateWidthSplitGroup(item, width); + if (risultato != -1) + return risultato; + } + } + return width; + } + + /// + /// Calcolo MCD + /// + /// + /// + /// + internal static double CalculateMCD(double a, double b) + { + while (b >= 0.01) + { + double temp = b; + b = a % b; + a = temp; + } + //return Double.Round(a,2); + return a; + } + + /// + /// Metodo per ricalcolare i valori proporzionali a causa della modifica di uno + /// + /// + internal double CalculatePropVal(double widthTot, List splitList) + { + if (splitList.Where(m => m.MeasureType.Equals(MeasureTypes.PROPORTIONAL)).ToList().Count == 0) + { + return 1; + } + List absolutValue = new List(); + foreach (var item in splitList) + { + absolutValue.Add(item.CalculateAbsolutValue(widthTot, splitList)); + } + for (int i = 0; i < splitList.Count; i++) + { + if (!splitList.ElementAt(i).Equals(this) && + splitList.ElementAt(i).MeasureType.Equals(MeasureTypes.PROPORTIONAL)) + { + int nIndex = splitList.IndexOf(this); + if (absolutValue.ElementAt(nIndex) <= absolutValue.ElementAt(i)) + { + var mcd = CalculateMCD(absolutValue.ElementAt(nIndex), absolutValue.ElementAt(i)); + //m_Parent.SashList.ElementAt(i).m_dDimension = Double.Round(absolutValue.ElementAt(i) / mcd, 2); + //m_dDimension = Double.Round(absolutValue.ElementAt(nIndex) / mcd, 2); + splitList.ElementAt(i).m_dDimension = absolutValue.ElementAt(i) / mcd; + m_dDimension = absolutValue.ElementAt(nIndex) / mcd; + } + else + { + var mcd = CalculateMCD(absolutValue.ElementAt(nIndex), absolutValue.ElementAt(i)); + //m_Parent.SashList.ElementAt(i).m_dDimension = Double.Round(absolutValue.ElementAt(i) / mcd, 2); + //m_dDimension = Double.Round(absolutValue.ElementAt(nIndex) / mcd, 2); + splitList.ElementAt(i).m_dDimension = absolutValue.ElementAt(i) / mcd; + m_dDimension = absolutValue.ElementAt(nIndex) / mcd; + } + break; + } + } + return m_dDimension; + } + + /// + /// Metodo per trasformare una dimensione in valore assoluto rispetto alla larghezza totale + /// + /// Larghezza totale + /// + internal double CalculateAbsolutValue(double widthTot, List splitList) + { + switch (MeasureType) + { + case MeasureTypes.ABSOLUT: + { + //return Double.Round(dDimension, 2); + return dDimension; + } + case MeasureTypes.PROPORTIONAL: + { + //return Double.Round(Proportional2AbsolutVal(), 2); + return Proportional2AbsolutVal(widthTot, splitList); + } + case MeasureTypes.PERCENTAGE: + { + //return Double.Round((dDimension / 100) * widthTot, 1); + return (dDimension / 100) * widthTot; + } + } + return 0; + } + + /// + /// Metodo per convertire una dimensione da un valore assoluto al suo rispettivo tipo + /// + /// Valore assoluto + /// Tipo di misura della dimensione + /// Larghezza totale + /// + internal double ConvertIn(double absolutVal, MeasureTypes type, double widthTot, List splitList) + { + switch (type) + { + case MeasureTypes.ABSOLUT: + { + //return Double.Round(absolutVal, 2); + return absolutVal; + } + case MeasureTypes.PROPORTIONAL: + { + //return Proportional2AbsolutVal(); + return Proportional2AbsolutVal(widthTot, splitList); + } + case MeasureTypes.PERCENTAGE: + { + //return Double.Round((absolutVal / widthTot) * 100, 1); + return (absolutVal / widthTot) * 100; + } + } + return -1; + } + + /// + /// Metodo per convertire da misura proporzionale a misura assoluta o percentuale + /// + /// + /// + internal double ConvertFromPropVal(MeasureTypes newType, double widthTot, List splitList) + { + double tot = widthTot; + //Somma misura non proporzionali + double sumNotProp = splitList + .Where(m => m.MeasureType != MeasureTypes.PROPORTIONAL && !m.Equals(this)) + .Sum(m => m.CalculateAbsolutValue(tot, splitList)); + //Calcolo residuo + double res = tot - sumNotProp; + if (res < 0) res = 0; + //Misure proporzionali + var proportionalList = splitList + .Where(m => m.SelMeasureType == MeasureTypes.PROPORTIONAL) + .ToList(); + + double sumPesi = proportionalList.Sum(p => p.dDimension); + if (sumPesi == 0) sumPesi = 1; + if (newType.Equals(MeasureTypes.ABSOLUT)) + { + return res / sumPesi * dDimension; + } + else + { + return (res / sumPesi * dDimension) / tot * 100; + } + } + + /// + /// Metodo per trasformare il valore proporzionale in assoluto + /// + /// + internal double Proportional2AbsolutVal(double widthTot, List splitList) + { + double tot = widthTot; + //Somma misura non proporzionali + double sumNotProp = splitList + .Where(m => m.MeasureType != MeasureTypes.PROPORTIONAL) + .Sum(m => m.CalculateAbsolutValue(tot, splitList)); + //Calcolo residuo + double res = tot - sumNotProp; + if (res < 0) res = 0; + //Misure proporzionali + var proportionalList = splitList + .Where(m => m.SelMeasureType == MeasureTypes.PROPORTIONAL) + .ToList(); + double sumPesi = proportionalList.Sum(p => p.dDimension); + if (sumPesi == 0) sumPesi = 1; + return res / sumPesi * dDimension; + } + internal JsonSplitDimension Serialize() { JsonSplitDimension JsonSplitDimension = new JsonSplitDimension(m_bIsRelative, m_dDimension, MeasureType); diff --git a/WebWindowComplex/TableComp.razor b/WebWindowComplex/TableComp.razor index 6158c55..598c086 100644 --- a/WebWindowComplex/TableComp.razor +++ b/WebWindowComplex/TableComp.razor @@ -78,7 +78,7 @@ { m_PreviousWindow = m_CurrWindow; } - net8.0 enable enable - 2.7.11.1815 + 2.7.11.2017 Annamaria Sassi Egalware Componente gestione Configurazioni avanzate Window per LUX @@ -140,6 +140,10 @@ + + + + diff --git a/WebWindowConfigurator/WebWindowConfigurator.csproj b/WebWindowConfigurator/WebWindowConfigurator.csproj index c797584..54e7a0d 100644 --- a/WebWindowConfigurator/WebWindowConfigurator.csproj +++ b/WebWindowConfigurator/WebWindowConfigurator.csproj @@ -6,7 +6,7 @@ net8.0 enable enable - 2.7.11.1815 + 2.7.11.2017 Annamaria Sassi Egalware Componente gestione JWD per LUX @@ -167,6 +167,43 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + From cf912c8f21ee04def587c37886c80c4ea5e0cf09 Mon Sep 17 00:00:00 2001 From: Samuele Locatelli Date: Thu, 20 Nov 2025 17:58:46 +0100 Subject: [PATCH 06/18] Aggiunto init basico in casi di errore deserializzazione x cambio formati --- WebWindowComplex/TableComp.razor.cs | 8 ++++++++ WebWindowComplex/WebWindowComplex.csproj | 1 + WebWindowConfigurator/WebWindowConfigurator.csproj | 1 + 3 files changed, 10 insertions(+) diff --git a/WebWindowComplex/TableComp.razor.cs b/WebWindowComplex/TableComp.razor.cs index 421a681..c655ac5 100644 --- a/WebWindowComplex/TableComp.razor.cs +++ b/WebWindowComplex/TableComp.razor.cs @@ -735,6 +735,14 @@ namespace WebWindowComplex catch (Exception ex) { listErrLink.Add("Window", $"Deserializing Error:{Environment.NewLine}{ex}"); + // uso un oggetto "basico" per non fermarmi + WindowFromJson = new JsonWindow("", "", "", ""); + List AreaList = new List(); + JsonFrame baseFrame = new JsonFrame(); + baseFrame.DimensionList.Add(new JsonFrameDimension(0, "Width", 800)); + baseFrame.DimensionList.Add(new JsonFrameDimension(0, "Height", 1200)); + AreaList.Add(baseFrame); + WindowFromJson.AreaList = AreaList; } } else diff --git a/WebWindowComplex/WebWindowComplex.csproj b/WebWindowComplex/WebWindowComplex.csproj index f81b8c2..ef6748e 100644 --- a/WebWindowComplex/WebWindowComplex.csproj +++ b/WebWindowComplex/WebWindowComplex.csproj @@ -147,5 +147,6 @@ + diff --git a/WebWindowConfigurator/WebWindowConfigurator.csproj b/WebWindowConfigurator/WebWindowConfigurator.csproj index 54e7a0d..6a1d0aa 100644 --- a/WebWindowConfigurator/WebWindowConfigurator.csproj +++ b/WebWindowConfigurator/WebWindowConfigurator.csproj @@ -222,5 +222,6 @@ + From 1fed423ab068f10f99af342fb9fd2785d879d9df Mon Sep 17 00:00:00 2001 From: Annamaria Sassi Date: Mon, 24 Nov 2025 14:50:32 +0100 Subject: [PATCH 07/18] - Aggiornato passaggio parametri tra componenti - Aggiornata interfaccia sash - Aggiornato jwd di base nel caso di sbagliata deserializzazione - Aggiornato readme --- README.md | 74 ++-- WebWindowComplex/Compo/AreaFrame.razor | 2 +- WebWindowComplex/Compo/AreaFrame.razor.cs | 10 +- WebWindowComplex/Compo/AreaHwOption.razor | 4 +- WebWindowComplex/Compo/AreaHwOption.razor.cs | 8 +- WebWindowComplex/Compo/AreaSash.razor | 364 ++++++++++++------ WebWindowComplex/Compo/AreaSash.razor.cs | 80 ++-- WebWindowComplex/Compo/AreaSplit.razor | 6 +- WebWindowComplex/Compo/AreaSplit.razor.cs | 8 +- WebWindowComplex/Compo/CardFill.razor | 5 +- WebWindowComplex/Compo/CardFill.razor.cs | 4 +- WebWindowComplex/Compo/CardFrame.razor | 27 +- WebWindowComplex/Compo/CardFrame.razor.cs | 30 +- WebWindowComplex/Compo/CardSashGroup.razor | 155 ++++---- WebWindowComplex/Compo/CardSashGroup.razor.cs | 70 ++-- WebWindowComplex/Compo/CardSplit.razor | 4 - WebWindowComplex/Compo/CardSplit.razor.cs | 8 +- WebWindowComplex/Models/Sash.cs | 52 ++- WebWindowComplex/TableComp.razor | 102 ++--- WebWindowComplex/TableComp.razor.cs | 42 +- WebWindowComplex/WebWindowComplex.csproj | 7 +- .../WebWindowConfigurator.csproj | 3 +- 22 files changed, 617 insertions(+), 448 deletions(-) diff --git a/README.md b/README.md index 43838b6..2c3d7ea 100644 --- a/README.md +++ b/README.md @@ -7,23 +7,24 @@ Durante la configurazione ad ogni cambiamento viene aggiornata l'immagine del se ## Requisiti I requisiti per utilizzare il componente sono: - - JWD da modificare - - Lista delle famiglie hardware - - Lista hardware - - Lista dei materiali - - Lista dei colori dei materiali - - Lista dei vetri ammessi - - Lista dei profili gestiti + - JWD da modificare; + - Lista delle famiglie hardware; + - Lista hardware; + - Lista dei materiali; + - Lista dei colori dei materiali; + - Lista dei vetri ammessi; + - Lista dei profili gestiti. ## Funzionalità componente Il componente permette i seguenti comportamenti principali: - - Aggiungere un gruppo di ante al telaio, - - Aggiungere uno split al telaio o a un anta, - - Copiare il contenuto di un'anta in un'altra anta, - - Eliminare un gruppo di ante, - - Eliminare uno split + - Aggiungere un gruppo di ante al telaio; + - Aggiungere uno split al telaio o a un anta; + - Copiare il contenuto di un'anta in un'altra anta; + - Eliminare un gruppo di ante; + - Eliminare uno split; + - Cambiare le caratteristiche dei gruppi di ante, delle singole ante, degli split e del frame. ## JWD @@ -53,17 +54,17 @@ Al frame sono associate le seguenti caratteristiche: #### Forme Telaio Le forme ammesse per il telaio sono le seguenti: - - Rectangle - - Right Chamfer - - Left Chamfer - - Double Chamfer - - Arc - - Full Arc - - Fillet - - Double Arc - - Three Center Arc - - Triangle, - - Custom + - Rectangle; + - Right Chamfer; + - Left Chamfer; + - Double Chamfer; + - Arc; + - Full Arc; + - Fillet; + - Double Arc; + - Three Center Arc; + - Triangle; + - Custom. ### Divisione (Split) @@ -71,9 +72,9 @@ Uno split genera sempre almeno due sottoaree contenenti ognuna un riempimento (F Se ci sono solo due sottoaree generate da uno split, si possono scambiare tra di loro. Uno split può essere: - - Orizzontale, definisco il numero di split orizzontali e l'altezza delle nuove aree orizzontali formate; - - Verticale, definisco il numero di split verticali e la larghezza delle nuove aree verticali formate; - - A griglia, definisco il numero di split orizzontali e verticali e l'altezza delle aree orizzontali e la larghezza delle aree verticali. + - Orizzontale, viene definito il numero di split orizzontali e l'altezza delle nuove aree orizzontali formate; + - Verticale, viene definito il numero di split verticali e la larghezza delle nuove aree verticali formate; + - A griglia, viene definito il numero di split orizzontali e verticali e l'altezza delle aree orizzontali e la larghezza delle aree verticali; in questo caso si può scegliere se hanno la precedenza gli split orizzontali o verticali (cambia il modo in cui si esegue l'incrocio tra gli split). ### Gruppo di ante (Sash group) @@ -81,33 +82,22 @@ Al gruppo di ante sono associate le seguenti caratteristiche: - Numero di ante; - Orientamento; - Quantità bottom rail; - - Giunti; - Codice hardware. -#### Forme gruppo ante - -Le forme ammesse per il telaio sono le seguenti: - - Arc - - Circle - - Custom - - FullArc - - Rectangle - - SemiArc - - SemiFullArc - - Trapezoid - #### Singola anta La singola anta ha associate le seguenti caratteristiche: - Tipologia di apertura; - Dimensione; - - Presenza maniglia. + - Tipo di misura per la dimensione (assoluta, percentuale o proporzionale) + - Presenza maniglia; + - Giunti. #### Hardware Per calcolare la lista di hardware ammessi data una famiglia di hardware servono i seguenti dati: - Forma del gruppo di ante (tramite richiesta al programma di calcolo); - - Apertura dell'anta con la maniglia; + - Tipo di apertura dell'anta con la maniglia; - Numero di ante; - Posizione anta battente (nel caso di tre o più ante, bisogna sapere se l'anta con la maniglia è incernierata al telaio o a un'altra anta). @@ -135,8 +125,6 @@ Vengono richieste nei seguenti casi: Descrive il tipo di riempimento: vetro o pannello. - - ## Roadmap Mancano: diff --git a/WebWindowComplex/Compo/AreaFrame.razor b/WebWindowComplex/Compo/AreaFrame.razor index 19908a6..f9a4a9a 100644 --- a/WebWindowComplex/Compo/AreaFrame.razor +++ b/WebWindowComplex/Compo/AreaFrame.razor @@ -5,7 +5,7 @@
Area frame
- @if (CurrSashList.Count == 0 && CurrSplitList.Count == 0) + @if (SashList.Count == 0 && SplitList.Count == 0) {
diff --git a/WebWindowComplex/Compo/AreaFrame.razor.cs b/WebWindowComplex/Compo/AreaFrame.razor.cs index b74d237..b9d1b94 100644 --- a/WebWindowComplex/Compo/AreaFrame.razor.cs +++ b/WebWindowComplex/Compo/AreaFrame.razor.cs @@ -7,14 +7,14 @@ namespace WebWindowComplex.Compo { #region Public Properties - [Parameter] + [CascadingParameter(Name = "CurrFrameWindow")] public Frame CurrFrameWindow { get; set; } = null!; - [Parameter] - public List CurrSashList { get; set; } = null!; + [CascadingParameter(Name = "SashList")] + public List SashList { get; set; } = null!; - [Parameter] - public List CurrSplitList { get; set; } = null!; + [CascadingParameter(Name = "SplitList")] + public List SplitList { get; set; } = null!; [Parameter] public EventCallback EC_AddSash { get; set; } diff --git a/WebWindowComplex/Compo/AreaHwOption.razor b/WebWindowComplex/Compo/AreaHwOption.razor index a6a1b40..baed002 100644 --- a/WebWindowComplex/Compo/AreaHwOption.razor +++ b/WebWindowComplex/Compo/AreaHwOption.razor @@ -5,7 +5,7 @@
Hardware option
- +
@@ -30,7 +30,7 @@ {
- @foreach (var currOpt in CurrSash.HwOptionList) + @foreach (var currOpt in CurrSashGroup.HwOptionList) { switch (currOpt.Type) { diff --git a/WebWindowComplex/Compo/AreaHwOption.razor.cs b/WebWindowComplex/Compo/AreaHwOption.razor.cs index 386be5f..1b352fc 100644 --- a/WebWindowComplex/Compo/AreaHwOption.razor.cs +++ b/WebWindowComplex/Compo/AreaHwOption.razor.cs @@ -11,8 +11,8 @@ namespace WebWindowComplex.Compo /// /// Sash corrente rispetto alla lista Sash /// - [Parameter] - public Sash CurrSash { get; set; } = null!; + [CascadingParameter(Name = "CurrSashGroup")] + public Sash CurrSashGroup { get; set; } = null!; /// /// Evento per aggiornare gli hardware option di tipo combo @@ -48,9 +48,9 @@ namespace WebWindowComplex.Compo private async Task changeCollapsed() { hwOptCollapsed = !hwOptCollapsed; - if (CurrSash.HwOptionList.Count == 0) + if (CurrSashGroup.HwOptionList.Count == 0) { - await EC_FirstHwOptionList.InvokeAsync(CurrSash.GroupId); + await EC_FirstHwOptionList.InvokeAsync(CurrSashGroup.GroupId); } } diff --git a/WebWindowComplex/Compo/AreaSash.razor b/WebWindowComplex/Compo/AreaSash.razor index 08ac786..f116fcc 100644 --- a/WebWindowComplex/Compo/AreaSash.razor +++ b/WebWindowComplex/Compo/AreaSash.razor @@ -4,7 +4,27 @@
Sash @(CurrSashGroup.SashList.Count == 1 ? "" : (IndexSash + 1))
- + +
@@ -45,7 +65,16 @@ }
- @*
+
+
+ +
+
+ +
+
+ @* +
Joints
@@ -54,6 +83,7 @@
+ @if (!JointCollapsed) {
@@ -82,14 +112,7 @@ } }
-
-
- -
-
- -
-
+ @if (!(CurrAnta.AreaList[0] is Split)) {
@@ -124,126 +147,233 @@ } else { - - } + } *@ else {
@@ -78,17 +78,20 @@ { m_PreviousWindow = m_CurrWindow; } - - + + + + + + + + } else if (currStep == CompileStep.Split) { @@ -98,16 +101,18 @@ } else { - - + + + + + + } } else if (currStep == CompileStep.Sash) @@ -119,20 +124,21 @@ else { - - + + + + - } + } } else if (currStep == CompileStep.Fill) { @@ -142,17 +148,19 @@ } else { - - + + + + + + } } else if (currStep == CompileStep.General) diff --git a/WebWindowComplex/TableComp.razor.cs b/WebWindowComplex/TableComp.razor.cs index c655ac5..e84c1ed 100644 --- a/WebWindowComplex/TableComp.razor.cs +++ b/WebWindowComplex/TableComp.razor.cs @@ -1,13 +1,12 @@ using Egw.Window.Data; using Microsoft.AspNetCore.Components; using Newtonsoft.Json; -using System.Reflection.Metadata; using WebWindowComplex.Compo; using WebWindowComplex.DTO; using WebWindowComplex.Json; using WebWindowComplex.Models; -using static WebWindowComplex.LayoutConst; using static WebWindowComplex.Json.WindowConst; +using static WebWindowComplex.LayoutConst; namespace WebWindowComplex { @@ -736,13 +735,36 @@ namespace WebWindowComplex { listErrLink.Add("Window", $"Deserializing Error:{Environment.NewLine}{ex}"); // uso un oggetto "basico" per non fermarmi - WindowFromJson = new JsonWindow("", "", "", ""); - List AreaList = new List(); - JsonFrame baseFrame = new JsonFrame(); - baseFrame.DimensionList.Add(new JsonFrameDimension(0, "Width", 800)); - baseFrame.DimensionList.Add(new JsonFrameDimension(0, "Height", 1200)); - AreaList.Add(baseFrame); - WindowFromJson.AreaList = AreaList; + //string jwd = "{\r\n \"ProfilePath\": \"Profilo78\",\r\n \"Material\": \"Pino\",\r\n \"ColorMaterial\": \"Black\",\r\n \"Glass\": \"Vetro BE 2S 4T/16/4T\",\r\n \"AreaList\": [\r\n {\r\n \"Shape\": \"RECTANGLE\",\r\n \"DimensionList\": [\r\n {\r\n \"Index\": 1,\r\n \"Name\": \"Width\",\r\n \"Value\": 800.0\r\n },\r\n {\r\n \"Index\": 2,\r\n \"Name\": \"Height\",\r\n \"Value\": 1200.0\r\n }\r\n ],\r\n \"JointList\": [\r\n {\r\n \"Index\": 1,\r\n \"JointType\": \"FULL_H\"\r\n },\r\n {\r\n \"Index\": 2,\r\n \"JointType\": \"FULL_H\"\r\n },\r\n {\r\n \"Index\": 3,\r\n \"JointType\": \"FULL_H\"\r\n },\r\n {\r\n \"Index\": 4,\r\n \"JointType\": \"FULL_H\"\r\n }\r\n ],\r\n \"BottomRail\": false,\r\n \"BottomRailQty\": 0,\r\n \"GroupId\": 1,\r\n \"AreaList\": [\r\n {\r\n \"FillType\": \"GLASS\",\r\n \"GroupId\": 7,\r\n \"AreaList\": [],\r\n \"AreaType\": \"FILL\"\r\n }\r\n ],\r\n \"AreaType\": \"FRAME\"\r\n }\r\n ]\r\n}"; + //WindowFromJson = JsonConvert.DeserializeObject(jwd, new PolymorphicJsonConverter()) ?? new JsonWindow("", "", "", ""); + //setCurrWindow(WindowFromJson); + //await DoPreviewSvg(true); + Window window = new Window(); + Frame frame = new Frame(null, window); + List DimensionList = new List + { + new FrameDimension(frame, 1, "Width", 800, false), + new FrameDimension(frame, 1, "Height", 1200, true) + }; + List JointList = new List + { + new Joint(frame, 1, Joints.FULL_H), + new Joint(frame, 2, Joints.FULL_H), + new Joint(frame, 3, Joints.FULL_H), + new Joint(frame, 4, Joints.FULL_H) + }; + JsonWindow jsonWindow = new JsonWindow("Profilo78", "Pino", "Black", "Vetro BE 2S 4T/16/4T"); + JsonFrame jsonFrame = new JsonFrame(Shapes.RECTANGLE, false, 0, 1); + jsonWindow.AreaList.Add(jsonFrame); + foreach (var Dimension in DimensionList) + jsonFrame.DimensionList.Add(Dimension.Serialize()); + foreach (var Joint in JointList) + jsonFrame.JointList.Add(Joint.Serialize()); + jsonFrame.AreaList.Add(Fill.CreateFill(frame, FillTypes.GLASS).Serialize(true)); + string jwd = JsonConvert.SerializeObject(jsonWindow); + WindowFromJson = JsonConvert.DeserializeObject(jwd, new PolymorphicJsonConverter()) ?? new JsonWindow("", "", "", ""); + setCurrWindow(WindowFromJson); + await DoPreviewSvg(true); } } else @@ -759,7 +781,7 @@ namespace WebWindowComplex if (updRequested) { // se mancasse dizionario forme chiamo quello - if (LiveData.DictShape.Count == 0) + if (LiveData.DictShape.Count == 0 && listErrLink.Count == 0) { if (firstDisplay && isRendered) { diff --git a/WebWindowComplex/WebWindowComplex.csproj b/WebWindowComplex/WebWindowComplex.csproj index ef6748e..e3eb945 100644 --- a/WebWindowComplex/WebWindowComplex.csproj +++ b/WebWindowComplex/WebWindowComplex.csproj @@ -6,7 +6,7 @@ net8.0 enable enable - 2.7.11.2017 + 2.7.11.2414 Annamaria Sassi Egalware Componente gestione Configurazioni avanzate Window per LUX @@ -144,6 +144,11 @@ + + + + + diff --git a/WebWindowConfigurator/WebWindowConfigurator.csproj b/WebWindowConfigurator/WebWindowConfigurator.csproj index 6a1d0aa..4cded15 100644 --- a/WebWindowConfigurator/WebWindowConfigurator.csproj +++ b/WebWindowConfigurator/WebWindowConfigurator.csproj @@ -6,7 +6,7 @@ net8.0 enable enable - 2.7.11.2017 + 2.7.11.2414 Annamaria Sassi Egalware Componente gestione JWD per LUX @@ -223,5 +223,6 @@ + From 69eb70d5a68cae27d020c7196b8eadd96c8b784d Mon Sep 17 00:00:00 2001 From: Annamaria Sassi Date: Tue, 25 Nov 2025 09:47:08 +0100 Subject: [PATCH 08/18] Aggiornati jwd di esempio --- Test.UI/Data/AntaDoppia.jwd | 20 ++++++++++---------- Test.UI/Data/AntaSingola.jwd | 12 ++++++------ Test.UI/Data/FinDueAnteBottomFisso.jwd | 12 ++++++------ Test.UI/Data/FinestraDueAnteSeparate.jwd | 20 ++++++++++---------- Test.UI/Data/FinestraSplitGrid.jwd | 4 ++-- Test.UI/Data/FinestraSplitVert.jwd | 4 ++-- 6 files changed, 36 insertions(+), 36 deletions(-) diff --git a/Test.UI/Data/AntaDoppia.jwd b/Test.UI/Data/AntaDoppia.jwd index ee77baa..42f5692 100644 --- a/Test.UI/Data/AntaDoppia.jwd +++ b/Test.UI/Data/AntaDoppia.jwd @@ -29,11 +29,11 @@ }, { "Index": 3, - "JointType": "FULL_H" + "JointType": "FULL_V" }, { "Index": 4, - "JointType": "FULL_H" + "JointType": "FULL_V" } ], "BottomRail": false, @@ -50,19 +50,19 @@ "JointList": [ { "Index": 1, - "JointType": "FULL_H" + "JointType": "FULL_V" }, { "Index": 2, - "JointType": "FULL_H" + "JointType": "FULL_V" }, { "Index": 3, - "JointType": "FULL_H" + "JointType": "FULL_V" }, { "Index": 4, - "JointType": "FULL_H" + "JointType": "FULL_V" } ], "MeasureType": "PERCENTAGE", @@ -75,19 +75,19 @@ "JointList": [ { "Index": 1, - "JointType": "FULL_H" + "JointType": "FULL_V" }, { "Index": 2, - "JointType": "FULL_H" + "JointType": "FULL_V" }, { "Index": 3, - "JointType": "FULL_H" + "JointType": "FULL_V" }, { "Index": 4, - "JointType": "FULL_H" + "JointType": "FULL_V" } ], "MeasureType": "PERCENTAGE", diff --git a/Test.UI/Data/AntaSingola.jwd b/Test.UI/Data/AntaSingola.jwd index 4ccc9d1..f1c6dea 100644 --- a/Test.UI/Data/AntaSingola.jwd +++ b/Test.UI/Data/AntaSingola.jwd @@ -29,11 +29,11 @@ }, { "Index": 3, - "JointType": "FULL_H" + "JointType": "FULL_V" }, { "Index": 4, - "JointType": "FULL_H" + "JointType": "FULL_V" } ], "BottomRail": false, @@ -54,19 +54,19 @@ "JointList": [ { "Index": 1, - "JointType": "FULL_H" + "JointType": "FULL_V" }, { "Index": 2, - "JointType": "FULL_H" + "JointType": "FULL_V" }, { "Index": 3, - "JointType": "FULL_H" + "JointType": "FULL_V" }, { "Index": 4, - "JointType": "FULL_H" + "JointType": "FULL_V" } ], "Hardware": "000635", diff --git a/Test.UI/Data/FinDueAnteBottomFisso.jwd b/Test.UI/Data/FinDueAnteBottomFisso.jwd index c1d8530..9858886 100644 --- a/Test.UI/Data/FinDueAnteBottomFisso.jwd +++ b/Test.UI/Data/FinDueAnteBottomFisso.jwd @@ -29,11 +29,11 @@ }, { "Index": 3, - "JointType": "FULL_H" + "JointType": "FULL_V" }, { "Index": 4, - "JointType": "FULL_H" + "JointType": "FULL_V" } ], "BottomRail": false, @@ -91,19 +91,19 @@ "JointList": [ { "Index": 1, - "JointType": "FULL_H" + "JointType": "FULL_V" }, { "Index": 2, - "JointType": "FULL_H" + "JointType": "FULL_V" }, { "Index": 3, - "JointType": "FULL_H" + "JointType": "FULL_V" }, { "Index": 4, - "JointType": "FULL_H" + "JointType": "FULL_V" } ], "Hardware": "000631", diff --git a/Test.UI/Data/FinestraDueAnteSeparate.jwd b/Test.UI/Data/FinestraDueAnteSeparate.jwd index e4392b0..46fc557 100644 --- a/Test.UI/Data/FinestraDueAnteSeparate.jwd +++ b/Test.UI/Data/FinestraDueAnteSeparate.jwd @@ -34,11 +34,11 @@ }, { "Index": 3, - "JointType": "FULL_H" + "JointType": "FULL_V" }, { "Index": 4, - "JointType": "FULL_H" + "JointType": "FULL_V" } ], "BottomRail": false, @@ -78,19 +78,19 @@ "JointList": [ { "Index": 1, - "JointType": "FULL_H" + "JointType": "FULL_V" }, { "Index": 2, - "JointType": "FULL_H" + "JointType": "FULL_V" }, { "Index": 3, - "JointType": "FULL_H" + "JointType": "FULL_V" }, { "Index": 4, - "JointType": "FULL_H" + "JointType": "FULL_V" } ], "BottomRail": false, @@ -157,19 +157,19 @@ "JointList": [ { "Index": 1, - "JointType": "FULL_H" + "JointType": "FULL_V" }, { "Index": 2, - "JointType": "FULL_H" + "JointType": "FULL_V" }, { "Index": 3, - "JointType": "FULL_H" + "JointType": "FULL_V" }, { "Index": 4, - "JointType": "FULL_H" + "JointType": "FULL_V" } ], "BottomRail": false, diff --git a/Test.UI/Data/FinestraSplitGrid.jwd b/Test.UI/Data/FinestraSplitGrid.jwd index 2782718..53747ca 100644 --- a/Test.UI/Data/FinestraSplitGrid.jwd +++ b/Test.UI/Data/FinestraSplitGrid.jwd @@ -29,11 +29,11 @@ }, { "Index": 3, - "JointType": "FULL_H" + "JointType": "FULL_V" }, { "Index": 4, - "JointType": "FULL_H" + "JointType": "FULL_V" } ], "BottomRail": false, diff --git a/Test.UI/Data/FinestraSplitVert.jwd b/Test.UI/Data/FinestraSplitVert.jwd index 8078d3c..a8920c8 100644 --- a/Test.UI/Data/FinestraSplitVert.jwd +++ b/Test.UI/Data/FinestraSplitVert.jwd @@ -29,11 +29,11 @@ }, { "Index": 3, - "JointType": "FULL_H" + "JointType": "FULL_V" }, { "Index": 4, - "JointType": "FULL_H" + "JointType": "FULL_V" } ], "BottomRail": false, From f56ed1052df382def6a373401b4a46e9a8f1704f Mon Sep 17 00:00:00 2001 From: Annamaria Sassi Date: Tue, 25 Nov 2025 09:49:41 +0100 Subject: [PATCH 09/18] - Aggiunta gestione altezza singoli split - Conversione tutti split ad uno stesso tipo --- WebWindowComplex/Compo/CardSplit.razor | 47 ++++-- WebWindowComplex/Compo/CardSplit.razor.cs | 26 +++ WebWindowComplex/Json/JsonUtility.cs | 1 + WebWindowComplex/Models/Sash.cs | 9 +- WebWindowComplex/Models/SashDimension.cs | 45 ++--- WebWindowComplex/Models/SplitDimension.cs | 157 +++++++++++++++--- WebWindowComplex/TableComp.razor | 3 +- WebWindowComplex/TableComp.razor.cs | 45 ++++- WebWindowComplex/WebWindowComplex.csproj | 9 +- .../WebWindowConfigurator.csproj | 4 +- 10 files changed, 274 insertions(+), 72 deletions(-) diff --git a/WebWindowComplex/Compo/CardSplit.razor b/WebWindowComplex/Compo/CardSplit.razor index 7811a2d..f2224b6 100644 --- a/WebWindowComplex/Compo/CardSplit.razor +++ b/WebWindowComplex/Compo/CardSplit.razor @@ -1,4 +1,5 @@ - +@using static WebWindowComplex.Json.WindowConst +
@@ -11,22 +12,38 @@
-
-
-
Split
-
-
- @if ((CurrItem.nSplitQtyVert == 1 && CurrItem.nSplitQtyHoriz == 0) || (CurrItem.nSplitQtyVert == 0 && CurrItem.nSplitQtyHoriz == 1)) - { -
- -
- } -
-
+
+
Split
+ @if ((CurrItem.nSplitQtyVert == 1 && CurrItem.nSplitQtyHoriz == 0) || (CurrItem.nSplitQtyVert == 0 && CurrItem.nSplitQtyHoriz == 1)) + {
- +
+ } +
+ +
+
diff --git a/WebWindowComplex/Compo/CardSplit.razor.cs b/WebWindowComplex/Compo/CardSplit.razor.cs index 9967d05..9562c05 100644 --- a/WebWindowComplex/Compo/CardSplit.razor.cs +++ b/WebWindowComplex/Compo/CardSplit.razor.cs @@ -1,5 +1,6 @@ using Microsoft.AspNetCore.Components; using WebWindowComplex.Models; +using static WebWindowComplex.Json.WindowConst; namespace WebWindowComplex.Compo { @@ -53,6 +54,12 @@ namespace WebWindowComplex.Compo [Parameter] public EventCallback EC_ReqResetDictShape { get; set; } + /// + /// Evento per aggiornare lo split + /// + [Parameter] + public EventCallback EC_UpdateSplit { get; set; } + /// /// Evento per tornare nella pagine Tree /// @@ -139,6 +146,25 @@ namespace WebWindowComplex.Compo { _ = EC_ReqClose.InvokeAsync(true); } + + private bool isOpen = false; + private void ToggleDropdown() + { + isOpen = !isOpen; + } + protected async Task SetMeasureType(MeasureTypes type) + { + isOpen = !isOpen; + foreach (var item in CurrItem.SplitVertList) + { + item.SetSelMeasureType(type); + } + foreach (var item in CurrItem.SplitHorizList) + { + item.SetSelMeasureType(type); + } + await EC_UpdateSplit.InvokeAsync(CurrItem); + } } public class DataChangeStartVert diff --git a/WebWindowComplex/Json/JsonUtility.cs b/WebWindowComplex/Json/JsonUtility.cs index 44983d1..235fea4 100644 --- a/WebWindowComplex/Json/JsonUtility.cs +++ b/WebWindowComplex/Json/JsonUtility.cs @@ -531,6 +531,7 @@ namespace WebWindowComplex.Json { Split.SplitHorizList[SplitIndex].SetIsRelative(m_SplitHorizList[SplitIndex].IsRelative); Split.SplitHorizList[SplitIndex].SetDimension(m_SplitHorizList[SplitIndex].Dimension); + Split.SplitHorizList[SplitIndex].SetMeasureType(m_SplitHorizList[SplitIndex].MeasureType); } } foreach (var Area in AreaList) diff --git a/WebWindowComplex/Models/Sash.cs b/WebWindowComplex/Models/Sash.cs index 9738740..75509cb 100644 --- a/WebWindowComplex/Models/Sash.cs +++ b/WebWindowComplex/Models/Sash.cs @@ -417,10 +417,6 @@ namespace WebWindowComplex.Models newSash.SetIsSashVertical(bIsSashVertical); newSash.SetOrientationSashType(OrientationSashType); newSash.SetSashBottomRailQty(SashBottomRailQty); - newSash.SetSelFamilyHardwareFromIndex(m_SelHardware.Id); - newSash.ReqRefreshShape(); - newSash.RefreshHardwareOptionList(); - newSash.SetSelHardware(m_SelHardware); for (int i = 0; i < SashList.Count; i++) { //Cancello SashDimension di default e aggiungo la copia @@ -438,6 +434,11 @@ namespace WebWindowComplex.Models Area newArea = item.Copy(newSash); newSash.AreaList.Add(newArea); } + newSash.SetSelFamilyHardwareFromIndex(m_SelHardware.Id); + newSash.SetSelHardwareFromId(CustomHwId); + //newSash.ReqRefreshShape(); + //newSash.RefreshHardwareOptionList(); + //newSash.SetSelHardware(m_SelHardware); return newSash; } diff --git a/WebWindowComplex/Models/SashDimension.cs b/WebWindowComplex/Models/SashDimension.cs index 9058f22..1d110bc 100644 --- a/WebWindowComplex/Models/SashDimension.cs +++ b/WebWindowComplex/Models/SashDimension.cs @@ -483,29 +483,36 @@ namespace WebWindowComplex.Models if (area.Equals(m_Parent)) return width; Area item = area.AreaList[i]; - if(area is Split) + if (area is Split) { Split split = (Split)area; - switch (split.SplitVertList.ElementAt(i).SelMeasureType) + if (split.SplitVertList.Count > 0) { - case MeasureTypes.ABSOLUT: - { - risultato = CalculateWidthSashGroup(item, split.SplitVertList.ElementAt(i).dDimension); - break; - } - case MeasureTypes.PROPORTIONAL: - { - //risultato = CalculateWidthSashGroup(item, split.SplitVertList.ElementAt(i).dDimension); - break; - } - case MeasureTypes.PERCENTAGE: - { - risultato = CalculateWidthSashGroup(item, split.SplitVertList.ElementAt(i).dDimension * width / 100); - break; - } + switch (split.SplitVertList.ElementAt(i).SelMeasureType) + { + case MeasureTypes.ABSOLUT: + { + risultato = CalculateWidthSashGroup(item, split.SplitVertList.ElementAt(i).dDimension); + break; + } + case MeasureTypes.PROPORTIONAL: + { + //risultato = CalculateWidthSashGroup(item, split.SplitVertList.ElementAt(i).dDimension); + break; + } + case MeasureTypes.PERCENTAGE: + { + risultato = CalculateWidthSashGroup(item, split.SplitVertList.ElementAt(i).dDimension * width / 100); + break; + } + } + if (risultato != -1) + return risultato; + } + else + { + risultato = CalculateWidthSashGroup(item, width); } - if (risultato != -1) - return risultato; } else if (area is Sash) { diff --git a/WebWindowComplex/Models/SplitDimension.cs b/WebWindowComplex/Models/SplitDimension.cs index fef0c3b..0ad1e99 100644 --- a/WebWindowComplex/Models/SplitDimension.cs +++ b/WebWindowComplex/Models/SplitDimension.cs @@ -335,12 +335,18 @@ namespace WebWindowComplex.Models { MeasureTypes newType = (MeasureTypes)value; List splitList = null; + double tot = 0; if (bIsVertListDim) + { splitList = m_Parent.SplitVertList; - else + tot = CalculateWidthSplitGroup(m_Parent.ParentWindow.AreaList.FirstOrDefault(), m_Parent.ParentWindow.AreaList.FirstOrDefault().DimensionList.Where(x => x.sName == "Width").First().dValue); + } + else + { splitList = m_Parent.SplitHorizList; - double widthTot = CalculateWidthSplitGroup(m_Parent.ParentWindow.AreaList.FirstOrDefault(), m_Parent.ParentWindow.AreaList.FirstOrDefault().DimensionList.Where(x => x.sName == "Width").First().dValue); - m_dDimension = ConvertDimension(m_SelMeasureType, newType, widthTot, splitList); + tot = CalculateHeightSplitGroup(m_Parent.ParentWindow.AreaList.FirstOrDefault(), m_Parent.ParentWindow.AreaList.FirstOrDefault().DimensionList.Where(x => x.sName == "Height").First().dValue); + } + m_dDimension = ConvertDimension(m_SelMeasureType, newType, tot, splitList); m_SelMeasureType = (MeasureTypes)value; m_Parent.ParentWindow.OnUpdatePreview(m_Parent.ParentWindow.sSerialized()); } @@ -413,7 +419,7 @@ namespace WebWindowComplex.Models #region Internal Methods /// - /// Metodo per calcolare larghezza intera split group + /// Metodo per calcolare larghezza intero split group /// /// area di partenza /// larghezza di partenza @@ -429,26 +435,33 @@ namespace WebWindowComplex.Models if (area is Split) { Split split = (Split)area; - switch (split.SplitVertList.ElementAt(i).SelMeasureType) + if(split.SplitVertList.Count > 0) { - case MeasureTypes.ABSOLUT: - { - risultato = CalculateWidthSplitGroup(item, split.SplitVertList.ElementAt(i).dDimension); - break; - } - case MeasureTypes.PROPORTIONAL: - { - //risultato = CalculateWidthSplitGroup(item, split.SplitVertList.ElementAt(i).dDimension); - break; - } - case MeasureTypes.PERCENTAGE: - { - risultato = CalculateWidthSplitGroup(item, split.SplitVertList.ElementAt(i).dDimension * width / 100); - break; - } + switch (split.SplitVertList.ElementAt(i).SelMeasureType) + { + case MeasureTypes.ABSOLUT: + { + risultato = CalculateWidthSplitGroup(item, split.SplitVertList.ElementAt(i).dDimension); + break; + } + case MeasureTypes.PROPORTIONAL: + { + //risultato = CalculateWidthSplitGroup(item, split.SplitVertList.ElementAt(i).dDimension); + break; + } + case MeasureTypes.PERCENTAGE: + { + risultato = CalculateWidthSplitGroup(item, split.SplitVertList.ElementAt(i).dDimension * width / 100); + break; + } + } + if (risultato != -1) + return risultato; + } + else + { + risultato = CalculateWidthSplitGroup(item, width); } - if (risultato != -1) - return risultato; } else if (area is Sash) { @@ -484,6 +497,85 @@ namespace WebWindowComplex.Models return width; } + /// + /// Metodo per calcolare altezza intero split group + /// + /// area di partenza + /// larghezza di partenza + /// + internal double CalculateHeightSplitGroup(Area area, double width) + { + for (int i = 0; i < area.AreaList.Count; i++) + { + double risultato = -1; + if (area.Equals(m_Parent)) + return width; + Area item = area.AreaList[i]; + if (area is Split) + { + Split split = (Split)area; + if (split.SplitHorizList.Count > 0) + { + switch (split.SplitHorizList.ElementAt(i).SelMeasureType) + { + case MeasureTypes.ABSOLUT: + { + risultato = CalculateHeightSplitGroup(item, split.SplitVertList.ElementAt(i).dDimension); + break; + } + case MeasureTypes.PROPORTIONAL: + { + //risultato = CalculateHeightSplitGroup(item, split.SplitVertList.ElementAt(i).dDimension); + break; + } + case MeasureTypes.PERCENTAGE: + { + risultato = CalculateHeightSplitGroup(item, split.SplitVertList.ElementAt(i).dDimension * width / 100); + break; + } + } + if (risultato != -1) + return risultato; + } + else + { + risultato = CalculateHeightSplitGroup(item, width); + } + } + else if (area is Sash) + { + Sash sash = (Sash)area; + switch (sash.SashList.ElementAt(i).SelMeasureType) + { + case MeasureTypes.ABSOLUT: + { + risultato = CalculateHeightSplitGroup(item, sash.SashList.ElementAt(i).dDimension); + break; + } + case MeasureTypes.PROPORTIONAL: + { + //risultato = CalculateHeightSplitGroup(item, sash.SashList.ElementAt(i).dDimension); + break; + } + case MeasureTypes.PERCENTAGE: + { + risultato = CalculateHeightSplitGroup(item, sash.SashList.ElementAt(i).dDimension * width / 100); + break; + } + } + if (risultato != -1) + return risultato; + } + else + { + risultato = CalculateHeightSplitGroup(item, width); + if (risultato != -1) + return risultato; + } + } + return width; + } + /// /// Calcolo MCD /// @@ -684,6 +776,27 @@ namespace WebWindowComplex.Models m_SelMeasureType = value; } + internal void SetSelMeasureType(MeasureTypes value) + { + if (m_SelMeasureType != (MeasureTypes)value) + { + MeasureTypes newType = (MeasureTypes)value; + double tot = 0; + if (bIsVertListDim) + { + tot = CalculateWidthSplitGroup(m_Parent.ParentWindow.AreaList.FirstOrDefault(), m_Parent.ParentWindow.AreaList.FirstOrDefault().DimensionList.Where(x => x.sName == "Width").First().dValue); + m_dDimension = ConvertDimension(m_SelMeasureType, newType, tot, m_Parent.SplitVertList); + } + else + { + tot = CalculateHeightSplitGroup(m_Parent.ParentWindow.AreaList.FirstOrDefault(), m_Parent.ParentWindow.AreaList.FirstOrDefault().DimensionList.Where(x => x.sName == "Height").First().dValue); + m_dDimension = ConvertDimension(m_SelMeasureType, newType, tot, m_Parent.SplitHorizList); + } + m_SelMeasureType = (MeasureTypes)value; + //m_Parent.ParentWindow.OnUpdatePreview(m_Parent.ParentWindow.sSerialized()); + } + } + #endregion Internal Methods #region Private Fields diff --git a/WebWindowComplex/TableComp.razor b/WebWindowComplex/TableComp.razor index 19a2b4b..465c4a6 100644 --- a/WebWindowComplex/TableComp.razor +++ b/WebWindowComplex/TableComp.razor @@ -108,7 +108,8 @@ EC_SwapTwoAree="SwapTwoAree" EC_RemoveArea="RemoveArea" EC_ReqResetDictShape="ReqResetDict" - EC_ChangeStartVert="changeStartVert" + EC_ChangeStartVert="changeStartVert" + EC_UpdateSplit="UpdateSplit" EC_ReqClose="ReturnTree"> diff --git a/WebWindowComplex/TableComp.razor.cs b/WebWindowComplex/TableComp.razor.cs index e84c1ed..41bc7f3 100644 --- a/WebWindowComplex/TableComp.razor.cs +++ b/WebWindowComplex/TableComp.razor.cs @@ -842,9 +842,6 @@ namespace WebWindowComplex } if (SashList.Count > 0) currAnta = 0; -#if false - _ = InvokeAsync(StateHasChanged); -#endif // Aggiorno window con dati shape e hw option UpdateDict(); } @@ -1204,6 +1201,11 @@ namespace WebWindowComplex a.SetParentArea(currSplitted); // Aggiungo copia a Splitted currSplitted.AreaList.Add(a); + // richiedo update shape della sash appena aggiunta + List reqList = SashList.Select(x => x.GroupId).ToList(); + reqList.Add(a.GroupId); + //List reqList = new List { currSplitted.AreaList.First().GroupId }; + await DoReqShape(reqList); await DoPreviewSvg(); } @@ -1379,6 +1381,24 @@ namespace WebWindowComplex return null; } + private Area SearchSashSplit(Area currentArea, int idSearch, Area newItem) + { + if (currentArea.GroupId == idSearch && currentArea.AreaType.Equals(newItem.AreaType)) + { + currentArea = newItem; + return currentArea; + } + foreach (Area child in currentArea.AreaList) + { + Area found = SearchSashSplit(child, idSearch, newItem); + if (found != null) + { + return found; + } + } + return null; + } + /// /// Selezione del colore /// @@ -1438,12 +1458,13 @@ namespace WebWindowComplex await DoPreviewSvg(true, true); if (currArea is Split) { - List reqShape = new List(); - if (currArea.AreaList[0].AreaList.Where(x => x.AreaType == AreaTypes.SASH).ToList().Count() > 0) - reqShape.Add(currArea.AreaList[0].AreaList.Where(x => x.AreaType == AreaTypes.SASH).Select(x => x.GroupId).FirstOrDefault()); - if (currArea.AreaList[1].AreaList.Where(x => x.AreaType == AreaTypes.SASH).ToList().Count() > 0) - reqShape.Add(currArea.AreaList[1].AreaList.Where(x => x.AreaType == AreaTypes.SASH).Select(x => x.GroupId).FirstOrDefault()); - await DoReqShape(reqShape); + List reqList = SashList.Select(x => x.GroupId).ToList(); + //List reqShape = new List(); + //if (currArea.AreaList[0].AreaList.Where(x => x.AreaType == AreaTypes.SASH).ToList().Count() > 0) + // reqShape.Add(currArea.AreaList[0].AreaList.Where(x => x.AreaType == AreaTypes.SASH).Select(x => x.GroupId).FirstOrDefault()); + //if (currArea.AreaList[1].AreaList.Where(x => x.AreaType == AreaTypes.SASH).ToList().Count() > 0) + // reqShape.Add(currArea.AreaList[1].AreaList.Where(x => x.AreaType == AreaTypes.SASH).Select(x => x.GroupId).FirstOrDefault()); + await DoReqShape(reqList); } } @@ -1517,6 +1538,12 @@ namespace WebWindowComplex await DoPreviewSvg(); } + private async Task UpdateSplit(Split newSplit) + { + SearchSashSplit(FrameWindow, newSplit.GroupId, newSplit); + await DoPreviewSvg(); + } + /// /// Aggiornamento Shape x ogni Group di Sash della finestra /// diff --git a/WebWindowComplex/WebWindowComplex.csproj b/WebWindowComplex/WebWindowComplex.csproj index e3eb945..9e53b2f 100644 --- a/WebWindowComplex/WebWindowComplex.csproj +++ b/WebWindowComplex/WebWindowComplex.csproj @@ -6,7 +6,7 @@ net8.0 enable enable - 2.7.11.2414 + 2.7.11.2509 Annamaria Sassi Egalware Componente gestione Configurazioni avanzate Window per LUX @@ -147,6 +147,13 @@ + + + + + + + diff --git a/WebWindowConfigurator/WebWindowConfigurator.csproj b/WebWindowConfigurator/WebWindowConfigurator.csproj index 4cded15..2d45d1c 100644 --- a/WebWindowConfigurator/WebWindowConfigurator.csproj +++ b/WebWindowConfigurator/WebWindowConfigurator.csproj @@ -6,7 +6,7 @@ net8.0 enable enable - 2.7.11.2414 + 2.7.11.2509 Annamaria Sassi Egalware Componente gestione JWD per LUX @@ -223,6 +223,8 @@ + + From 30e69bde862ccea97fab3e88b271075f219d8fcc Mon Sep 17 00:00:00 2001 From: Annamaria Sassi Date: Wed, 26 Nov 2025 10:30:53 +0100 Subject: [PATCH 10/18] Aggiornato modo per sollevare gli eventi di Frame, Fill, Splitted, Joint --- WebWindowComplex/Compo/AreaSplit.razor | 6 +- WebWindowComplex/Compo/AreaSplit.razor.cs | 62 +--- WebWindowComplex/Compo/CardFill.razor | 16 +- WebWindowComplex/Compo/CardFill.razor.cs | 76 +--- WebWindowComplex/Compo/CardFrame.razor | 2 +- WebWindowComplex/Compo/CardFrame.razor.cs | 117 ++++--- WebWindowComplex/Compo/EditJoint.razor | 5 +- WebWindowComplex/Compo/EditJoint.razor.cs | 2 +- WebWindowComplex/Json/JsonUtility.cs | 2 +- WebWindowComplex/Models/Area.cs | 2 +- WebWindowComplex/Models/Fill.cs | 2 - WebWindowComplex/Models/Frame.cs | 5 - WebWindowComplex/Models/FrameDimension.cs | 37 +- WebWindowComplex/Models/Joint.cs | 4 +- WebWindowComplex/Models/Sash.cs | 2 +- WebWindowComplex/Models/SashDimension.cs | 2 +- WebWindowComplex/TableComp.razor | 73 ++-- WebWindowComplex/TableComp.razor.cs | 326 ++++++++---------- WebWindowComplex/WebWindowComplex.csproj | 3 +- .../WebWindowConfigurator.csproj | 15 +- 20 files changed, 356 insertions(+), 403 deletions(-) diff --git a/WebWindowComplex/Compo/AreaSplit.razor b/WebWindowComplex/Compo/AreaSplit.razor index da7b8e5..96087ee 100644 --- a/WebWindowComplex/Compo/AreaSplit.razor +++ b/WebWindowComplex/Compo/AreaSplit.razor @@ -1,12 +1,12 @@ 
-
+
Area split @(SplittedList.Count > 1 ? (SplittedList.IndexOf(CurrSplitted) + 1) : "")
- +
@@ -14,7 +14,7 @@ { int Index = j;
- +
}
diff --git a/WebWindowComplex/Compo/AreaSplit.razor.cs b/WebWindowComplex/Compo/AreaSplit.razor.cs index 1fc6f46..a2d43a2 100644 --- a/WebWindowComplex/Compo/AreaSplit.razor.cs +++ b/WebWindowComplex/Compo/AreaSplit.razor.cs @@ -11,32 +11,26 @@ namespace WebWindowComplex.Compo /// /// Lista delle sash /// - [CascadingParameter(Name = "SashList")] - public List SashList { get; set; } = null; + [Parameter] + public List SashList { get; set; } = null!; /// /// Oggetto splitted corrente /// [Parameter] - public Splitted CurrSplitted { get; set; } = null; + public Splitted CurrSplitted { get; set; } = null!; /// /// Lista degli Splitted /// - [CascadingParameter(Name = "SplittedList")] - public List SplittedList { get; set; } = null; - - /// - /// Evento per copiare Sash - /// [Parameter] - public EventCallback EC_CopySash { get; set; } + public List SplittedList { get; set; } = null!; /// /// Evento per aggiungere Sash /// [Parameter] - public EventCallback EC_AddSash { get; set; } + public EventCallback EC_UpdateSplitted { get; set; } #endregion Public Properties @@ -46,46 +40,28 @@ namespace WebWindowComplex.Compo /// Sollevo evento richiesta copia sash ///
/// - private async Task RaiseCopySash(Splitted item, int indexCurrSash) + private async Task RaiseCopySash(int indexCurrSash) { - var Args = new DataAreaSplit - { - splitted = item, - index = indexCurrSash, - }; - await EC_CopySash.InvokeAsync(Args); + //Rimuovo contenuto di Splitted e rimuovo area da conteggio gruppi + CurrSplitted.AreaList.RemoveAll(i => i != null); + // Copio sash + Area a = SashList[indexCurrSash].Copy(CurrSplitted); + a.SetParentArea(CurrSplitted); + // Aggiungo copia a Splitted + CurrSplitted.AreaList.Add(a); + await EC_UpdateSplitted.InvokeAsync(CurrSplitted); } /// - /// Sollevo evento richiesta copia sash + /// Sollevo evento richiesta aggiunta sash /// /// - private async Task RaiseAddSash(Splitted item) + private async Task RaiseAddSash() { - var Args = new DataAreaSplitted - { - splitted = item - }; - await EC_AddSash.InvokeAsync(Args); + CurrSplitted.AddFirstSash(); + await EC_UpdateSplitted.InvokeAsync(CurrSplitted); } + #endregion Private Methods - - } - - /// - /// Classe per raggruppare oggetti che servono per copiare Sash - /// - public class DataAreaSplit - { - public Splitted splitted { get; set; } - public int index { get; set; } - } - - /// - /// Classe per raggruppare oggetti che servono per aggiungere Sash - /// - public class DataAreaSplitted - { - public Splitted splitted { get; set; } } } \ No newline at end of file diff --git a/WebWindowComplex/Compo/CardFill.razor b/WebWindowComplex/Compo/CardFill.razor index 6ca8e54..8f357f6 100644 --- a/WebWindowComplex/Compo/CardFill.razor +++ b/WebWindowComplex/Compo/CardFill.razor @@ -1,7 +1,7 @@ 
-
+
Fill @(CurrIndex + 1)
@@ -11,8 +11,8 @@
-
-
+
+
Select only current fill
@@ -26,7 +26,7 @@
-
+ @*
Selected all fill
@@ -40,16 +40,16 @@
-
+
*@
-@foreach (var currSplitted in SplittedList) +@* @foreach (var currSplitted in SplittedList) { - @if (currSplitted.AreaList.First().Equals(CurrItem)) + @if (currSplitted.AreaList.First().Equals(CurrFill)) { } -} +} *@ diff --git a/WebWindowComplex/Compo/CardFill.razor.cs b/WebWindowComplex/Compo/CardFill.razor.cs index c9837dd..5ee1ddc 100644 --- a/WebWindowComplex/Compo/CardFill.razor.cs +++ b/WebWindowComplex/Compo/CardFill.razor.cs @@ -18,31 +18,13 @@ namespace WebWindowComplex.Compo /// Fill corrente rispetto alla lista fill /// [Parameter] - public Fill CurrItem { get; set; } = null!; + public Fill CurrFill { get; set; } = null!; /// /// Evento per cambiare tutti i fill /// [Parameter] - public EventCallback EC_ChangeAllType { get; set; } - - /// - /// Evento per cambiare solo il fill corrente - /// - [Parameter] - public EventCallback EC_ChangeType { get; set; } - - /// - /// Evento per copiare sash - /// - [Parameter] - public EventCallback EC_CopySash { get; set; } - - /// - /// Evento per aggiungere sash - /// - [Parameter] - public EventCallback EC_AddSash { get; set; } + public EventCallback EC_UpdatePreviewFill { get; set; } /// /// Evento per tornare nella pagine Tree @@ -50,39 +32,10 @@ namespace WebWindowComplex.Compo [Parameter] public EventCallback EC_ReqClose { get; set; } - /// - /// Lista dei Fill - /// - [Parameter] - public List FillList { get; set; } = null!; - - /// - /// Lista delle sash - /// - [CascadingParameter(Name = "SashList")] - public List SashList { get; set; } = null!; - - /// - /// Lista degli Splitted - /// - [CascadingParameter(Name = "SplittedList")] - public List SplittedList { get; set; } = null!; - - #endregion Public Properties #region Protected Methods - /// - /// Sollevo evento per cambiare tutti i Fill - /// - /// tipo di fill richiesto - /// - protected async Task ChangeAllFill(FillTypes reqFillType) - { - await EC_ChangeAllType.InvokeAsync(reqFillType); - } - /// /// Sollevo evento per cambiare solo il Fill corrente /// @@ -90,27 +43,8 @@ namespace WebWindowComplex.Compo /// protected async Task ChangeOneFill(FillTypes reqFillType) { - await EC_ChangeType.InvokeAsync(reqFillType); - } - - /// - /// Sollevo evento per copiare sash - /// - /// - /// - protected async Task CopySash(DataAreaSplit Args) - { - await EC_CopySash.InvokeAsync(Args); - } - - /// - /// Sollevo evento per aggiungere sash - /// - /// - /// - protected async Task AddSash(DataAreaSplitted Args) - { - await EC_AddSash.InvokeAsync(Args); + CurrFill.SetFillType(reqFillType); + await EC_UpdatePreviewFill.InvokeAsync(CurrFill); } #endregion Protected Methods @@ -131,7 +65,7 @@ namespace WebWindowComplex.Compo /// private string buttonFillCss(FillTypes reqFillTypes) { - return (FillList.ElementAt(CurrIndex).SelFillType == reqFillTypes) ? "btn btn-secondary btn-sm" : "btn btn-outline-secondary btn-sm"; + return (CurrFill.SelFillType == reqFillTypes) ? "btn btn-secondary btn-sm" : "btn btn-outline-secondary btn-sm"; } #endregion Private Methods diff --git a/WebWindowComplex/Compo/CardFrame.razor b/WebWindowComplex/Compo/CardFrame.razor index 6497113..a80562e 100644 --- a/WebWindowComplex/Compo/CardFrame.razor +++ b/WebWindowComplex/Compo/CardFrame.razor @@ -88,7 +88,7 @@
Quantity - +
} diff --git a/WebWindowComplex/Compo/CardFrame.razor.cs b/WebWindowComplex/Compo/CardFrame.razor.cs index d4c2c99..b2b2e29 100644 --- a/WebWindowComplex/Compo/CardFrame.razor.cs +++ b/WebWindowComplex/Compo/CardFrame.razor.cs @@ -7,24 +7,6 @@ namespace WebWindowComplex.Compo { #region Public Properties - /// - /// Evento per aggiungere sash - /// - [Parameter] - public EventCallback EC_AddSash { get; set; } - - /// - /// Evento per aggiungere split - /// - [Parameter] - public EventCallback EC_AddSplit { get; set; } - - /// - /// Evento per cambiare tutti i Joints - /// - [Parameter] - public EventCallback EC_ChangeAllJoints { get; set; } - /// /// Evento per tornare nella pagine Tree /// @@ -38,16 +20,16 @@ namespace WebWindowComplex.Compo public EventCallback EC_ReqResetDictShape { get; set; } /// - /// Evento per aggiornare info frame (es cambaire tutti i Joints) + /// Evento per richiedere reset dizionario Shape /// [Parameter] - public EventCallback EC_UpdateFrame { get; set; } - + public EventCallback EC_ReqOptionHw { get; set; } + /// - /// Evento per richiesta calcolo Shape + /// Evento per richiesta calcolo preview /// [Parameter] - public EventCallback EC_UpdateShape { get; set; } + public EventCallback EC_UpdatePreview { get; set; } /// /// Frame corrente @@ -85,8 +67,36 @@ namespace WebWindowComplex.Compo { s.SelHardwareFromId = "000000"; } - _ = EC_UpdateFrame.InvokeAsync(CurrFrameWindow); - _ = EC_UpdateShape.InvokeAsync(CurrFrameWindow); + _ = EC_ReqOptionHw.InvokeAsync(CurrFrameWindow); + var args = new DataUpdateFrame() + { + currFrame = CurrFrameWindow, + svgNoHw = true + }; + _ = EC_UpdatePreview.InvokeAsync(args); + //_ = EC_UpdateShape.InvokeAsync(CurrFrameWindow); + } + } + } + + protected int FrameBottomRailQty + { + get => CurrFrameWindow.BottomRailQty; + set + { + if (CurrFrameWindow.BottomRailQty != value) + { + CurrFrameWindow.BottomRailQty = value; + if (CurrFrameWindow.BottomRailQty > 0) + CurrFrameWindow.SetBottomRail(true); + else + CurrFrameWindow.SetBottomRail(false); + var args = new DataUpdateFrame() + { + currFrame = CurrFrameWindow, + svgNoHw = false + }; + _ = EC_UpdatePreview.InvokeAsync(args); } } } @@ -101,8 +111,13 @@ namespace WebWindowComplex.Compo /// private async Task AddSash() { - //await EC_UpdateShape.InvokeAsync(FrameWindow); - await EC_AddSash.InvokeAsync(true); + CurrFrameWindow.AddFirstSash(); + var args = new DataUpdateFrame() + { + currFrame = CurrFrameWindow, + svgNoHw = true + }; + await EC_UpdatePreview.InvokeAsync(args); } /// @@ -111,7 +126,14 @@ namespace WebWindowComplex.Compo /// private async Task AddSplit() { - await EC_AddSplit.InvokeAsync(true); + CurrFrameWindow.AddSplit(); + var args = new DataUpdateFrame() + { + currFrame = CurrFrameWindow, + svgNoHw = true + }; + await EC_ReqResetDictShape.InvokeAsync(); + await EC_UpdatePreview.InvokeAsync(args); } /// @@ -120,12 +142,19 @@ namespace WebWindowComplex.Compo /// private async Task ChangeAllJoints(Json.WindowConst.Joints JointType, Area a) { - var Args = new DataChangeJoints + if (a is Frame) { - currJointType = JointType, - currArea = a, + foreach (Joint joint in CurrFrameWindow.JointList) + { + joint.SetSelJointType(JointType); + } + } + var args = new DataUpdateFrame() + { + currFrame = CurrFrameWindow, + svgNoHw = false }; - await EC_ChangeAllJoints.InvokeAsync(Args); + await EC_UpdatePreview.InvokeAsync(args); } /// @@ -148,8 +177,13 @@ namespace WebWindowComplex.Compo if (updRec != null) { currRec = updRec; - await EC_UpdateShape.InvokeAsync(CurrFrameWindow); - await EC_UpdateFrame.InvokeAsync(CurrFrameWindow); + var args = new DataUpdateFrame() + { + currFrame = CurrFrameWindow, + svgNoHw = true + }; + await EC_ReqResetDictShape.InvokeAsync(); + await EC_UpdatePreview.InvokeAsync(args); } } @@ -166,7 +200,12 @@ namespace WebWindowComplex.Compo if (updRec != null) { currRec = updRec; - await EC_UpdateFrame.InvokeAsync(CurrFrameWindow); + var args = new DataUpdateFrame() + { + currFrame = CurrFrameWindow, + svgNoHw = false + }; + await EC_UpdatePreview.InvokeAsync(args); } } @@ -184,14 +223,14 @@ namespace WebWindowComplex.Compo } /// - /// Classe per raggruppare oggetti che servono per copiare Sash + /// Classe per raggruppare oggetti che servono per aggiornare frame /// - public class DataChangeJoints + public class DataUpdateFrame { #region Public Properties - public Area currArea { get; set; } = null!; - public Json.WindowConst.Joints currJointType { get; set; } + public Frame currFrame { get; set; } = null!; + public bool svgNoHw { get; set; } = false; #endregion Public Properties } diff --git a/WebWindowComplex/Compo/EditJoint.razor b/WebWindowComplex/Compo/EditJoint.razor index f2545cc..1489955 100644 --- a/WebWindowComplex/Compo/EditJoint.razor +++ b/WebWindowComplex/Compo/EditJoint.razor @@ -1,13 +1,10 @@ @using static WebWindowComplex.LayoutConst
- @foreach (var typeJoint in CurrRec.JointTypeList) { } - @* - - *@
\ No newline at end of file diff --git a/WebWindowComplex/Compo/EditJoint.razor.cs b/WebWindowComplex/Compo/EditJoint.razor.cs index 2835920..6f2c6be 100644 --- a/WebWindowComplex/Compo/EditJoint.razor.cs +++ b/WebWindowComplex/Compo/EditJoint.razor.cs @@ -17,7 +17,7 @@ namespace WebWindowComplex.Compo #region Private Properties - private int CurrVal + private int CurrJoint { get => CurrRec.SelJointTypeIndex; set diff --git a/WebWindowComplex/Json/JsonUtility.cs b/WebWindowComplex/Json/JsonUtility.cs index 235fea4..616a03a 100644 --- a/WebWindowComplex/Json/JsonUtility.cs +++ b/WebWindowComplex/Json/JsonUtility.cs @@ -251,7 +251,7 @@ namespace WebWindowComplex.Json newFrame.SetBottomRailQty(m_nBottomRailQty); //Frame.AppliedDone(); for (var DimensionIndex = 0; DimensionIndex <= m_DimensionList.Count - 1; DimensionIndex++) - newFrame.DimensionList[DimensionIndex].dValue = m_DimensionList[DimensionIndex].Value; + newFrame.DimensionList[DimensionIndex].SetDimension(m_DimensionList[DimensionIndex].Value); for (var JointIndex = 0; JointIndex <= m_JointList.Count - 1; JointIndex++) newFrame.JointList[JointIndex].SetSelJointType(m_JointList[JointIndex].JointType); foreach (var Area in AreaList) diff --git a/WebWindowComplex/Models/Area.cs b/WebWindowComplex/Models/Area.cs index 26ee675..c60e9e2 100644 --- a/WebWindowComplex/Models/Area.cs +++ b/WebWindowComplex/Models/Area.cs @@ -157,7 +157,7 @@ namespace WebWindowComplex.Models // All'area Split aggiunto le due aree Splitted for (int i = 0; i < 2; i++) AreaList[0].AreaList.Add(newSplittedList[i]); - ParentWindow.OnUpdatePreview(ParentWindow.sSerialized()); + //ParentWindow.OnUpdatePreview(ParentWindow.sSerialized()); } public abstract Area Copy(Area ParentArea); diff --git a/WebWindowComplex/Models/Fill.cs b/WebWindowComplex/Models/Fill.cs index 27cb798..30beb75 100644 --- a/WebWindowComplex/Models/Fill.cs +++ b/WebWindowComplex/Models/Fill.cs @@ -52,7 +52,6 @@ namespace WebWindowComplex.Models set { m_SelFillType = (FillTypes)IdNameStruct.IdFromInd(value, m_FillTypeList); - m_ParentWindow.OnUpdatePreview(m_ParentWindow.sSerialized()); } } @@ -97,7 +96,6 @@ namespace WebWindowComplex.Models internal void SetSelFillType(FillTypes value) { m_SelFillType = value; - //m_ParentWindow.OnUpdatePreview(m_ParentWindow.sSerialized()); } internal void SetFillType(FillTypes value) { diff --git a/WebWindowComplex/Models/Frame.cs b/WebWindowComplex/Models/Frame.cs index 3e231f5..72d4a03 100644 --- a/WebWindowComplex/Models/Frame.cs +++ b/WebWindowComplex/Models/Frame.cs @@ -29,7 +29,6 @@ namespace WebWindowComplex.Models set { m_bBottomRail = value; - m_ParentWindow.OnUpdatePreview(m_ParentWindow.sSerialized()); } } @@ -53,7 +52,6 @@ namespace WebWindowComplex.Models m_bBottomRail = false; } } - m_ParentWindow.OnUpdatePreview(m_ParentWindow.sSerialized()); } } @@ -79,12 +77,10 @@ namespace WebWindowComplex.Models { get { - //return IdNameStruct.IndFromId((int)m_Shape, m_ShapeList); return (int)m_Shape; } set { - //Shapes SelShape = (Shapes)IdNameStruct.IdFromInd(value, m_ShapeList); Shapes SelShape = (Shapes)value; if (m_Shape != SelShape) { @@ -213,7 +209,6 @@ namespace WebWindowComplex.Models } m_Shape = SelShape; } - //m_ParentWindow.OnUpdatePreview(m_ParentWindow.sSerialized()); } } diff --git a/WebWindowComplex/Models/FrameDimension.cs b/WebWindowComplex/Models/FrameDimension.cs index 9636022..bf08b2a 100644 --- a/WebWindowComplex/Models/FrameDimension.cs +++ b/WebWindowComplex/Models/FrameDimension.cs @@ -33,18 +33,20 @@ namespace WebWindowComplex.Models } set { - m_dValue = value; - if (value > MaxDim) + if(m_dValue != value) { - m_dValue = MaxDim; + m_dValue = value; + if (value > MaxDim) + { + m_dValue = MaxDim; + } + else if (value < MinDim && !m_sName.Equals("Radius")) + { + m_dValue = MinDim; + } + if (ParentFrame.AreaList.Count > 0) + SearchAreaList(ParentFrame); } - else if (value < MinDim && !m_sName.Equals("Radius")) - { - m_dValue = MinDim; - } - if (ParentFrame.AreaList.Count > 0) - SearchAreaList(ParentFrame); - m_ParentFrame.ParentWindow.OnUpdatePreview(m_ParentFrame.ParentWindow.sSerialized()); } } @@ -85,9 +87,9 @@ namespace WebWindowComplex.Models if (node != null) { if (node.AreaType.Equals(AreaTypes.SASH)) - calculateWidth((Sash)node); + updateDimSubArea((Sash)node); else if (node.AreaType.Equals(AreaTypes.SPLIT)) - calculateWidth((Split)node); + updateDimSubArea((Split)node); foreach (var item in node.AreaList) { SearchAreaList(item); @@ -95,17 +97,17 @@ namespace WebWindowComplex.Models } } - protected void calculateWidth(Area area) + protected void updateDimSubArea(Area area) { if(area is Sash && sName.Equals("Width")) { Sash sash = (Sash)area; int countAbsolute = sash.SashList.Where(x => x.MeasureType.Equals(MeasureTypes.ABSOLUT)).Count(); - if(countAbsolute == sash.SashList.Count) + if (countAbsolute == sash.SashList.Count) { double sum = sash.SashList.Sum(x => x.dDimension); double res = dValue - sum; - if(res > 0) + if (res > 0) { foreach (var sashDim in sash.SashList) { @@ -154,6 +156,11 @@ namespace WebWindowComplex.Models } } + internal void SetDimension(double dValue) + { + m_dValue = dValue; + } + internal JsonFrameDimension Serialize() { JsonFrameDimension JsonFrameDimension = new JsonFrameDimension(m_nIndex, m_sName, m_dValue); diff --git a/WebWindowComplex/Models/Joint.cs b/WebWindowComplex/Models/Joint.cs index b15340e..d1161ba 100644 --- a/WebWindowComplex/Models/Joint.cs +++ b/WebWindowComplex/Models/Joint.cs @@ -63,14 +63,12 @@ namespace WebWindowComplex.Models { get { - //return IdNameStruct.IndFromId((int)m_SelJointType, m_JointTypeList); return (int)m_SelJointType; } set { - //m_SelJointType = (Joints)IdNameStruct.IdFromInd(value, m_JointTypeList); m_SelJointType = (Joints)value; - m_ParentArea.ParentWindow.OnUpdatePreview(m_ParentArea.ParentWindow.sSerialized()); + //m_ParentArea.ParentWindow.OnUpdatePreview(m_ParentArea.ParentWindow.sSerialized()); } } diff --git a/WebWindowComplex/Models/Sash.cs b/WebWindowComplex/Models/Sash.cs index 75509cb..14eb3b7 100644 --- a/WebWindowComplex/Models/Sash.cs +++ b/WebWindowComplex/Models/Sash.cs @@ -356,7 +356,7 @@ namespace WebWindowComplex.Models { SelHwOptionList.Clear(); } - ReqRefreshHwOption(); + //ReqRefreshHwOption(); //ParentWindow.OnUpdatePreview(ParentWindow.sSerialized()); } } diff --git a/WebWindowComplex/Models/SashDimension.cs b/WebWindowComplex/Models/SashDimension.cs index 1d110bc..ce5cecc 100644 --- a/WebWindowComplex/Models/SashDimension.cs +++ b/WebWindowComplex/Models/SashDimension.cs @@ -216,7 +216,7 @@ namespace WebWindowComplex.Models m_dDimension = value; } // Le dimensioni sono miste o solo in assoluto - else + else { double valueInAbsolute = 0; switch (MeasureType) diff --git a/WebWindowComplex/TableComp.razor b/WebWindowComplex/TableComp.razor index 465c4a6..f6cf387 100644 --- a/WebWindowComplex/TableComp.razor +++ b/WebWindowComplex/TableComp.razor @@ -81,13 +81,10 @@ - + EC_ReqOptionHw="UpdateHwOptionsFrame" + EC_UpdatePreview="UpdatePreviewFrame"> @@ -95,7 +92,7 @@ } else if (currStep == CompileStep.Split) { - @if (currSplit >= SplitList.Count || currSplit == -1) + @if (currSplitIndex >= SplitList.Count || currSplitIndex == -1) { currStep = CompileStep.Tree; } @@ -103,8 +100,8 @@ { - = SashList.Count || currSash == -1) + @if (currSashIndex >= SashList.Count || currSashIndex == -1) { currStep = CompileStep.Tree; } else { - - + = FillList.Count || currFill == -1) + @if (currFillIndex >= FillList.Count || currFillIndex == -1) { currStep = CompileStep.Tree; } else { - - - - - - + + +
+
+
+
+
All fill
+
+
+ +
+
+ +
+
+
+
+ Splitted currSplitted = SplittedList.Where(x => x.AreaList.First().Equals(FillList[currFillIndex])).FirstOrDefault(); + @if (currSplitted != null) { + + + } + @* @foreach (var currSplitted in m_SplittedList) + { + @if (currSplitted.AreaList.First().Equals(FillList[currFillIndex])) + { + + } + } *@ } } else if (currStep == CompileStep.General) { - m_SashList; } + protected List SplittedList + { + get => m_SplittedList; + } + protected string SelColorMaterial { get; set; } = ""; protected string SelFamilyHardware { get; set; } = ""; protected string SelGlass { get; set; } = ""; @@ -776,7 +782,7 @@ namespace WebWindowComplex checkWarnings(); if (SashList.Count > 0) { - currAnta = 0; + currAntaIndex = 0; } if (updRequested) { @@ -824,6 +830,7 @@ namespace WebWindowComplex m_CurrWindow = null; } m_CurrWindow = WindowFromJson.Deserialize(); + FrameWindow = m_CurrWindow.AreaList[0]; m_CurrWindow.OnPreview += M_CurrWindow_OnPreview; m_CurrWindow.OnReqHwOption += M_CurrWindow_OnHwOption; m_CurrWindow.OnReqShape += M_CurrWindow_OnShape; @@ -831,9 +838,9 @@ namespace WebWindowComplex if (m_PreviousWindow != null) { for (int i = 0; i < 2; i++) - m_CurrWindow.AreaList.First().DimensionList[i] = m_PreviousWindow.AreaList.First().DimensionList[i]; + m_CurrWindow.AreaList.First().DimensionList[i].dValue = m_PreviousWindow.AreaList.First().DimensionList[i].dValue; for (int i = 0; i < 4; i++) - m_CurrWindow.AreaList.First().JointList[i] = m_PreviousWindow.AreaList.First().JointList[i]; + m_CurrWindow.AreaList.First().JointList[i].SetSelJointType(m_PreviousWindow.AreaList.First().JointList[i].SelJointType); } if (m_CurrWindow != null) { @@ -841,7 +848,7 @@ namespace WebWindowComplex UpdateLists(); } if (SashList.Count > 0) - currAnta = 0; + currAntaIndex = 0; // Aggiorno window con dati shape e hw option UpdateDict(); } @@ -913,13 +920,13 @@ namespace WebWindowComplex #region Private Fields - private int currAnta = 0; + private int currAntaIndex = 0; - private int currFill = -1; + private int currFillIndex = -1; - private int currSash = -1; + private int currSashIndex = -1; - private int currSplit = -1; + private int currSplitIndex = -1; private CompileStep currStep; @@ -973,8 +980,6 @@ namespace WebWindowComplex private Window? m_PreviousWindow { get; set; } = null; - private string m_SelFamilyHardware { get; set; } = ""; - /// /// Salvataggio JWD precedente x evitare loop su update (aggiornato dopo chiamate redis) /// @@ -989,46 +994,6 @@ namespace WebWindowComplex #region Private Methods - /// - /// Metodo per aggiungere una Sash - /// - /// - /// - private void AddSashIntoSplit(DataAreaSplitted Args) - { - Splitted currSplitted = Args.splitted; - currSplitted.AddFirstSash(); - // ricalcolo liste - UpdateLists(); - // richiedo update shape - List reqList = SashList.Select(x => x.GroupId).ToList(); - _ = DoReqShape(reqList); - //_ = DoReqOptHardware(reqList); - } - - /// - /// Metodo per aggiungere una sash di default al Frame - /// - /// - private void AddSashToFrame(Frame f) - { - f.AddFirstSash(); - // ricalcolo liste - UpdateLists(); - // richiedo update shape - List reqList = SashList.Select(x => x.GroupId).ToList(); - _ = DoReqShape(reqList); - } - - /// - /// Metodo per aggiungere uno split di default al Frame - /// - /// - private void AddSplitToFrame(Frame f) - { - f.AddSplit(); - } - /// /// Metodo per andare allo step successivo /// @@ -1036,9 +1001,9 @@ namespace WebWindowComplex private void AdvStep(CompileStep newStep) { currStep = newStep; - currSash = -1; - currFill = -1; - currSplit = -1; + currSashIndex = -1; + currFillIndex = -1; + currSplitIndex = -1; } /// @@ -1053,39 +1018,6 @@ namespace WebWindowComplex await DoReqOptHardware(reqList, isFirst); } - /// - /// Metodo per settare tutti i Fill in contemporanea - /// - /// tipo di riempimento (GLASS o WOOD) - /// - private async Task ChangeAllFill(FillTypes type) - { - foreach (Fill currFill in FillList) - { - currFill.SetSelFillType(type); - } - await DoPreviewSvg(); - } - - /// - /// Metodo per settare tutti i Joints di Frame o Sash come ANGLED o FULL_H o FULL_V - /// - /// - /// - private async Task ChangeAllJoints(DataChangeJoints Args) - { - WindowConst.Joints type = Args.currJointType; - Area area = Args.currArea; - if (area is Frame) - { - foreach (Joint joint in FrameWindow.JointList) - { - joint.SetSelJointType(type); - } - } - await DoPreviewSvg(); - } - /// /// Metodo per settare tutti i Fill in contemporanea /// @@ -1093,7 +1025,7 @@ namespace WebWindowComplex /// private async Task ChangeOneFill(FillTypes type) { - Fill fillChange = FillList.ElementAt(currFill); + Fill fillChange = FillList.ElementAt(currFillIndex); fillChange.SetSelFillType(type); await DoPreviewSvg(); } @@ -1184,31 +1116,6 @@ namespace WebWindowComplex await DoPreviewSvg(); } - /// - /// Metodo per copiare una Sash intera - /// - /// - /// - private async Task CopySash(DataAreaSplit Args) - { - Splitted currSplitted = Args.splitted; - int numSash = Args.index; - //Rimuovo contenuto di Splitted e rimuovo area da conteggio gruppi - currSplitted.AreaList.RemoveAll(i => i != null); - //Area.DelCounterGroup(); - // Copio sash - Area a = SashList[numSash].Copy(currSplitted); - a.SetParentArea(currSplitted); - // Aggiungo copia a Splitted - currSplitted.AreaList.Add(a); - // richiedo update shape della sash appena aggiunta - List reqList = SashList.Select(x => x.GroupId).ToList(); - reqList.Add(a.GroupId); - //List reqList = new List { currSplitted.AreaList.First().GroupId }; - await DoReqShape(reqList); - await DoPreviewSvg(); - } - /// /// Helper aggiunta elemento a lista caricamento /// @@ -1280,23 +1187,23 @@ namespace WebWindowComplex { case CompileStep.Sash: { - currSash = Index; - currFill = -1; - currSplit = -1; + currSashIndex = Index; + currFillIndex = -1; + currSplitIndex = -1; break; } case CompileStep.Fill: { - currFill = Index; - currSash = -1; - currSplit = -1; + currFillIndex = Index; + currSashIndex = -1; + currSplitIndex = -1; break; } case CompileStep.Split: { - currSplit = Index; - currSash = -1; - currFill = -1; + currSplitIndex = Index; + currSashIndex = -1; + currFillIndex = -1; break; } } @@ -1356,41 +1263,15 @@ namespace WebWindowComplex AdvStep(CompileStep.Tree); } - /// - /// Cerca e aggiorna la sash - /// - /// area corrente che si sta valutando - /// id della sash che si sta cercando - /// nuova sash - /// - private Area SearchSash(Area currentArea, int idSearch, Sash newSash) - { - if (currentArea.GroupId == idSearch && currentArea.AreaType.Equals(AreaTypes.SASH)) - { - currentArea = newSash; - return currentArea; - } - foreach (Area child in currentArea.AreaList) - { - Area found = SearchSash(child, idSearch, newSash); - if (found != null) - { - return found; - } - } - return null; - } - - private Area SearchSashSplit(Area currentArea, int idSearch, Area newItem) + private Area SearchArea(Area currentArea, int idSearch, Area itemSearch) { - if (currentArea.GroupId == idSearch && currentArea.AreaType.Equals(newItem.AreaType)) + if (currentArea.GroupId == idSearch && currentArea.AreaType.Equals(itemSearch.AreaType)) { - currentArea = newItem; return currentArea; } foreach (Area child in currentArea.AreaList) { - Area found = SearchSashSplit(child, idSearch, newItem); + Area found = SearchArea(child, idSearch, itemSearch); if (found != null) { return found; @@ -1477,21 +1358,21 @@ namespace WebWindowComplex { if (testStep == CompileStep.Sash) { - if ((currSash == 0 && Index == 0) || (currSash == 1 && Index == 1)) + if ((currSashIndex == 0 && Index == 0) || (currSashIndex == 1 && Index == 1)) return "nav-link active fw-bold"; else return "nav-link text-secondary"; } else if (testStep == CompileStep.Fill) { - if ((currFill == 0 && Index == 0) || (currFill == 1 && Index == 1)) + if ((currFillIndex == 0 && Index == 0) || (currFillIndex == 1 && Index == 1)) return "nav-link active fw-bold"; else return "nav-link text-secondary"; } else if (testStep == CompileStep.Split) { - if ((currSplit == 0 && Index == 0) || (currSplit == 1 && Index == 1)) + if ((currSplitIndex == 0 && Index == 0) || (currSplitIndex == 1 && Index == 1)) return "nav-link active fw-bold"; else return "nav-link text-secondary"; @@ -1500,16 +1381,119 @@ namespace WebWindowComplex } /// - /// Aggiornamento Frame + /// Metodo per cambiare tutti i Fill e richiedere aggiornamento SVG /// - /// + /// tipo di fill richiesto /// - private async Task UpdateFrame(Frame newFrame) + protected async Task ChangeAllFill(FillTypes reqFillType) { - FrameWindow = newFrame; + updateAllFill(FrameWindow, reqFillType); await DoPreviewSvg(); } + /// + /// Metodo per aggiornare tutti i Fill al nuovo tipo + /// + /// area corrente + /// tipo a cui aggiornare + private void updateAllFill(Area area, FillTypes type) + { + if (area.AreaType.Equals(AreaTypes.FILL)) + { + Fill fill = (Fill)area; + fill.SetSelFillType(type); + return; + } + foreach (Area child in area.AreaList) + { + updateAllFill(child, type); + } + } + + /// + /// Aggiornamento Fill + /// + /// Fill da aggiornare + /// + private async Task UpdatePreviewFill(Fill newFill) + { + if (newFill != null) + { + // cerco il record + var currRec = (Fill)SearchArea(FrameWindow, newFill.GroupId, newFill); + // lo aggiorno + currRec = newFill; + await DoPreviewSvg(); + } + } + + /// + /// Aggiornamento Frame + /// + /// nuovo frame + /// + private async Task UpdatePreviewFrame(DataUpdateFrame args) + { + Frame newFrame = args.currFrame; + bool forceSvgNoHw = args.svgNoHw; + if (newFrame != null) + { + // cerco il record + var currRec = m_CurrWindow.AreaList.FirstOrDefault(x => x.GroupId == newFrame.GroupId); + // lo aggiorno + currRec = newFrame; + if(forceSvgNoHw) + await DoPreviewSvg(true,true); + else + await DoPreviewSvg(); + } + } + + /// + /// Aggiornamento opzioni dato nuovo frame + /// + /// nuovo frame + /// + private async Task UpdateHwOptionsFrame(Frame newFrame) + { + if (newFrame != null) + { + // cerco il record + var currRec = m_CurrWindow.AreaList.FirstOrDefault(x => x.GroupId == newFrame.GroupId); + // lo aggiorno + currRec = newFrame; + // resetto hw lst + await EC_ActionReq.InvokeAsync(DataAction.ResetHwOpt); + // richiesta calcolo opzioni hardware per la singola sash group + List reqList = SashList.Select(x => x.GroupId).ToList(); + // chiamo con gruppo della nuova sash + await DoReqOptHardware(reqList); + } + } + + /// + /// Metodo per aggiornare Splitted + /// + /// Splitted da aggiornare + /// + private async Task UpdatePreviewSplitted(Splitted currSplitted) + { + if (currSplitted != null) + { + var item = SearchArea(FrameWindow, currSplitted.GroupId, currSplitted); + item = currSplitted; + // ricalcolo liste + UpdateLists(); + // richiedo update shape + List reqList = SashList.Select(x => x.GroupId).ToList(); + await DoReqShape(reqList); + await DoPreviewSvg(); + } + + } + + + /// /// Aggiornamento opzioni dato update sash /// @@ -1534,29 +1518,21 @@ namespace WebWindowComplex /// private async Task UpdateSash(Sash newSash) { - SearchSash(FrameWindow, newSash.GroupId, newSash); - await DoPreviewSvg(); + if(newSash != null) + { + Sash item = (Sash)SearchArea(FrameWindow, newSash.GroupId, newSash); + item = newSash; + await DoPreviewSvg(); + } } private async Task UpdateSplit(Split newSplit) { - SearchSashSplit(FrameWindow, newSplit.GroupId, newSplit); - await DoPreviewSvg(); - } - - /// - /// Aggiornamento Shape x ogni Group di Sash della finestra - /// - /// - /// - private async Task UpdateShape(Frame newFrame) - { - FrameWindow = newFrame; - if (SashList.Count > 0) + if (newSplit != null) { - // ciclo x ogni group della mia frame - List reqList = SashList.Select(x => x.GroupId).ToList(); - await DoReqShape(reqList); + Split item = (Split)SearchArea(FrameWindow, newSplit.GroupId, newSplit); + item = newSplit; + await DoPreviewSvg(); } } diff --git a/WebWindowComplex/WebWindowComplex.csproj b/WebWindowComplex/WebWindowComplex.csproj index 9e53b2f..2ac0d81 100644 --- a/WebWindowComplex/WebWindowComplex.csproj +++ b/WebWindowComplex/WebWindowComplex.csproj @@ -6,7 +6,7 @@ net8.0 enable enable - 2.7.11.2509 + 2.7.11.2610 Annamaria Sassi Egalware Componente gestione Configurazioni avanzate Window per LUX @@ -160,5 +160,6 @@ + diff --git a/WebWindowConfigurator/WebWindowConfigurator.csproj b/WebWindowConfigurator/WebWindowConfigurator.csproj index 2d45d1c..50db489 100644 --- a/WebWindowConfigurator/WebWindowConfigurator.csproj +++ b/WebWindowConfigurator/WebWindowConfigurator.csproj @@ -6,7 +6,7 @@ net8.0 enable enable - 2.7.11.2509 + 2.7.11.2610 Annamaria Sassi Egalware Componente gestione JWD per LUX @@ -214,6 +214,19 @@ + + + + + + + + + + + + + From 5f227241f81ab1c6d6d8de26186cf4c6ad3feb36 Mon Sep 17 00:00:00 2001 From: Annamaria Sassi Date: Wed, 26 Nov 2025 12:51:19 +0100 Subject: [PATCH 11/18] - Aggiornato modo per sollevare gli eventi di Split - Aggiunto componente per dimensioni split --- WebWindowComplex/Compo/CardSplit.razor | 76 +++++---- WebWindowComplex/Compo/CardSplit.razor.cs | 150 ++++++++++++++---- WebWindowComplex/Compo/CardTree.razor | 5 + WebWindowComplex/Compo/CardTree.razor.cs | 14 ++ ...nsions.razor => EditFrameDimensions.razor} | 0 ....razor.cs => EditFrameDimensions.razor.cs} | 2 +- .../Compo/EditSplitDimensions.razor | 32 ++++ .../Compo/EditSplitDimensions.razor.cs | 78 +++++++++ WebWindowComplex/Models/Split.cs | 6 +- WebWindowComplex/TableComp.razor | 6 +- WebWindowComplex/TableComp.razor.cs | 18 +++ WebWindowComplex/WebWindowComplex.csproj | 14 +- .../WebWindowConfigurator.csproj | 20 ++- 13 files changed, 355 insertions(+), 66 deletions(-) rename WebWindowComplex/Compo/{EditDimensions.razor => EditFrameDimensions.razor} (100%) rename WebWindowComplex/Compo/{EditDimensions.razor.cs => EditFrameDimensions.razor.cs} (94%) create mode 100644 WebWindowComplex/Compo/EditSplitDimensions.razor create mode 100644 WebWindowComplex/Compo/EditSplitDimensions.razor.cs diff --git a/WebWindowComplex/Compo/CardSplit.razor b/WebWindowComplex/Compo/CardSplit.razor index f2224b6..1e3b240 100644 --- a/WebWindowComplex/Compo/CardSplit.razor +++ b/WebWindowComplex/Compo/CardSplit.razor @@ -4,7 +4,7 @@
-
@(descParentSplit(CurrItem))
+
@(descParentSplit(CurrSplit))
@@ -14,14 +14,14 @@
Split
- @if ((CurrItem.nSplitQtyVert == 1 && CurrItem.nSplitQtyHoriz == 0) || (CurrItem.nSplitQtyVert == 0 && CurrItem.nSplitQtyHoriz == 1)) + @if ((CurrSplit.nSplitQtyVert == 1 && CurrSplit.nSplitQtyHoriz == 0) || (CurrSplit.nSplitQtyVert == 0 && CurrSplit.nSplitQtyHoriz == 1)) {
- +
}
- +
- @if (CurrItem.SelSplitShape == Json.WindowConst.SplitShapes.GRID) + @if (CurrSplit.SelSplitShape == Json.WindowConst.SplitShapes.GRID) {
- +
diff --git a/WebWindowComplex/Compo/CardSplit.razor.cs b/WebWindowComplex/Compo/CardSplit.razor.cs index 9562c05..779cefc 100644 --- a/WebWindowComplex/Compo/CardSplit.razor.cs +++ b/WebWindowComplex/Compo/CardSplit.razor.cs @@ -1,4 +1,5 @@ using Microsoft.AspNetCore.Components; +using Newtonsoft.Json.Linq; using WebWindowComplex.Models; using static WebWindowComplex.Json.WindowConst; @@ -10,13 +11,13 @@ namespace WebWindowComplex.Compo /// Indice dello split corrente rispetto alla lista split ///
[Parameter] - public int CurrIndex { get; set; } = 0; + public int CurrIndex { get; set; } = -1; /// /// Split corrente rispetto alla lista split /// [Parameter] - public Split CurrItem { get; set; } = null!; + public Split CurrSplit { get; set; } = null!; /// /// Lista di sash @@ -30,24 +31,12 @@ namespace WebWindowComplex.Compo [CascadingParameter(Name = "SplitList")] public List SplitList { get; set; } = null!; - /// - /// Evento per scambiare le aree di uno split - /// - [Parameter] - public EventCallback EC_SwapTwoAree { get; set; } - /// /// Evento per rimuovere split /// [Parameter] public EventCallback EC_RemoveArea { get; set; } - /// - /// Evento per cambiare nel caso di split a griglia se inizia con lo split verticale - /// - [Parameter] - public EventCallback EC_ChangeStartVert { get; set; } - /// /// Evento per richiedere reset dizionario Shape /// @@ -55,10 +44,10 @@ namespace WebWindowComplex.Compo public EventCallback EC_ReqResetDictShape { get; set; } /// - /// Evento per aggiornare lo split + /// Evento per aggiornare Split /// [Parameter] - public EventCallback EC_UpdateSplit { get; set; } + public EventCallback EC_UpdatePreview { get; set; } /// /// Evento per tornare nella pagine Tree @@ -71,11 +60,14 @@ namespace WebWindowComplex.Compo /// /// split corrente /// - protected async Task SwapTwoAree(Split item) + protected async Task SwapTwoAree() { - // richiesta reset dict shape - _ = EC_ReqResetDictShape.InvokeAsync(true); - await EC_SwapTwoAree.InvokeAsync(item); + CurrSplit.SwapAree(); + var args = new DataUpdateSplit(){ + currSplit = CurrSplit + }; + await EC_ReqResetDictShape.InvokeAsync(true); + await EC_UpdatePreview.InvokeAsync(args); } /// @@ -90,19 +82,110 @@ namespace WebWindowComplex.Compo await EC_RemoveArea.InvokeAsync(item); } + /// + /// Proprietà per restituire o selezionare shape split + /// + /// + protected int SplitShapeIndex + { + get => CurrSplit.SelSplitShapeIndex; + set + { + if (CurrSplit.SelSplitShapeIndex != value) + { + CurrSplit.SelSplitShapeIndex = value; + var args = new DataUpdateSplit() + { + currSplit = CurrSplit + }; + _ = EC_UpdatePreview.InvokeAsync(args); + } + } + } + + /// + /// Proprietà per restituire o selezionare numero di split verticali + /// + /// + protected int SplitQtyVert + { + get => CurrSplit.nSplitQtyVert; + set + { + if (CurrSplit.nSplitQtyVert != value) + { + CurrSplit.nSplitQtyVert = value; + var args = new DataUpdateSplit() + { + currSplit = CurrSplit + }; + _ = EC_UpdatePreview.InvokeAsync(args); + } + } + } + + /// + /// Proprietà per restituire o selezionare numero di split verticali + /// + /// + protected int SplitQtyHoriz + { + get => CurrSplit.nSplitQtyHoriz; + set + { + if (CurrSplit.nSplitQtyHoriz != value) + { + CurrSplit.nSplitQtyHoriz = value; + var args = new DataUpdateSplit() + { + currSplit = CurrSplit + }; + _ = EC_UpdatePreview.InvokeAsync(args); + } + } + } + + protected async Task UpdateDimension(DataUpdateSplitDimension updRec) + { + SplitDimension currSplitDim = updRec.currSplit; + SplitDimension currRec = null; + // cerco il record + if (currSplitDim.bIsVertListDim) + currRec = CurrSplit.SplitVertList.ElementAt(updRec.index); + else + currRec = CurrSplit.SplitHorizList.ElementAt(updRec.index); + // lo aggiorno + if (currSplitDim != null) + { + currRec = currSplitDim; + var args = new DataUpdateSplit() + { + currSplit = CurrSplit + }; + await EC_ReqResetDictShape.InvokeAsync(); + await EC_UpdatePreview.InvokeAsync(args); + } + } + /// /// Sollevo evento per rimuovere split /// /// split corrente /// - protected async Task ChangeStartVert(ChangeEventArgs e, Split item) + protected async Task ChangeStartVert(ChangeEventArgs e) { - var Args = new DataChangeStartVert + foreach (Split s in SplitList) { - eventArg = e, - currItem = item, + if (s.Equals(CurrSplit)) + { + s.SetSplitStartVert((bool)e.Value); + } + } + var args = new DataUpdateSplit() + { + currSplit = CurrSplit }; - await EC_ChangeStartVert.InvokeAsync(Args); + await EC_UpdatePreview.InvokeAsync(args); } /// @@ -155,18 +238,29 @@ namespace WebWindowComplex.Compo protected async Task SetMeasureType(MeasureTypes type) { isOpen = !isOpen; - foreach (var item in CurrItem.SplitVertList) + foreach (var item in CurrSplit.SplitVertList) { item.SetSelMeasureType(type); } - foreach (var item in CurrItem.SplitHorizList) + foreach (var item in CurrSplit.SplitHorizList) { item.SetSelMeasureType(type); } - await EC_UpdateSplit.InvokeAsync(CurrItem); + var args = new DataUpdateSplit() + { + currSplit = CurrSplit + }; + await EC_UpdatePreview.InvokeAsync(args); } } + /// + /// Classe per raggruppare oggetti che servono per aggiornare split + /// + public class DataUpdateSplit + { + public Split currSplit { get; set; } = null!; + } public class DataChangeStartVert { public ChangeEventArgs eventArg { get; set; } = null!; diff --git a/WebWindowComplex/Compo/CardTree.razor b/WebWindowComplex/Compo/CardTree.razor index 9e7c659..ad3f3d5 100644 --- a/WebWindowComplex/Compo/CardTree.razor +++ b/WebWindowComplex/Compo/CardTree.razor @@ -37,6 +37,11 @@ } + @* @if (ItemTableList[i].Type is Json.WindowConst.AreaTypes.SASH || + ItemTableList[i].Type is Json.WindowConst.AreaTypes.SPLIT) + { + + } *@ } else diff --git a/WebWindowComplex/Compo/CardTree.razor.cs b/WebWindowComplex/Compo/CardTree.razor.cs index 923541a..4a67deb 100644 --- a/WebWindowComplex/Compo/CardTree.razor.cs +++ b/WebWindowComplex/Compo/CardTree.razor.cs @@ -42,6 +42,20 @@ namespace WebWindowComplex.Compo await EC_NextStep.InvokeAsync(Args); } + /// + /// Sollevo evento richiesta prossimo step + /// + /// + private async Task Remove(CompileStep cs, int indexStep) + { + var Args = new DataNextStep + { + currCompileStep = cs, + index = indexStep, + }; + await EC_NextStep.InvokeAsync(Args); + } + /// /// Metodo per riempire tabella con contenuto vuoto o con i simboli per rappresentare la struttura /// diff --git a/WebWindowComplex/Compo/EditDimensions.razor b/WebWindowComplex/Compo/EditFrameDimensions.razor similarity index 100% rename from WebWindowComplex/Compo/EditDimensions.razor rename to WebWindowComplex/Compo/EditFrameDimensions.razor diff --git a/WebWindowComplex/Compo/EditDimensions.razor.cs b/WebWindowComplex/Compo/EditFrameDimensions.razor.cs similarity index 94% rename from WebWindowComplex/Compo/EditDimensions.razor.cs rename to WebWindowComplex/Compo/EditFrameDimensions.razor.cs index d94acb8..b0cb573 100644 --- a/WebWindowComplex/Compo/EditDimensions.razor.cs +++ b/WebWindowComplex/Compo/EditFrameDimensions.razor.cs @@ -3,7 +3,7 @@ using WebWindowComplex.Models; namespace WebWindowComplex.Compo { - public partial class EditDimensions + public partial class EditFrameDimensions { #region Public Properties diff --git a/WebWindowComplex/Compo/EditSplitDimensions.razor b/WebWindowComplex/Compo/EditSplitDimensions.razor new file mode 100644 index 0000000..dd35957 --- /dev/null +++ b/WebWindowComplex/Compo/EditSplitDimensions.razor @@ -0,0 +1,32 @@ + +
+
+ @Name + + +
+
diff --git a/WebWindowComplex/Compo/EditSplitDimensions.razor.cs b/WebWindowComplex/Compo/EditSplitDimensions.razor.cs new file mode 100644 index 0000000..5b2f4e3 --- /dev/null +++ b/WebWindowComplex/Compo/EditSplitDimensions.razor.cs @@ -0,0 +1,78 @@ +using Microsoft.AspNetCore.Components; +using WebWindowComplex.Models; + +namespace WebWindowComplex.Compo +{ + public partial class EditSplitDimensions + { + #region Public Properties + + [Parameter] + public SplitDimension CurrRec { get; set; } = null!; + + [Parameter] + public string Name { get; set; } = null!; + + [Parameter] + public int Index { get; set; } = -1; + + [Parameter] + public EventCallback EC_Update { get; set; } + + #endregion Public Properties + + #region Private Properties + + private double CurrVal + { + get => CurrRec.dDimension; + set + { + if (CurrRec.dDimension != value) + { + CurrRec.dDimension = value; + var args = new DataUpdateSplitDimension() + { + currSplit = CurrRec, + index = Index + }; + _ = EC_Update.InvokeAsync(args); + } + } + } + + private int CurrType + { + get => CurrRec.SelMeasureTypeIndex; + set + { + if (CurrRec.SelMeasureTypeIndex != value) + { + CurrRec.SelMeasureTypeIndex = value; + var args = new DataUpdateSplitDimension() + { + currSplit = CurrRec, + index=Index + }; + _ = EC_Update.InvokeAsync(args); + } + } + } + + private string SplitDimCss() + { + if (CurrRec.Parent.SelSplitShape.Equals(Json.WindowConst.SplitShapes.GRID)) + return ""; + else + return "col-md-12 col-lg-6"; + } + + #endregion Private Properties + } + + public class DataUpdateSplitDimension + { + public SplitDimension currSplit { get; set; } = null!; + public int index { get; set; } = -1; + } +} \ No newline at end of file diff --git a/WebWindowComplex/Models/Split.cs b/WebWindowComplex/Models/Split.cs index 6833f1c..edbc265 100644 --- a/WebWindowComplex/Models/Split.cs +++ b/WebWindowComplex/Models/Split.cs @@ -138,7 +138,7 @@ namespace WebWindowComplex.Models ParentArea.AreaList.Remove(this); } } - m_ParentWindow.OnUpdatePreview(m_ParentWindow.sSerialized()); + //m_ParentWindow.OnUpdatePreview(m_ParentWindow.sSerialized()); } } @@ -229,7 +229,7 @@ namespace WebWindowComplex.Models ParentArea.AreaList.Remove(this); } } - m_ParentWindow.OnUpdatePreview(m_ParentWindow.sSerialized()); + //m_ParentWindow.OnUpdatePreview(m_ParentWindow.sSerialized()); } } @@ -277,7 +277,7 @@ namespace WebWindowComplex.Models newFill.SetAreaType(AreaTypes.FILL); AreaList[SplitIndex].AreaList.Add(newFill); } - m_ParentWindow.OnUpdatePreview(m_ParentWindow.sSerialized()); + //m_ParentWindow.OnUpdatePreview(m_ParentWindow.sSerialized()); } } diff --git a/WebWindowComplex/TableComp.razor b/WebWindowComplex/TableComp.razor index f6cf387..3d6fee2 100644 --- a/WebWindowComplex/TableComp.razor +++ b/WebWindowComplex/TableComp.razor @@ -101,12 +101,10 @@ diff --git a/WebWindowComplex/TableComp.razor.cs b/WebWindowComplex/TableComp.razor.cs index 1f79077..a43ba14 100644 --- a/WebWindowComplex/TableComp.razor.cs +++ b/WebWindowComplex/TableComp.razor.cs @@ -1471,6 +1471,24 @@ namespace WebWindowComplex } } + /// + /// Aggiornamento Frame + /// + /// nuovo frame + /// + private async Task UpdatePreviewSplit(DataUpdateSplit args) + { + Split newSplit = args.currSplit; + if (newSplit != null) + { + // cerco il record + var currRec = SearchArea(FrameWindow, newSplit.GroupId, newSplit); + // lo aggiorno + currRec = newSplit; + await DoPreviewSvg(true, true); + } + } + /// /// Metodo per aggiornare Splitted /// diff --git a/WebWindowComplex/WebWindowComplex.csproj b/WebWindowComplex/WebWindowComplex.csproj index 2ac0d81..ced4217 100644 --- a/WebWindowComplex/WebWindowComplex.csproj +++ b/WebWindowComplex/WebWindowComplex.csproj @@ -6,7 +6,7 @@ net8.0 enable enable - 2.7.11.2610 + 2.7.11.2612 Annamaria Sassi Egalware Componente gestione Configurazioni avanzate Window per LUX @@ -150,6 +150,18 @@ + + + + + + + + + + + + diff --git a/WebWindowConfigurator/WebWindowConfigurator.csproj b/WebWindowConfigurator/WebWindowConfigurator.csproj index 50db489..e154130 100644 --- a/WebWindowConfigurator/WebWindowConfigurator.csproj +++ b/WebWindowConfigurator/WebWindowConfigurator.csproj @@ -6,7 +6,7 @@ net8.0 enable enable - 2.7.11.2610 + 2.7.11.2612 Annamaria Sassi Egalware Componente gestione JWD per LUX @@ -222,6 +222,24 @@ + + + + + + + + + + + + + + + + + + From afa394acecb2c7fa8c9afadda1d359a485288bc5 Mon Sep 17 00:00:00 2001 From: Annamaria Sassi Date: Wed, 26 Nov 2025 13:00:39 +0100 Subject: [PATCH 12/18] Fix nuovi eventi split --- WebWindowComplex/Compo/CardSplit.razor.cs | 5 +++-- WebWindowComplex/Models/Split.cs | 21 +++---------------- WebWindowComplex/TableComp.razor | 20 ++++++++---------- WebWindowComplex/WebWindowComplex.csproj | 8 ++++++- .../WebWindowConfigurator.csproj | 7 ++++++- 5 files changed, 28 insertions(+), 33 deletions(-) diff --git a/WebWindowComplex/Compo/CardSplit.razor.cs b/WebWindowComplex/Compo/CardSplit.razor.cs index 779cefc..24ea780 100644 --- a/WebWindowComplex/Compo/CardSplit.razor.cs +++ b/WebWindowComplex/Compo/CardSplit.razor.cs @@ -22,13 +22,14 @@ namespace WebWindowComplex.Compo /// /// Lista di sash /// - [CascadingParameter(Name = "SashList")] + [Parameter] public List SashList { get; set; } = null!; + /// /// Lista di split /// - [CascadingParameter(Name = "SplitList")] + [Parameter] public List SplitList { get; set; } = null!; /// diff --git a/WebWindowComplex/Models/Split.cs b/WebWindowComplex/Models/Split.cs index edbc265..3963b80 100644 --- a/WebWindowComplex/Models/Split.cs +++ b/WebWindowComplex/Models/Split.cs @@ -20,29 +20,14 @@ namespace WebWindowComplex.Models #region Public Properties - /// - /// Larghezza gruppo split - /// - //public double Width + //public bool bIsPercentage //{ // get // { - // return m_Width; - // } - // set - // { - // m_Width = value; + // return m_bIsPercentage; // } //} - public bool bIsPercentage - { - get - { - return m_bIsPercentage; - } - } - public bool bSplitStartVert { get @@ -52,7 +37,7 @@ namespace WebWindowComplex.Models set { m_bSplitStartVert = value; - m_ParentWindow.OnUpdatePreview(m_ParentWindow.sSerialized()); + //m_ParentWindow.OnUpdatePreview(m_ParentWindow.sSerialized()); } } diff --git a/WebWindowComplex/TableComp.razor b/WebWindowComplex/TableComp.razor index 3d6fee2..91ed528 100644 --- a/WebWindowComplex/TableComp.razor +++ b/WebWindowComplex/TableComp.razor @@ -98,17 +98,15 @@ } else { - - - - - - + + } } else if (currStep == CompileStep.Sash) diff --git a/WebWindowComplex/WebWindowComplex.csproj b/WebWindowComplex/WebWindowComplex.csproj index ced4217..a5708eb 100644 --- a/WebWindowComplex/WebWindowComplex.csproj +++ b/WebWindowComplex/WebWindowComplex.csproj @@ -6,7 +6,7 @@ net8.0 enable enable - 2.7.11.2612 + 2.7.11.2613 Annamaria Sassi Egalware Componente gestione Configurazioni avanzate Window per LUX @@ -168,6 +168,12 @@ + + + + + + diff --git a/WebWindowConfigurator/WebWindowConfigurator.csproj b/WebWindowConfigurator/WebWindowConfigurator.csproj index e154130..8868f5a 100644 --- a/WebWindowConfigurator/WebWindowConfigurator.csproj +++ b/WebWindowConfigurator/WebWindowConfigurator.csproj @@ -6,7 +6,7 @@ net8.0 enable enable - 2.7.11.2612 + 2.7.11.2613 Annamaria Sassi Egalware Componente gestione JWD per LUX @@ -253,6 +253,11 @@ + + + + + From de2f4ed9e9886e0b34aec9a5cc5f137000707211 Mon Sep 17 00:00:00 2001 From: Annamaria Sassi Date: Wed, 26 Nov 2025 17:07:25 +0100 Subject: [PATCH 13/18] Aggiornato modo per sollevare eventi di SashGroup, SashDimension --- README.md | 1 + WebWindowComplex/Compo/AreaHwOption.razor.cs | 28 ++- WebWindowComplex/Compo/AreaSash.razor | 10 +- WebWindowComplex/Compo/AreaSash.razor.cs | 117 +++++---- WebWindowComplex/Compo/CardFrame.razor | 2 +- WebWindowComplex/Compo/CardSashGroup.razor | 22 +- WebWindowComplex/Compo/CardSashGroup.razor.cs | 233 ++++++++++++------ WebWindowComplex/Compo/CardSplit.razor | 4 +- WebWindowComplex/Compo/CardSplit.razor.cs | 38 ++- WebWindowComplex/Models/Area.cs | 5 +- WebWindowComplex/Models/Sash.cs | 42 +--- WebWindowComplex/Models/SashDimension.cs | 1 - WebWindowComplex/Models/Window.cs | 40 +-- WebWindowComplex/TableComp.razor | 33 ++- WebWindowComplex/TableComp.razor.cs | 148 +++-------- WebWindowComplex/WebWindowComplex.csproj | 6 +- .../WebWindowConfigurator.csproj | 10 +- 17 files changed, 368 insertions(+), 372 deletions(-) diff --git a/README.md b/README.md index 2c3d7ea..abf39d1 100644 --- a/README.md +++ b/README.md @@ -105,6 +105,7 @@ La richiesta della forma del gruppo di ante viene trasmessa se si cambiano i seg - Forma del telaio; - Dimensioni del telaio; - Aggiunta di uno split nel frame se già presente un gruppo di ante; + - Se si effettua lo scambio delle aree di uno split e una delle aree contiene una sash - Eliminazione di uno split. La lista degli hardware viene aggiornata se si cambiano i seguenti parametri: diff --git a/WebWindowComplex/Compo/AreaHwOption.razor.cs b/WebWindowComplex/Compo/AreaHwOption.razor.cs index 1b352fc..ae1f6ff 100644 --- a/WebWindowComplex/Compo/AreaHwOption.razor.cs +++ b/WebWindowComplex/Compo/AreaHwOption.razor.cs @@ -14,17 +14,11 @@ namespace WebWindowComplex.Compo [CascadingParameter(Name = "CurrSashGroup")] public Sash CurrSashGroup { get; set; } = null!; - /// - /// Evento per aggiornare gli hardware option di tipo combo - /// - [Parameter] - public EventCallback EC_UpdateHwOptCombo { get; set; } - /// /// Evento per aggiornare gli hardware option di tipo text /// [Parameter] - public EventCallback EC_UpdateHwOptText { get; set; } + public EventCallback EC_UpdateHwOpt { get; set; } /// /// Evento per chiamare la prima volta la lista delle opzioni @@ -50,7 +44,7 @@ namespace WebWindowComplex.Compo hwOptCollapsed = !hwOptCollapsed; if (CurrSashGroup.HwOptionList.Count == 0) { - await EC_FirstHwOptionList.InvokeAsync(CurrSashGroup.GroupId); + await EC_FirstHwOptionList.InvokeAsync(); } } @@ -66,7 +60,11 @@ namespace WebWindowComplex.Compo /// private async Task RaiseOptCombo(AGBOptionCombo updRec) { - await EC_UpdateHwOptCombo.InvokeAsync(updRec); + var args = new DataUpdateHwOption + { + AGBOptCombo = updRec + }; + await EC_UpdateHwOpt.InvokeAsync(args); } /// @@ -76,11 +74,21 @@ namespace WebWindowComplex.Compo /// private async Task RaiseOptText(AGBOptionText updRec) { - await EC_UpdateHwOptText.InvokeAsync(updRec); + var args = new DataUpdateHwOption + { + AGBOptText = updRec + }; + await EC_UpdateHwOpt.InvokeAsync(args); } private bool IsLoadingHwOpt { get => IsLoading != null && IsLoading.Count > 0 && IsLoading.Contains("LoadHwOpt"); } } + + public class DataUpdateHwOption + { + public AGBOptionText AGBOptText { get; set; } = null; + public AGBOptionCombo AGBOptCombo { get; set; } = null; + } } \ No newline at end of file diff --git a/WebWindowComplex/Compo/AreaSash.razor b/WebWindowComplex/Compo/AreaSash.razor index f116fcc..5961b19 100644 --- a/WebWindowComplex/Compo/AreaSash.razor +++ b/WebWindowComplex/Compo/AreaSash.razor @@ -16,8 +16,8 @@ int IndexCopy = k; int IndexModify = IndexSash;
  • -
  • } @@ -67,7 +67,7 @@
    - +
    @@ -153,7 +153,7 @@ else @if (!(CurrAnta.AreaList[0] is Split)) {
    - +
    @@ -203,7 +203,7 @@ else
    - +
    diff --git a/WebWindowComplex/Compo/AreaSash.razor.cs b/WebWindowComplex/Compo/AreaSash.razor.cs index 08d955e..85a5381 100644 --- a/WebWindowComplex/Compo/AreaSash.razor.cs +++ b/WebWindowComplex/Compo/AreaSash.razor.cs @@ -21,6 +21,12 @@ namespace WebWindowComplex.Compo [Parameter] public SashDimension CurrSashDim { get; set; } = null!; + /// + /// Sash group corrente + /// + [CascadingParameter(Name = "SashList")] + public List SashList { get; set; } = null!; + /// /// Sash dimension corrente /// @@ -33,26 +39,21 @@ namespace WebWindowComplex.Compo [Parameter] public int IndexSash { get; set; } = 0; - /// - /// Evento per cambiare l'anta su cui � presente la maniglia - /// - [Parameter] - public EventCallback EC_ChangeHandle { get; set; } - /// /// Evento per aggiornare sash dimension /// [Parameter] public EventCallback EC_UpdateSashDim { get; set; } - /// - /// Evento per cambiare l'anta su cui � presente la maniglia - /// - [Parameter] - public EventCallback EC_CopyContentSash { get; set; } /// - /// Evento per cambiare modalit� di visualizzazione + /// Evento per aggiornare sash + /// + [Parameter] + public EventCallback EC_UpdateSash { get; set; } + + /// + /// Evento per cambiare modalità di visualizzazione /// [Parameter] public EventCallback EC_EditView { get; set; } @@ -131,30 +132,76 @@ namespace WebWindowComplex.Compo /// Sollevo evento per cambiare l'anta su cui � presente la maniglia /// /// - private async Task RaiseChangeHandle(SashDimension sashDim, Sash currSash) + private async Task ChangeHandle() { - var Args = new DataChangeHandle + // Cerco la Sash che si sta considerando nella lista Sash + var s = SashList.Where(x => x.GroupId == CurrSashGroup.GroupId).FirstOrDefault(); + if (s != null) { - currSashDimension = sashDim, - currItem = currSash, - }; - await EC_ChangeHandle.InvokeAsync(Args); + // Setto la presenza o meno della maniglia per ogni anta + foreach (SashDimension item in s.SashList) + { + if (item.Equals(CurrSashDim)) + { + item.bHasHandle = true; + } + else + { + if (item.bHasHandle) + { + switch (item.SelOpeningType) + { + case Openings.TILTTURN_LEFT: + { + item.SetOpeningType(Openings.TURNONLY_LEFT); + break; + } + case Openings.TILTTURN_RIGHT: + { + item.SetOpeningType(Openings.TURNONLY_RIGHT); + break; + } + default: + { + break; + } + } + } + item.bHasHandle = false; + } + } + } + CurrSashGroup.RefreshHardwareList(); + CurrSashGroup.SetFirstHardware(); + await EC_UpdateSash.InvokeAsync(CurrSashGroup); } /// - /// Sollevo evento per cambiare l'anta su cui � presente la maniglia + /// Copio contenuto anta da indexCopy a IndexModify /// /// - private async Task RaiseCopyContentSash(int indexC, int indexM) + private async Task CopyContentSash(int IndexCopy, int IndexModify) { isOpen = !isOpen; - var Args = new DataCopyContentSash - { - currItem = CurrSashGroup, - indexCopy = indexC, - indexModify = indexM, - }; - await EC_CopyContentSash.InvokeAsync(Args); + // Anta selezionata + Area sashSplitted = CurrSashGroup.AreaList[IndexModify]; + // Rimuovo riempimento da anta selezionata + sashSplitted.AreaList.RemoveAt(0); + // Creo la copia dell'anta scelta + Area a = CurrSashGroup.AreaList[IndexCopy].AreaList.First().Copy(sashSplitted); + // Aggiungo copia all'anta selezionata + CurrSashGroup.AreaList[IndexModify].AreaList.Add(a); + await EC_UpdateSash.InvokeAsync(CurrSashGroup); + } + + /// + /// Metodo per aggiungere lo split nella singola anta + /// + /// + private async Task AddSplitToSash() + { + CurrAnta.AddSplit(); + await EC_UpdateSash.InvokeAsync(CurrSashGroup); } private bool isOpen = false; @@ -215,20 +262,4 @@ namespace WebWindowComplex.Compo public int IndexSashClose { get; set; } } - public class DataChangeHandle - { - public SashDimension currSashDimension { get; set; } = null!; - public Sash currItem { get; set; } = null!; - - } - - public class DataCopyContentSash - { - public Sash currItem { get; set; } = null!; - - public int indexCopy { get; set; } = 0; - - public int indexModify { get; set; } = 0; - - } } \ No newline at end of file diff --git a/WebWindowComplex/Compo/CardFrame.razor b/WebWindowComplex/Compo/CardFrame.razor index a80562e..2fda835 100644 --- a/WebWindowComplex/Compo/CardFrame.razor +++ b/WebWindowComplex/Compo/CardFrame.razor @@ -33,7 +33,7 @@
    @foreach (FrameDimension dimension in CurrFrameWindow.DimensionList) { - + }
    diff --git a/WebWindowComplex/Compo/CardSashGroup.razor b/WebWindowComplex/Compo/CardSashGroup.razor index 5c48d4b..0ade146 100644 --- a/WebWindowComplex/Compo/CardSashGroup.razor +++ b/WebWindowComplex/Compo/CardSashGroup.razor @@ -1,10 +1,11 @@ -@using static WebWindowComplex.Json.WindowConst +@using WebWindowComplex.Models +@using static WebWindowComplex.Json.WindowConst
    -
    Sash group @(SashList.Count > 1 ? (CurrIndex + 1) : "")
    +
    Sash group @(SashList.Count > 1 ? (SashList.IndexOf(CurrSashGroup) + 1) : "")
    @@ -21,7 +22,7 @@
    Qty sash - +
    @@ -29,7 +30,7 @@
    - @foreach (var orientationSash in CurrSashGroup.OrientationSashTypeList) { @@ -40,7 +41,7 @@
    Qty bottom rail - +
    @@ -54,7 +55,7 @@
    - @if (Sash.s_FamilyHardwareList == null || Sash.s_FamilyHardwareList.Count == 0) { @@ -92,8 +93,7 @@ }
    -
    @@ -136,9 +136,8 @@
    @@ -148,9 +147,8 @@ } diff --git a/WebWindowComplex/Compo/CardSashGroup.razor.cs b/WebWindowComplex/Compo/CardSashGroup.razor.cs index 3dd1e47..5e4b316 100644 --- a/WebWindowComplex/Compo/CardSashGroup.razor.cs +++ b/WebWindowComplex/Compo/CardSashGroup.razor.cs @@ -8,30 +8,12 @@ namespace WebWindowComplex.Compo { #region Public Properties - /// - /// Indice della sash corrente rispetto alla lista sash - /// - [Parameter] - public int CurrIndex { get; set; } = 0; - /// /// Sash corrente rispetto alla lista Sash /// [CascadingParameter(Name = "CurrSashGroup")] public Sash CurrSashGroup { get; set; } = null!; - /// - /// Evento per cambiare l'anta su cui è presente la maniglia - /// - [Parameter] - public EventCallback EC_ChangeHandle { get; set; } - - /// - /// Evento per cambiare l'anta su cui è presente la maniglia - /// - [Parameter] - public EventCallback EC_CopyContentSash { get; set; } - /// /// Evento per cambiare tutti i fill /// @@ -50,28 +32,16 @@ namespace WebWindowComplex.Compo [Parameter] public EventCallback EC_ReqResetDictShape { get; set; } - /// - /// Evento per cambiare tutti i Joints - /// - [Parameter] - public EventCallback EC_UpdateSash { get; set; } - /// /// Evento per segnalare cambio hw e richiesta calcolo /// [Parameter] - public EventCallback EC_UpdateSashHardware { get; set; } - - /// - /// Evento per richiedere la prima volta le opzioni hardware - /// - [Parameter] - public EventCallback EC_CallFirstHwOpt { get; set; } + public EventCallback EC_UpdatePreview { get; set; } /// /// Lista di sash /// - [Parameter] + [CascadingParameter(Name = "SashList")] public List SashList { get; set; } = null!; #endregion Public Properties @@ -89,7 +59,88 @@ namespace WebWindowComplex.Compo if (CurrSashGroup.SelHardwareFromId != value) { CurrSashGroup.SelHardwareFromId = value; - _ = EC_UpdateSashHardware.InvokeAsync(CurrSashGroup); + var args = new DataUpdateSash + { + currSash = CurrSashGroup, + reqHwOption = true + }; + _ = EC_UpdatePreview.InvokeAsync(args); + } + } + } + + protected int SashBottomRailQty + { + get => CurrSashGroup.SashBottomRailQty; + set + { + if (CurrSashGroup.SashBottomRailQty != value) + { + CurrSashGroup.SashBottomRailQty = value; + if (CurrSashGroup.SashBottomRailQty > 0) + CurrSashGroup.SetSashBottomRail(true); + else + CurrSashGroup.SetSashBottomRail(false); + var args = new DataUpdateSash() + { + currSash = CurrSashGroup, + reqHwOption = false + }; + _ = EC_UpdatePreview.InvokeAsync(args); + } + } + } + + protected int SashQty + { + get => CurrSashGroup.nSashQty; + set + { + if (CurrSashGroup.nSashQty != value) + { + CurrSashGroup.nSashQty = value; + var args = new DataUpdateSash() + { + currSash = CurrSashGroup, + reqHwOption = false + }; + _ = EC_UpdatePreview.InvokeAsync(args); + } + } + } + + protected int OrientationSashTypeIndex + { + get => CurrSashGroup.SelOrientationSashTypeIndex; + set + { + if (CurrSashGroup.SelOrientationSashTypeIndex != value) + { + CurrSashGroup.SelOrientationSashTypeIndex = value; + var args = new DataUpdateSash() + { + currSash = CurrSashGroup, + reqHwOption = false + }; + _ = EC_UpdatePreview.InvokeAsync(args); + } + } + } + + protected string FamilyHardware + { + get => CurrSashGroup.SelFamilyHardware; + set + { + if (CurrSashGroup.SelFamilyHardware != value) + { + CurrSashGroup.SelFamilyHardware = value; + var args = new DataUpdateSash() + { + currSash = CurrSashGroup, + reqHwOption = false + }; + _ = EC_UpdatePreview.InvokeAsync(args); } } } @@ -117,16 +168,40 @@ namespace WebWindowComplex.Compo { item.SetSelMeasureType(type); } - await EC_UpdateSash.InvokeAsync(CurrSashGroup); + var args = new DataUpdateSash + { + currSash = CurrSashGroup, + reqHwOption = false + }; + await EC_UpdatePreview.InvokeAsync(args); } protected async Task UpdateSashDimension(SashDimension updateSD) { - var currRec = CurrSashGroup.SashList.Where(x => x.nSashId == updateSD.nSashId).FirstOrDefault(); + var currRec = CurrSashGroup.SashList.First(x => x.nSashId == updateSD.nSashId); if(currRec != null) { currRec = updateSD; - await EC_UpdateSash.InvokeAsync(CurrSashGroup); + var args = new DataUpdateSash + { + currSash = CurrSashGroup, + reqHwOption = false + }; + await EC_UpdatePreview.InvokeAsync(args); + } + } + + protected async Task UpdateSash(Sash updateS) + { + if (updateS != null) + { + CurrSashGroup = updateS; + var args = new DataUpdateSash + { + currSash = CurrSashGroup, + reqHwOption = false + }; + await EC_UpdatePreview.InvokeAsync(args); } } @@ -134,24 +209,6 @@ namespace WebWindowComplex.Compo #region Private Methods - /// - /// Sollevo evento per cambiare l'anta su cui è presente la maniglia - /// - /// - private async Task ChangeHandle(DataChangeHandle Args) - { - await EC_ChangeHandle.InvokeAsync(Args); - } - - /// - /// Sollevo evento per cambiare l'anta su cui è presente la maniglia - /// - /// - private async Task CopyContentSash(DataCopyContentSash Args) - { - await EC_CopyContentSash.InvokeAsync(Args); - } - private bool editMode = false; private List currSashDimEdit = new List(); private void EditView(DataChangeMode args) @@ -176,32 +233,41 @@ namespace WebWindowComplex.Compo /// /// /// - private async Task UpdateOptCombo(AGBOptionCombo updRec) + private async Task UpdateOpt(DataUpdateHwOption argsHw) { - // cerco il record - var currRec = CurrSashGroup.HwOptionList.FirstOrDefault(x => x.sName == updRec.sName && x.sDescription == updRec.sDescription); - // lo aggiorno - if (updRec != null) + AGBOptionCombo AGBOptCombo = argsHw.AGBOptCombo; + AGBOptionText AGBOptText = argsHw.AGBOptText; + if (AGBOptCombo != null) { - currRec = updRec; - await EC_UpdateSashHardware.InvokeAsync(CurrSashGroup); + // cerco il record + var currRec = CurrSashGroup.HwOptionList.FirstOrDefault(x => x.sName == AGBOptCombo.sName && x.sDescription == AGBOptCombo.sDescription); + // lo aggiorno + if (AGBOptCombo != null) + { + currRec = AGBOptCombo; + var args = new DataUpdateSash + { + currSash = CurrSashGroup, + reqHwOption = true + }; + await EC_UpdatePreview.InvokeAsync(args); + } } - } - - /// - /// Report aggiornamento Option Text - /// - /// - /// - private async Task UpdateOptText(AGBOptionText updRec) - { - // cerco il record - var currRec = CurrSashGroup.HwOptionList.FirstOrDefault(x => x.sName == updRec.sName && x.sDescription == updRec.sDescription); - // lo aggiorno - if (updRec != null) + else { - currRec = updRec; - await EC_UpdateSashHardware.InvokeAsync(CurrSashGroup); + // cerco il record + var currRec = CurrSashGroup.HwOptionList.FirstOrDefault(x => x.sName == AGBOptText.sName && x.sDescription == AGBOptText.sDescription); + // lo aggiorno + if (AGBOptText != null) + { + currRec = AGBOptText; + var args = new DataUpdateSash + { + currSash = CurrSashGroup, + reqHwOption = true + }; + await EC_UpdatePreview.InvokeAsync(args); + } } } @@ -210,9 +276,14 @@ namespace WebWindowComplex.Compo /// /// /// - private async Task FirstHwOptionList(int groupId) + private async Task FirstHwOptionList() { - await EC_CallFirstHwOpt.InvokeAsync(groupId); + var args = new DataUpdateSash + { + currSash = CurrSashGroup, + reqHwOption = true + }; + await EC_UpdatePreview.InvokeAsync(args); } private string ButtonMeasureCss(MeasureTypes type) @@ -232,4 +303,10 @@ namespace WebWindowComplex.Compo } #endregion Private Methods } + + public class DataUpdateSash + { + public Sash currSash { get; set; } = null!; + public bool reqHwOption { get; set; } = false; + } } \ No newline at end of file diff --git a/WebWindowComplex/Compo/CardSplit.razor b/WebWindowComplex/Compo/CardSplit.razor index 1e3b240..883cae9 100644 --- a/WebWindowComplex/Compo/CardSplit.razor +++ b/WebWindowComplex/Compo/CardSplit.razor @@ -4,7 +4,7 @@
    -
    @(descParentSplit(CurrSplit))
    +
    @(descParentSplit())
    @@ -21,7 +21,7 @@
    }
    - +
    - @foreach (var openingType in CurrSashDim.OpeningTypeList) { @@ -37,9 +37,9 @@
    Dimension - + @* *@ - @foreach (var mType in CurrSashDim.MeasureTypeList) {
    - @* -
    -
    -
    -
    Joints
    -
    -
    - -
    -
    - - @if (!JointCollapsed) - { -
    -
    -
    - -
    -
    -
    -
    - -
    -
    -
    -
    - -
    -
    -
    - } - @if (!JointCollapsed) - { - @foreach (Joint joint in CurrSashDim.JointList) - { - - } - } -
    - - @if (!(CurrAnta.AreaList[0] is Split)) - { -
    -
    -
    - -
    -
    -
    -
    - -
    -
    -
    - } -
    - @for (int k = 0; k <= CurrSashGroup.SashList.Count - 1; k++) - { - @if (k != IndexSash) - { - int IndexCopy = k; - int IndexModify = IndexSash; -
    -
    - -
    -
    - } - } -
    *@
    } else @@ -165,7 +95,7 @@ else
    - @foreach (var openingType in CurrSashDim.OpeningTypeList) { @@ -174,8 +104,8 @@ else
    Dimension - - @foreach (var mType in CurrSashDim.MeasureTypeList) {
    - @*
    - @for (int k = 0; k <= CurrSashGroup.SashList.Count - 1; k++) - { - @if (k != IndexSash) - { - int IndexCopy = k; - int IndexModify = IndexSash; -
    -
    - -
    -
    - } - } -
    *@
    @@ -254,126 +169,3 @@ else
    } - - -@* *@ \ No newline at end of file diff --git a/WebWindowComplex/Compo/AreaSash.razor.cs b/WebWindowComplex/Compo/AreaSash.razor.cs index 85a5381..c62b8bf 100644 --- a/WebWindowComplex/Compo/AreaSash.razor.cs +++ b/WebWindowComplex/Compo/AreaSash.razor.cs @@ -100,6 +100,54 @@ namespace WebWindowComplex.Compo return 0; } + /// + /// Selezione tipo di apertura anta + /// + protected int OpeningTypeIndex + { + get => CurrSashDim.SelOpeningTypeIndex; + set + { + if (CurrSashDim.SelOpeningTypeIndex != value) + { + CurrSashDim.SelOpeningTypeIndex = value; + _ = EC_UpdateSashDim.InvokeAsync(CurrSashDim); + } + } + } + + /// + /// Selezione tipo di misura della dimensione dell'anta + /// + protected int MeasureTypeIndex + { + get => CurrSashDim.SelMeasureTypeIndex; + set + { + if (CurrSashDim.SelMeasureTypeIndex != value) + { + CurrSashDim.SelMeasureTypeIndex = value; + _ = EC_UpdateSashDim.InvokeAsync(CurrSashDim); + } + } + } + + /// + /// Selezione tipo di apertura anta + /// + protected double Dimension + { + get => CurrSashDim.dDimension; + set + { + if (CurrSashDim.dDimension != value) + { + CurrSashDim.dDimension = value; + _ = EC_UpdateSashDim.InvokeAsync(CurrSashDim); + } + } + } + /// /// Sollevo evento richiesta per cambiare tutti i Joint /// diff --git a/WebWindowComplex/Compo/CardFrame.razor.cs b/WebWindowComplex/Compo/CardFrame.razor.cs index b2b2e29..e49e527 100644 --- a/WebWindowComplex/Compo/CardFrame.razor.cs +++ b/WebWindowComplex/Compo/CardFrame.razor.cs @@ -20,7 +20,7 @@ namespace WebWindowComplex.Compo public EventCallback EC_ReqResetDictShape { get; set; } /// - /// Evento per richiedere reset dizionario Shape + /// Evento per richiedere opzioni hardware /// [Parameter] public EventCallback EC_ReqOptionHw { get; set; } @@ -67,13 +67,13 @@ namespace WebWindowComplex.Compo { s.SelHardwareFromId = "000000"; } - _ = EC_ReqOptionHw.InvokeAsync(CurrFrameWindow); var args = new DataUpdateFrame() { currFrame = CurrFrameWindow, svgNoHw = true }; _ = EC_UpdatePreview.InvokeAsync(args); + //_ = EC_ReqOptionHw.InvokeAsync(CurrFrameWindow); //_ = EC_UpdateShape.InvokeAsync(CurrFrameWindow); } } diff --git a/WebWindowComplex/Compo/CardSashGroup.razor b/WebWindowComplex/Compo/CardSashGroup.razor index 0ade146..33f4aa2 100644 --- a/WebWindowComplex/Compo/CardSashGroup.razor +++ b/WebWindowComplex/Compo/CardSashGroup.razor @@ -9,7 +9,7 @@
    - +
    diff --git a/WebWindowComplex/Compo/CardSashGroup.razor.cs b/WebWindowComplex/Compo/CardSashGroup.razor.cs index 5e4b316..8e4f4a2 100644 --- a/WebWindowComplex/Compo/CardSashGroup.razor.cs +++ b/WebWindowComplex/Compo/CardSashGroup.razor.cs @@ -18,7 +18,7 @@ namespace WebWindowComplex.Compo /// Evento per cambiare tutti i fill /// [Parameter] - public EventCallback EC_RemoveArea { get; set; } + public EventCallback EC_UpdateFrame { get; set; } /// /// Evento per tornare nella pagine Tree @@ -32,6 +32,24 @@ namespace WebWindowComplex.Compo [Parameter] public EventCallback EC_ReqResetDictShape { get; set; } + /// + /// Evento per richiedere reset dizionario Hw option + /// + [Parameter] + public EventCallback EC_ReqResetDictHwOpt { get; set; } + + /// + /// Evento per richiedere opzioni hardware + /// + [Parameter] + public EventCallback EC_ReqOptionHw { get; set; } + + /// + /// Evento per richiedere per la prima volta opzioni hardware + /// + [Parameter] + public EventCallback EC_ReqFirstOptionHw { get; set; } + /// /// Evento per segnalare cambio hw e richiesta calcolo /// @@ -44,31 +62,42 @@ namespace WebWindowComplex.Compo [CascadingParameter(Name = "SashList")] public List SashList { get; set; } = null!; + /// + /// Lista di sash + /// + [Parameter] + public Frame FrameWindow { get; set; } = null!; + #endregion Public Properties #region Protected Properties /// - /// Selezione hardware + /// Selezione quantità di ante /// - protected string SelHwType + protected int SashQty { - get => CurrSashGroup.SelHardwareFromId; + get => CurrSashGroup.nSashQty; set { - if (CurrSashGroup.SelHardwareFromId != value) + if (CurrSashGroup.nSashQty != value) { - CurrSashGroup.SelHardwareFromId = value; - var args = new DataUpdateSash + CurrSashGroup.nSashQty = value; + var args = new DataUpdateSash() { currSash = CurrSashGroup, - reqHwOption = true + svgNoHw = true }; _ = EC_UpdatePreview.InvokeAsync(args); + //_ = EC_ReqResetDictShape.InvokeAsync(true); + _ = EC_ReqOptionHw.InvokeAsync(CurrSashGroup); } } } + /// + /// Selezione quantità bottom rail + /// protected int SashBottomRailQty { get => CurrSashGroup.SashBottomRailQty; @@ -83,32 +112,16 @@ namespace WebWindowComplex.Compo CurrSashGroup.SetSashBottomRail(false); var args = new DataUpdateSash() { - currSash = CurrSashGroup, - reqHwOption = false - }; - _ = EC_UpdatePreview.InvokeAsync(args); - } - } - } - - protected int SashQty - { - get => CurrSashGroup.nSashQty; - set - { - if (CurrSashGroup.nSashQty != value) - { - CurrSashGroup.nSashQty = value; - var args = new DataUpdateSash() - { - currSash = CurrSashGroup, - reqHwOption = false + currSash = CurrSashGroup }; _ = EC_UpdatePreview.InvokeAsync(args); } } } + /// + /// Selezione tipo di orientamento della sash + /// protected int OrientationSashTypeIndex { get => CurrSashGroup.SelOrientationSashTypeIndex; @@ -119,14 +132,16 @@ namespace WebWindowComplex.Compo CurrSashGroup.SelOrientationSashTypeIndex = value; var args = new DataUpdateSash() { - currSash = CurrSashGroup, - reqHwOption = false + currSash = CurrSashGroup }; _ = EC_UpdatePreview.InvokeAsync(args); } } } + /// + /// Selezione famiglia hardware + /// protected string FamilyHardware { get => CurrSashGroup.SelFamilyHardware; @@ -138,9 +153,32 @@ namespace WebWindowComplex.Compo var args = new DataUpdateSash() { currSash = CurrSashGroup, - reqHwOption = false + svgNoHw = true }; _ = EC_UpdatePreview.InvokeAsync(args); + _ = EC_ReqResetDictHwOpt.InvokeAsync(true); + _ = EC_ReqOptionHw.InvokeAsync(CurrSashGroup); + } + } + } + + /// + /// Selezione hardware + /// + protected string SelHwType + { + get => CurrSashGroup.SelHardwareFromId; + set + { + if (CurrSashGroup.SelHardwareFromId != value) + { + CurrSashGroup.SelHardwareFromId = value; + var args = new DataUpdateSash + { + currSash = CurrSashGroup + }; + _ = EC_UpdatePreview.InvokeAsync(args); + _ = EC_ReqOptionHw.InvokeAsync(CurrSashGroup); } } } @@ -154,11 +192,16 @@ namespace WebWindowComplex.Compo /// /// area da rimuovere /// - protected async Task RemoveArea(Area currArea) + protected async Task RemoveArea() { + CurrSashGroup.Remove(); + var args = new DataUpdateFrame() + { + currFrame = FrameWindow + }; // richiesta reset dict shape await EC_ReqResetDictShape.InvokeAsync(true); - await EC_RemoveArea.InvokeAsync(currArea); + await EC_UpdateFrame.InvokeAsync(args); } protected async Task SetMeasureType(MeasureTypes type) @@ -170,8 +213,7 @@ namespace WebWindowComplex.Compo } var args = new DataUpdateSash { - currSash = CurrSashGroup, - reqHwOption = false + currSash = CurrSashGroup }; await EC_UpdatePreview.InvokeAsync(args); } @@ -184,8 +226,7 @@ namespace WebWindowComplex.Compo currRec = updateSD; var args = new DataUpdateSash { - currSash = CurrSashGroup, - reqHwOption = false + currSash = CurrSashGroup }; await EC_UpdatePreview.InvokeAsync(args); } @@ -198,8 +239,7 @@ namespace WebWindowComplex.Compo CurrSashGroup = updateS; var args = new DataUpdateSash { - currSash = CurrSashGroup, - reqHwOption = false + currSash = CurrSashGroup }; await EC_UpdatePreview.InvokeAsync(args); } @@ -247,10 +287,10 @@ namespace WebWindowComplex.Compo currRec = AGBOptCombo; var args = new DataUpdateSash { - currSash = CurrSashGroup, - reqHwOption = true + currSash = CurrSashGroup }; await EC_UpdatePreview.InvokeAsync(args); + await EC_ReqOptionHw.InvokeAsync(CurrSashGroup); } } else @@ -263,10 +303,10 @@ namespace WebWindowComplex.Compo currRec = AGBOptText; var args = new DataUpdateSash { - currSash = CurrSashGroup, - reqHwOption = true + currSash = CurrSashGroup }; await EC_UpdatePreview.InvokeAsync(args); + await EC_ReqOptionHw.InvokeAsync(CurrSashGroup); } } } @@ -280,10 +320,10 @@ namespace WebWindowComplex.Compo { var args = new DataUpdateSash { - currSash = CurrSashGroup, - reqHwOption = true + currSash = CurrSashGroup }; - await EC_UpdatePreview.InvokeAsync(args); + //await EC_UpdatePreview.InvokeAsync(args); + await EC_ReqFirstOptionHw.InvokeAsync(CurrSashGroup); } private string ButtonMeasureCss(MeasureTypes type) @@ -307,6 +347,6 @@ namespace WebWindowComplex.Compo public class DataUpdateSash { public Sash currSash { get; set; } = null!; - public bool reqHwOption { get; set; } = false; + public bool svgNoHw { get; set; } = false; } } \ No newline at end of file diff --git a/WebWindowComplex/Compo/CardSplit.razor.cs b/WebWindowComplex/Compo/CardSplit.razor.cs index 592fe86..b25fc40 100644 --- a/WebWindowComplex/Compo/CardSplit.razor.cs +++ b/WebWindowComplex/Compo/CardSplit.razor.cs @@ -27,10 +27,10 @@ namespace WebWindowComplex.Compo public List SplitList { get; set; } = null!; /// - /// Evento per rimuovere split + /// Frame /// [Parameter] - public EventCallback EC_RemoveArea { get; set; } + public Frame FrameWindow { get; set; } = null!; /// /// Evento per richiedere reset dizionario Shape @@ -44,6 +44,12 @@ namespace WebWindowComplex.Compo [Parameter] public EventCallback EC_UpdatePreview { get; set; } + /// + /// Evento per aggiornare Frame + /// + [Parameter] + public EventCallback EC_UpdateFrame { get; set; } + /// /// Evento per tornare nella pagine Tree /// @@ -73,9 +79,14 @@ namespace WebWindowComplex.Compo /// protected async Task RemoveArea() { + CurrSplit.Remove(); + var args = new DataUpdateFrame() + { + currFrame = FrameWindow + }; // richiesta reset dict shape await EC_ReqResetDictShape.InvokeAsync(true); - await EC_RemoveArea.InvokeAsync(CurrSplit); + await EC_UpdateFrame.InvokeAsync(args); } /// diff --git a/WebWindowComplex/Compo/General.razor.cs b/WebWindowComplex/Compo/General.razor.cs index 9ed2b11..04a4242 100644 --- a/WebWindowComplex/Compo/General.razor.cs +++ b/WebWindowComplex/Compo/General.razor.cs @@ -15,16 +15,7 @@ namespace WebWindowComplex.Compo public Window CurrWindow { get; set; } = null!; [Parameter] - public EventCallback EC_SelColor { get; set; } - - [Parameter] - public EventCallback EC_SelGlass { get; set; } - - [Parameter] - public EventCallback EC_SelWindMat { get; set; } - - [Parameter] - public EventCallback EC_SelProfile { get; set; } + public EventCallback EC_UpdateGeneral { get; set; } [Parameter] public EventCallback EC_ReqClose { get; set; } @@ -51,7 +42,11 @@ namespace WebWindowComplex.Compo set { currColor = value; - _ = EC_SelColor.InvokeAsync(value); + var args = new DataUpdateGeneral + { + Color = value, + }; + _ = EC_UpdateGeneral.InvokeAsync(args); } } @@ -61,7 +56,11 @@ namespace WebWindowComplex.Compo set { currGlass = value; - _ = EC_SelGlass.InvokeAsync(value); + var args = new DataUpdateGeneral + { + Glass = value, + }; + _ = EC_UpdateGeneral.InvokeAsync(args); } } @@ -71,7 +70,11 @@ namespace WebWindowComplex.Compo set { currMaterial = value; - _ = EC_SelWindMat.InvokeAsync(value); + var args = new DataUpdateGeneral + { + Material = value, + }; + _ = EC_UpdateGeneral.InvokeAsync(args); } } @@ -81,7 +84,11 @@ namespace WebWindowComplex.Compo set { currProfile = value; - _ = EC_SelProfile.InvokeAsync(value); + var args = new DataUpdateGeneral + { + Profile = value, + }; + _ = EC_UpdateGeneral.InvokeAsync(args); } } @@ -123,4 +130,12 @@ namespace WebWindowComplex.Compo _ = EC_ReqClose.InvokeAsync(true); } } + + public class DataUpdateGeneral + { + public string Color { get; set; } = ""; + public string Glass { get; set; } = ""; + public string Material { get; set; } = ""; + public string Profile { get; set; } = ""; + } } \ No newline at end of file diff --git a/WebWindowComplex/Json/JsonUtility.cs b/WebWindowComplex/Json/JsonUtility.cs index 616a03a..11df650 100644 --- a/WebWindowComplex/Json/JsonUtility.cs +++ b/WebWindowComplex/Json/JsonUtility.cs @@ -413,15 +413,11 @@ namespace WebWindowComplex.Json foreach (var Joint in m_SashList[SashIndex].JointList) newSash.SashList[SashIndex].JointList.Add(Joint.Deserialize((Area)ParentArea)); } - //foreach (var Joint in m_JointList) - // newSash.JointList.Add(Joint.Deserialize((Area)ParentArea)); newSash.SetSelFamilyHardwareFromIndex(Hardware); - newSash.ReqRefreshShape(); + //newSash.ReqRefreshShape(); newSash.SetSelHardwareFromId(Hardware); foreach (var HwOption in m_HwOptionList) newSash.SelHwOptionList.Add(HwOption.Name, HwOption.Value); - //foreach (var HwOption in m_HwOptionList) - // newSash.HwOptionList.Add(HwOption.Deserialize()); foreach (var Area in AreaList) { var AreaDeserealized = Area.Deserialize(newSash, ParentWindow); diff --git a/WebWindowComplex/Models/Joint.cs b/WebWindowComplex/Models/Joint.cs index d1161ba..ba05570 100644 --- a/WebWindowComplex/Models/Joint.cs +++ b/WebWindowComplex/Models/Joint.cs @@ -68,7 +68,6 @@ namespace WebWindowComplex.Models set { m_SelJointType = (Joints)value; - //m_ParentArea.ParentWindow.OnUpdatePreview(m_ParentArea.ParentWindow.sSerialized()); } } diff --git a/WebWindowComplex/Models/Sash.cs b/WebWindowComplex/Models/Sash.cs index aa89f5a..401565b 100644 --- a/WebWindowComplex/Models/Sash.cs +++ b/WebWindowComplex/Models/Sash.cs @@ -112,7 +112,7 @@ namespace WebWindowComplex.Models var addSashDim = new SashDimension(dNewDimension, m_SashList[m_SashList.Count - 1].MeasureType, this, SplitIndex + 1); for(int i = 1; i <= 4; i++) { - addSashDim.JointList.Add(new Joint(this, i, Joints.FULL_H)); + addSashDim.JointList.Add(new Joint(this, i, Joints.FULL_V)); } SashList.Add(addSashDim); } @@ -215,10 +215,8 @@ namespace WebWindowComplex.Models } } RefreshHardwareList(); - RefreshHardwareOptionList(); + ClearHardwareOptionList(); SetFirstHardware(); - //m_ParentWindow.OnUpdatePreview(m_ParentWindow.sSerialized()); - ReqRefreshHwOption(); } } @@ -270,7 +268,6 @@ namespace WebWindowComplex.Models { m_bSashBottomRail = false; } - // m_ParentWindow.OnUpdatePreview(m_ParentWindow.sSerialized()); } } } @@ -308,7 +305,6 @@ namespace WebWindowComplex.Models set { SetSelFamilyHardware(value); - //m_ParentWindow.OnUpdatePreview(m_ParentWindow.sSerialized()); } } @@ -323,8 +319,7 @@ namespace WebWindowComplex.Models m_SelHardware = value; if (HwOptionList.Count != 0) { - RefreshHardwareOptionList(); - ReqRefreshHwOption(); + ClearHardwareOptionList(); } } } @@ -440,6 +435,9 @@ namespace WebWindowComplex.Models } } + /// + /// Metodo per rimuovere l'intero sash group + /// public void Remove() { ParentArea.AreaList.Remove(this); @@ -449,30 +447,30 @@ namespace WebWindowComplex.Models //m_ParentWindow.OnUpdatePreview(m_ParentWindow.sSerialized()); } - /// - /// Richiesta calcolo shape corrente - /// - public void ReqRefreshShape() - { - if (m_HardwareCompleteList != null && m_HardwareCompleteList.Count > 0) - { - m_HardwareList.Clear(); - // reset shape corrente - m_CurrShape = ""; - // chiamata evento calcolo shape: gruppo da calcolare - //m_ParentWindow.OnReqShapePreview(m_ParentWindow.sSerialized(), GroupId); - } - } + ///// + ///// Richiesta calcolo shape corrente + ///// + //public void ReqRefreshShape() + //{ + // if (m_HardwareCompleteList != null && m_HardwareCompleteList.Count > 0) + // { + // m_HardwareList.Clear(); + // // reset shape corrente + // m_CurrShape = ""; + // // chiamata evento calcolo shape: gruppo da calcolare + // } + //} - /// - /// Richiesta calcolo hardware option list - /// - public void ReqRefreshHwOption() - { - HwOptionList.Clear(); - // chiamata evento calcolo opzioni hardware - //m_ParentWindow.OnReqHwOptionPreview(m_ParentWindow.sSerialized(), GroupId); - } + ///// + ///// Richiesta calcolo hardware option list + ///// + //public void ReqRefreshHwOption() + //{ + // HwOptionList.Clear(); + // m_ReqHwOption = true; + // // chiamata evento calcolo opzioni hardware + // //m_ParentWindow.OnReqHwOptionPreview(m_ParentWindow.sSerialized(), GroupId); + //} public void SetSelFamilyHardware(string sFamilyHw) { @@ -484,10 +482,7 @@ namespace WebWindowComplex.Models } SetFirstHardware(); if (HwOptionList.Count != 0) - { - RefreshHardwareOptionList(); - ReqRefreshHwOption(); - } + ClearHardwareOptionList(); } /// @@ -502,31 +497,33 @@ namespace WebWindowComplex.Models 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(); + .FirstOrDefault(x => x.Shape == m_CurrShape && + x.SashQty == nSashQty && + x.OpeningType == ConvertOpeningType() + ); if(listHwValid == null) { noHwValid = true; var familyHwValid = Sash.m_HardwareCompleteList .Select(x => x.FamilyName) .First(); + SelHardwareFromId = "000000"; + ClearHardwareOptionList(); } else + { SetSelFamilyHardware(listHwValid.FamilyName); - } - if (noHwValid) - { - SelHardwareFromId = "000000"; + } } else { 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(); + ClearHardwareOptionList(); + } } } @@ -626,12 +623,10 @@ namespace WebWindowComplex.Models for (var JointIndex = 0; JointIndex <= 3; JointIndex++) sashDim.JointList.Add(new Joint(newSash, JointIndex + 1, Joints.FULL_H)); } - //for (var JointIndex = 0; JointIndex <= 3; JointIndex++) - // newSash.JointList.Add(new Joint(newSash, JointIndex + 1, Joints.FULL_H)); newSash.SetSashBottomRail(false); newSash.SetSashBottomRailQty(0); newSash.SetSelFamilyHardware(Sash.s_FamilyHardwareList.First()); - newSash.RefreshHardwareOptionList(); + newSash.ClearHardwareOptionList(); newSash.SetFirstHardware(); return newSash; } @@ -716,7 +711,7 @@ namespace WebWindowComplex.Models } } - internal void RefreshHardwareOptionList() + internal void ClearHardwareOptionList() { m_HwdOptionList.Clear(); } @@ -903,11 +898,6 @@ namespace WebWindowComplex.Models return SelFamilyHardware; } - internal void SetSelHardware(Hardware value) - { - SelHardware = value; - } - internal void SetSelHardwareFromId(string sId) { if (m_HardwareList.Count == 0) diff --git a/WebWindowComplex/Models/SashDimension.cs b/WebWindowComplex/Models/SashDimension.cs index 5d3a9e4..72cdea9 100644 --- a/WebWindowComplex/Models/SashDimension.cs +++ b/WebWindowComplex/Models/SashDimension.cs @@ -103,7 +103,6 @@ namespace WebWindowComplex.Models set { m_bHasHandle = value; - //m_Parent.ParentWindow.OnUpdatePreview(m_Parent.ParentWindow.sSerialized()); } } @@ -278,7 +277,6 @@ namespace WebWindowComplex.Models item.SetDimension(ConvertIn(absolutValList[i], (MeasureTypes)item.SelMeasureTypeIndex, widthTot)); } } - m_Parent.ParentWindow.OnUpdatePreview(m_Parent.ParentWindow.sSerialized()); } } } @@ -316,8 +314,7 @@ namespace WebWindowComplex.Models set { m_SelOpeningType = value; - m_Parent.ReqRefreshShape(); - m_Parent.RefreshHardwareOptionList(); + m_Parent.ClearHardwareOptionList(); m_Parent.SetFirstHardware(); } } @@ -326,7 +323,6 @@ namespace WebWindowComplex.Models { get { - //return IdNameStruct.IndFromId((int)m_SelOpeningType, m_OpeningTypeList); return (int)m_SelOpeningType; } set @@ -337,10 +333,8 @@ namespace WebWindowComplex.Models (newOpening == Openings.TILTTURN_RIGHT && m_bHasHandle)) { m_SelOpeningType = newOpening; - m_Parent.ReqRefreshShape(); - m_Parent.RefreshHardwareOptionList(); + m_Parent.ClearHardwareOptionList(); m_Parent.SetFirstHardware(); - m_Parent.ParentWindow.OnUpdatePreview(m_Parent.ParentWindow.sSerialized()); } } } @@ -387,7 +381,6 @@ namespace WebWindowComplex.Models double widthTot = CalculateWidthSashGroup(m_Parent.ParentWindow.AreaList.FirstOrDefault(), m_Parent.ParentWindow.AreaList.FirstOrDefault().DimensionList.Where(x => x.sName == "Width").First().dValue); m_dDimension = ConvertDimension(m_SelMeasureType, newType, widthTot); m_SelMeasureType = (MeasureTypes)value; - m_Parent.ParentWindow.OnUpdatePreview(m_Parent.ParentWindow.sSerialized()); } } } diff --git a/WebWindowComplex/Models/Split.cs b/WebWindowComplex/Models/Split.cs index 3963b80..b2fcc48 100644 --- a/WebWindowComplex/Models/Split.cs +++ b/WebWindowComplex/Models/Split.cs @@ -342,7 +342,7 @@ namespace WebWindowComplex.Models Fill newFill = Fill.CreateFill(ParentArea, FillTypes.GLASS); newFill.SetAreaType(AreaTypes.FILL); ParentArea.AreaList.Add(newFill); - m_ParentWindow.OnUpdatePreview(m_ParentWindow.sSerialized()); + //m_ParentWindow.OnUpdatePreview(m_ParentWindow.sSerialized()); } #endregion Public Methods diff --git a/WebWindowComplex/Models/SplitDimension.cs b/WebWindowComplex/Models/SplitDimension.cs index 0ad1e99..bb103a0 100644 --- a/WebWindowComplex/Models/SplitDimension.cs +++ b/WebWindowComplex/Models/SplitDimension.cs @@ -204,7 +204,7 @@ namespace WebWindowComplex.Models item.SetDimension(ConvertIn(absolutValList[i], (MeasureTypes)item.SelMeasureTypeIndex, widthTot, dimensions)); } } - m_Parent.ParentWindow.OnUpdatePreview(m_Parent.ParentWindow.sSerialized()); + //m_Parent.ParentWindow.OnUpdatePreview(m_Parent.ParentWindow.sSerialized()); } //// Controllo che il valore inserito sia compreso tra 0 e 100 //if (value > 0 && value < 100) @@ -348,7 +348,7 @@ namespace WebWindowComplex.Models } m_dDimension = ConvertDimension(m_SelMeasureType, newType, tot, splitList); m_SelMeasureType = (MeasureTypes)value; - m_Parent.ParentWindow.OnUpdatePreview(m_Parent.ParentWindow.sSerialized()); + //m_Parent.ParentWindow.OnUpdatePreview(m_Parent.ParentWindow.sSerialized()); } } } diff --git a/WebWindowComplex/Models/Window.cs b/WebWindowComplex/Models/Window.cs index 2685c9a..020611e 100644 --- a/WebWindowComplex/Models/Window.cs +++ b/WebWindowComplex/Models/Window.cs @@ -19,7 +19,7 @@ namespace WebWindowComplex.Models { #region Public Events - public event EventHandler OnPreview = delegate { }; + //public event EventHandler OnPreview = delegate { }; //public event EventHandler OnReqShape = delegate { }; //public event EventHandler OnReqHwOption = delegate { }; @@ -48,7 +48,6 @@ namespace WebWindowComplex.Models set { m_sColorMaterial = value; - OnUpdatePreview(sSerialized()); } } @@ -61,7 +60,6 @@ namespace WebWindowComplex.Models set { m_sGlass = value; - OnUpdatePreview(sSerialized()); } } @@ -74,7 +72,6 @@ namespace WebWindowComplex.Models set { m_sMaterial = value; - OnUpdatePreview(sSerialized()); } } @@ -87,7 +84,6 @@ namespace WebWindowComplex.Models set { m_sProfilePath = value; - OnUpdatePreview(sSerialized()); } } @@ -95,15 +91,15 @@ namespace WebWindowComplex.Models #region Internal Methods - internal void OnUpdatePreview(string sJwd) - { - OnPreviewEventArgs e = new OnPreviewEventArgs(sJwd); - EventHandler handler = OnPreview; - if (handler != null) - { - handler(this, e); - } - } + //internal void OnUpdatePreview(string sJwd) + //{ + // OnPreviewEventArgs e = new OnPreviewEventArgs(sJwd); + // EventHandler handler = OnPreview; + // if (handler != null) + // { + // handler(this, e); + // } + //} //internal void OnReqShapePreview(string sJwd, int groupId) //{ diff --git a/WebWindowComplex/TableComp.razor b/WebWindowComplex/TableComp.razor index d8fe216..3e4cde4 100644 --- a/WebWindowComplex/TableComp.razor +++ b/WebWindowComplex/TableComp.razor @@ -101,7 +101,8 @@ @@ -119,9 +120,13 @@ - @@ -179,10 +184,7 @@ } diff --git a/WebWindowComplex/TableComp.razor.cs b/WebWindowComplex/TableComp.razor.cs index 95711a0..20c4d59 100644 --- a/WebWindowComplex/TableComp.razor.cs +++ b/WebWindowComplex/TableComp.razor.cs @@ -117,7 +117,7 @@ namespace WebWindowComplex { if (m_CurrWindow != null) { - m_CurrWindow.OnPreview -= M_CurrWindow_OnPreview; + //m_CurrWindow.OnPreview -= M_CurrWindow_OnPreview; //m_CurrWindow.OnReqHwOption -= M_CurrWindow_OnHwOption; //m_CurrWindow.OnReqShape -= M_CurrWindow_OnShape; m_CurrWindow = null; @@ -385,92 +385,6 @@ namespace WebWindowComplex } } - //protected void calculateWidth(Area area) - //{ - // if (area is Sash) - // { - // Sash sash = (Sash)area; - // if (area.ParentArea is Frame) - // { - // Frame frame = (Frame)area.ParentArea; - // sash.Width = (frame.DimensionList.Where(x => x.sName == "Width").FirstOrDefault())!.dValue; - // } - // else if (sash.ParentArea.ParentArea is Split) - // { - // Split split = (Split)sash.ParentArea.ParentArea; - // if (split.SplitVertList.Count > 0) - // { - // int indexSplit = 0; - // for(int i = 0; i < split.AreaList.Count; i++) - // { - // if (split.AreaList.ElementAt(i).AreaList.First().Equals(sash)) - // indexSplit = i; - // } - // switch (split.SplitVertList.ElementAt(indexSplit).MeasureType) - // { - // case MeasureTypes.ABSOLUT: - // { - // sash.Width = split.SplitVertList.ElementAt(indexSplit).dDimension; - // break; - // } - // case MeasureTypes.PROPORTIONAL: - // { - // /// TO DO!!!!! - // break; - // } - // case MeasureTypes.PERCENTAGE: - // { - // sash.Width = split.SplitVertList.ElementAt(indexSplit).dDimension / 100 * split.Width; - // break; - // } - // } - // } - // else - // { - // Frame frame = (Frame)sash.ParentWindow.AreaList[0]; - // sash.Width = (frame.DimensionList.Where(x => x.sName == "Width").FirstOrDefault())!.dValue; - // } - // } - // } - // else if (area is Split) - // { - // Split split = (Split)area; - // if (area.ParentArea is Frame) - // { - // Frame frame = (Frame)area.ParentArea; - // split.Width = (frame.DimensionList.Where(x => x.sName == "Width").FirstOrDefault())!.dValue; - // } - // else if (split.ParentArea.ParentArea is Sash) - // { - // Sash sash = (Sash)split.ParentArea.ParentArea; - // int indexSash = 0; - // for (int i = 0; i < sash.AreaList.Count; i++) - // { - // if (sash.AreaList.ElementAt(i).AreaList.First().Equals(split)) - // indexSash = i; - // } - // switch (sash.SashList.ElementAt(indexSash).MeasureType) - // { - // case MeasureTypes.ABSOLUT: - // { - // split.Width = sash.SashList.ElementAt(indexSash).dDimension; - // break; - // } - // case MeasureTypes.PROPORTIONAL: - // { - // //split.Width = Proportional2AbsolutVal(split); - // break; - // } - // case MeasureTypes.PERCENTAGE: - // { - // split.Width = sash.SashList.ElementAt(indexSash).dDimension / 100 * sash.Width; - // break; - // } - // } - // } - // } - //} - /// /// Calcola CSS warning /// @@ -522,7 +436,7 @@ namespace WebWindowComplex } /// - /// Richiesta calcolo Options HW da JWD + /// Richiesta calcolo Options HW /// /// Lista degli ID numerici dei gruppi da valutare /// @@ -726,13 +640,21 @@ namespace WebWindowComplex List reqList = SashList.Select(x => x.GroupId).ToList(); if (reqList.Count > 0) { + //prevReq = (int)DataReq.ReqShape; await DoReqShape(reqList); } } else { // chiedo SVG - await DoPreviewSvg(true); + //prevReq = (int)DataReq.ReqSvg; + if(prevReq != (int)DataReq.ReqSvg || !prevLiveData.JwdEqual(LiveData.CurrJwd)) + { + if(prevReq != (int)DataReq.ReqHwOpt) + await DoPreviewSvg(true); + else if (LiveData.DictOptionsXml.Count > 0) + await DoPreviewSvg(true); + } } } } @@ -752,17 +674,10 @@ namespace WebWindowComplex { if (m_CurrWindow != null) { - m_CurrWindow.OnPreview -= M_CurrWindow_OnPreview; - //m_CurrWindow.OnReqHwOption -= M_CurrWindow_OnHwOption; - //m_CurrWindow.OnReqShape -= M_CurrWindow_OnShape; m_CurrWindow = null; } m_CurrWindow = WindowFromJson.Deserialize(); FrameWindow = m_CurrWindow.AreaList[0]; - m_CurrWindow.OnPreview += M_CurrWindow_OnPreview; - //m_CurrWindow.OnReqHwOption += M_CurrWindow_OnHwOption; - //m_CurrWindow.OnReqShape += M_CurrWindow_OnShape; - // Recupero dimensioni Frame e Joint del frame della finestra precedente if (m_PreviousWindow != null) { for (int i = 0; i < 2; i++) @@ -792,10 +707,17 @@ namespace WebWindowComplex // Inserisco le forme ricevuto nei sash group foreach (var item in LiveData.DictShape) { - Sash sashFromGroupId = SashList.Where(x => x.GroupId == item.Key).First(); + Sash sashFromGroupId = SashList.First(x => x.GroupId == item.Key); sashFromGroupId.SashShape = item.Value; sashFromGroupId.UpdateShape(item.Value); } + if(prevReq == (int)DataReq.ReqShape){ + if(reqHwOpt > 0) + { + List reqList = SashList.Select(x => x.GroupId).ToList(); + _=DoReqOptHardware(reqList); + } + } } // se ho le opzioni hw le aggiungo if (LiveData.DictOptionsXml.Count > 0) @@ -917,6 +839,7 @@ namespace WebWindowComplex /// Salvataggio tipo di domanda precedente /// private int prevReq { get; set; } = 0; + private int reqHwOpt { get; set; } = 0; #endregion Private Properties @@ -934,30 +857,6 @@ namespace WebWindowComplex currSplitIndex = -1; } - /// - /// Prima chiamata alle opzioni hardware - /// - /// Group Id del sash group di cui si vuole Hw option - /// - private async Task CallFirstHwOpt(int groupId) - { - bool isFirst = true; - List reqList = new List() { groupId }; - await DoReqOptHardware(reqList, isFirst); - } - - /// - /// Metodo per settare tutti i Fill in contemporanea - /// - /// tipo di riempimento (GLASS o WOOD) - /// - private async Task ChangeOneFill(FillTypes type) - { - Fill fillChange = FillList.ElementAt(currFillIndex); - fillChange.SetSelFillType(type); - await DoPreviewSvg(); - } - /// /// Verifica errori prelimionari per mostrare dove sia il problema /// @@ -1048,41 +947,6 @@ namespace WebWindowComplex } } - private void M_CurrWindow_OnHwOption(object? sender, OnReqHwOptEventArgs e) - { - // chiamo reset dizionario - ReqResetHwOpt(true); - // setto che sto chiedendo update opzioni - loadListAdd("LoadHwOpt"); - _ = InvokeAsync(StateHasChanged); - Dictionary Args = new Dictionary(); - Args.Add("Mode", $"{(int)Enums.QuestionModes.HARDWARE}"); - Args.Add("SubMode", $"{(int)Enums.QuestionHwSubModes.HARDWAREOPTIONS}"); - Args.Add("SerializedData", e.sJwd); - string listGroupId = JsonConvert.SerializeObject(new List { e.nGroupId }); - Args.Add("GroupId", listGroupId); - _ = EC_DoUpdate.InvokeAsync(Args); - } - - private void M_CurrWindow_OnPreview(object? sender, OnPreviewEventArgs e) - { - Dictionary Args = new Dictionary(); - Args.Add("Mode", $"{(int)Enums.QuestionModes.PREVIEW}"); - Args.Add("SerializedData", e.sJwd); - _ = EC_DoUpdate.InvokeAsync(Args); - } - - private void M_CurrWindow_OnShape(object? sender, OnReqShapeEventArgs e) - { - Dictionary Args = new Dictionary(); - Args.Add("Mode", $"{(int)Enums.QuestionModes.HARDWARE}"); - Args.Add("SubMode", $"{(int)Enums.QuestionHwSubModes.SASHSHAPE}"); - Args.Add("SerializedData", e.sJwd); - string listGroupId = JsonConvert.SerializeObject(new List { e.groupId }); - Args.Add("GroupId", listGroupId); - _ = EC_DoUpdate.InvokeAsync(Args); - } - /// /// Metodo per cambiare step /// @@ -1128,22 +992,6 @@ namespace WebWindowComplex NextStep(newStep, Index); } - /// - /// Metodo per eliminare Split o Sash - /// - /// Area corrente - /// - private void RemoveArea(Area currArea) - { - if (currArea is Split) - ((Split)currArea).Remove(); - else if (currArea is Sash) - { - ((Sash)currArea).Remove(); - } - currStep = CompileStep.Tree; - } - /// /// Richiesta reset dizionario Shape con action /// @@ -1154,10 +1002,10 @@ namespace WebWindowComplex } /// - /// Richiesta reset dizionario options con action + /// Richiesta reset dizionario Hw Option con action /// /// - private void ReqResetHwOpt(bool args) + private void ReqResetDictHwOpt(bool args) { _ = EC_ActionReq.InvokeAsync(DataAction.ResetHwOpt); } @@ -1189,71 +1037,26 @@ namespace WebWindowComplex } /// - /// Selezione del colore + /// Metodo per aggiornare valori della sezione General /// /// - private void SelectColor(string newVal) + private void UpdatePreviewGeneral(DataUpdateGeneral args) { + string Color = args.Color; + string Glass = args.Glass; + string Material = args.Material; + string Profile = args.Profile; if (m_CurrWindow != null) { - m_CurrWindow.sColorMaterial = newVal; - } - } - - /// - /// Selezione del vetro - /// - /// - private void SelectGlass(string newVal) - { - if (m_CurrWindow != null) - { - m_CurrWindow.sGlass = newVal; - } - } - - /// - /// Selezione del materiale - /// - /// - private void SelectMat(string newVal) - { - if (m_CurrWindow != null) - { - m_CurrWindow.sMaterial = newVal; - } - } - - /// - /// Selezione del profilo - /// - /// - private void SelectProfile(string newVal) - { - if (m_CurrWindow != null) - { - m_CurrWindow.sProfilePath = newVal; - } - } - - /// - /// Metodo per scambiare due aree di uno split - /// - /// Area corrente - /// - private async Task SwapTwoAree(Area currArea) - { - currArea.SwapAree(); - await DoPreviewSvg(true, true); - if (currArea is Split) - { - List reqList = SashList.Select(x => x.GroupId).ToList(); - //List reqShape = new List(); - //if (currArea.AreaList[0].AreaList.Where(x => x.AreaType == AreaTypes.SASH).ToList().Count() > 0) - // reqShape.Add(currArea.AreaList[0].AreaList.Where(x => x.AreaType == AreaTypes.SASH).Select(x => x.GroupId).FirstOrDefault()); - //if (currArea.AreaList[1].AreaList.Where(x => x.AreaType == AreaTypes.SASH).ToList().Count() > 0) - // reqShape.Add(currArea.AreaList[1].AreaList.Where(x => x.AreaType == AreaTypes.SASH).Select(x => x.GroupId).FirstOrDefault()); - await DoReqShape(reqList); + if (!string.IsNullOrEmpty(Color)) + m_CurrWindow.sColorMaterial = Color; + else if (!string.IsNullOrEmpty(Glass)) + m_CurrWindow.sGlass = Glass; + else if (!string.IsNullOrEmpty(Material)) + m_CurrWindow.sMaterial = Material; + else if(!string.IsNullOrEmpty(Profile)) + m_CurrWindow.sProfilePath = Profile; + _ = DoPreviewSvg(); } } @@ -1372,6 +1175,58 @@ namespace WebWindowComplex currRec = newFrame; // resetto hw lst await EC_ActionReq.InvokeAsync(DataAction.ResetHwOpt); + reqHwOpt++; + if (prevReq == (int)DataReq.ReqShape) + { + // richiesta calcolo opzioni hardware per la singola sash group + List reqList = SashList.Select(x => x.GroupId).ToList(); + // chiamo con gruppo della nuova sash + await DoReqOptHardware(reqList); + } + } + } + + /// + /// Aggiornamento opzioni data nuova sash group + /// + /// nuovo frame + /// + private async Task UpdateHwOptionsSash(Sash newSash) + { + if (newSash != null) + { + // cerco il record + var currRec = SearchArea(FrameWindow, newSash.GroupId, newSash); + // lo aggiorno + currRec = newSash; + // resetto hw lst + await EC_ActionReq.InvokeAsync(DataAction.ResetHwOpt); + //reqHwOpt++; + //if(prevReq == (int)DataReq.ReqShape) + //{ + // richiesta calcolo opzioni hardware per la singola sash group + List reqList = SashList.Select(x => x.GroupId).ToList(); + // chiamo con gruppo della nuova sash + await DoReqOptHardware(reqList); + //} + } + } + + /// + /// Richiesta opzioni hardware per la prima volta + /// + /// nuovo frame + /// + private async Task ReqFirstOptionHw(Sash newSash) + { + if (newSash != null) + { + // cerco il record + var currRec = SearchArea(FrameWindow, newSash.GroupId, newSash); + // lo aggiorno + currRec = newSash; + // resetto hw lst + await EC_ActionReq.InvokeAsync(DataAction.ResetHwOpt); // richiesta calcolo opzioni hardware per la singola sash group List reqList = SashList.Select(x => x.GroupId).ToList(); // chiamo con gruppo della nuova sash @@ -1416,14 +1271,12 @@ namespace WebWindowComplex UpdateLists(); // richiedo update shape List reqList = SashList.Select(x => x.GroupId).ToList(); - await DoReqShape(reqList); await DoPreviewSvg(); + await DoReqShape(reqList); } } - - /// /// Aggiornamento opzioni dato update sash /// @@ -1432,14 +1285,15 @@ namespace WebWindowComplex private async Task UpdatePreviewSashGroup(DataUpdateSash args) { Sash newSash = args.currSash; - bool reqHwOpt = args.reqHwOption; - if (reqHwOpt) + bool svgNoHw = args.svgNoHw; + if (svgNoHw) { - // resetto hw lst - await EC_ActionReq.InvokeAsync(DataAction.ResetHwOpt); - // richiesta calcolo opzioni hardware per la singola sash group - List reqList = new List() { newSash.GroupId }; - await DoReqOptHardware(reqList); + Sash item = (Sash)SearchArea(FrameWindow, newSash.GroupId, newSash); + if (newSash != null && item != null) + { + item = newSash; + await DoPreviewSvg(true, true); + } } else { @@ -1452,16 +1306,6 @@ namespace WebWindowComplex } } - private async Task UpdateSplit(Split newSplit) - { - if (newSplit != null) - { - Split item = (Split)SearchArea(FrameWindow, newSplit.GroupId, newSplit); - item = newSplit; - await DoPreviewSvg(); - } - } - #endregion Private Methods } } \ No newline at end of file diff --git a/WebWindowComplex/WebWindowComplex.csproj b/WebWindowComplex/WebWindowComplex.csproj index c69c677..be9f69c 100644 --- a/WebWindowComplex/WebWindowComplex.csproj +++ b/WebWindowComplex/WebWindowComplex.csproj @@ -6,7 +6,7 @@ net8.0 enable enable - 2.7.11.2617 + 2.7.11.2818 Annamaria Sassi Egalware Componente gestione Configurazioni avanzate Window per LUX @@ -169,6 +169,21 @@ + + + + + + + + + + + + + + + diff --git a/WebWindowConfigurator/WebWindowConfigurator.csproj b/WebWindowConfigurator/WebWindowConfigurator.csproj index 167fb10..7678d14 100644 --- a/WebWindowConfigurator/WebWindowConfigurator.csproj +++ b/WebWindowConfigurator/WebWindowConfigurator.csproj @@ -6,7 +6,7 @@ net8.0 enable enable - 2.7.11.2617 + 2.7.11.2818 Annamaria Sassi Egalware Componente gestione JWD per LUX @@ -253,6 +253,24 @@ + + + + + + + + + + + + + + + + + + From dfe4ecd9d15a0480bc2628b841a4d20153fb0274 Mon Sep 17 00:00:00 2001 From: Annamaria Sassi Date: Tue, 2 Dec 2025 16:44:01 +0100 Subject: [PATCH 15/18] Aggiunto arc element per Frame e Sash (da rivedere) --- Test.UI/Components/Pages/EditJWD.razor.cs | 3 +- Test.UI/Data/ArcoAntaDoppia.jwd | 150 ++++++++++++++++++ Test.UI/Test.UI.csproj | 3 + WebWindowComplex/Compo/AreaFrameArcElem.razor | 66 ++++++++ .../Compo/AreaFrameArcElem.razor.cs | 81 ++++++++++ WebWindowComplex/Compo/AreaSash.razor | 39 ++--- WebWindowComplex/Compo/AreaSash.razor.cs | 2 +- WebWindowComplex/Compo/AreaSashArcElem.razor | 58 +++++++ .../Compo/AreaSashArcElem.razor.cs | 75 +++++++++ WebWindowComplex/Compo/CardArcElement.razor | 27 ++++ .../Compo/CardArcElement.razor.cs | 60 +++++++ WebWindowComplex/Compo/CardSashGroup.razor | 2 +- WebWindowComplex/Compo/CardSplit.razor | 2 +- WebWindowComplex/Json/JsonUtility.cs | 147 +++++++++++++++-- WebWindowComplex/Json/WindowConst.cs | 2 +- WebWindowComplex/LayoutConst.cs | 3 +- WebWindowComplex/Models/Area.cs | 9 +- WebWindowComplex/Models/Frame.cs | 65 +++++++- WebWindowComplex/Models/FrameArcElement.cs | 121 ++++++++++++++ WebWindowComplex/Models/FrameDimension.cs | 4 +- WebWindowComplex/Models/Sash.cs | 36 ++++- WebWindowComplex/Models/SashArcElement.cs | 96 +++++++++++ WebWindowComplex/Models/SashDimension.cs | 27 ++-- WebWindowComplex/Models/SplitDimension.cs | 26 +-- WebWindowComplex/TableComp.razor | 17 ++ WebWindowComplex/TableComp.razor.cs | 2 + WebWindowComplex/WebWindowComplex.csproj | 10 +- .../WebWindowConfigurator.csproj | 20 ++- 28 files changed, 1075 insertions(+), 78 deletions(-) create mode 100644 Test.UI/Data/ArcoAntaDoppia.jwd create mode 100644 WebWindowComplex/Compo/AreaFrameArcElem.razor create mode 100644 WebWindowComplex/Compo/AreaFrameArcElem.razor.cs create mode 100644 WebWindowComplex/Compo/AreaSashArcElem.razor create mode 100644 WebWindowComplex/Compo/AreaSashArcElem.razor.cs create mode 100644 WebWindowComplex/Compo/CardArcElement.razor create mode 100644 WebWindowComplex/Compo/CardArcElement.razor.cs create mode 100644 WebWindowComplex/Models/FrameArcElement.cs create mode 100644 WebWindowComplex/Models/SashArcElement.cs diff --git a/Test.UI/Components/Pages/EditJWD.razor.cs b/Test.UI/Components/Pages/EditJWD.razor.cs index 3e41df8..50f69ca 100644 --- a/Test.UI/Components/Pages/EditJWD.razor.cs +++ b/Test.UI/Components/Pages/EditJWD.razor.cs @@ -127,7 +127,8 @@ namespace Test.UI.Components.Pages { ConfInit(); //InitialJwd = File.ReadAllText("Data\\FinestraSplitVert.jwd"); - InitialJwd = File.ReadAllText("Data\\AntaDoppia.jwd"); + //InitialJwd = File.ReadAllText("Data\\AntaDoppia.jwd"); + InitialJwd = File.ReadAllText("Data\\ArcoAntaDoppia.jwd"); currJwd = InitialJwd; // rileggo altri dati await ReloadData(); diff --git a/Test.UI/Data/ArcoAntaDoppia.jwd b/Test.UI/Data/ArcoAntaDoppia.jwd new file mode 100644 index 0000000..b9032e7 --- /dev/null +++ b/Test.UI/Data/ArcoAntaDoppia.jwd @@ -0,0 +1,150 @@ +{ + "ProfilePath": "Profilo78", + "Material": "Pino", + "ColorMaterial": "Black", + "Glass": "Vetro BE 2S 4T/16/4T", + "AreaList": [ + { + "Shape": "ARC", + "DimensionList": [ + { + "Index": 1, + "Name": "Width", + "Value": 800.0 + }, + { + "Index": 2, + "Name": "Height", + "Value": 1500.0 + }, + { + "Index": 3, + "Name": "Full Height", + "Value": 1800.0 + } + ], + "JointList": [ + { + "Index": 1, + "JointType": "FULL_H" + }, + { + "Index": 2, + "JointType": "FULL_H" + }, + { + "Index": 3, + "JointType": "FULL_V" + }, + { + "Index": 4, + "JointType": "FULL_V" + } + ], + "BottomRail": false, + "BottomRailQty": 0, + "ArcElement": { + "Section": 10.0, + "CutEdge": true, + "IsAlign": true + }, + "GroupId": 1, + "AreaList": [ + { + "IsSashVertical": true, + "ArcElement": { + "Section": 10.0, + "CutEdge": true, + "IsAlign": true + }, + "SashList": [ + { + "SashId": 1, + "OpeningType": "TILTTURN_LEFT", + "MeasureType": "PERCENTAGE", + "Dimension": 50.0, + "HasHandle": true, + "JointList": [ + { + "Index": 1, + "JointType": "FULL_V" + }, + { + "Index": 2, + "JointType": "FULL_V" + }, + { + "Index": 3, + "JointType": "FULL_V" + }, + { + "Index": 4, + "JointType": "FULL_V" + } + ] + }, + { + "SashId": 2, + "OpeningType": "TURNONLY_RIGHT", + "MeasureType": "PERCENTAGE", + "Dimension": 50.0, + "HasHandle": false, + "JointList": [ + { + "Index": 1, + "JointType": "FULL_V" + }, + { + "Index": 2, + "JointType": "FULL_V" + }, + { + "Index": 3, + "JointType": "FULL_V" + }, + { + "Index": 4, + "JointType": "FULL_V" + } + ] + } + ], + "SashType": "NULL", + "BottomRail": false, + "BottomRailQty": 0, + "Hardware": "000644", + "HwOptionList": [], + "GroupId": 2, + "AreaList": [ + { + "GroupId": 4, + "AreaList": [ + { + "FillType": "GLASS", + "GroupId": 3, + "AreaList": [], + "AreaType": "FILL" + } + ], + "AreaType": "SPLITTED" + }, + { + "GroupId": 5, + "AreaList": [ + { + "FillType": "GLASS", + "GroupId": 6, + "AreaList": [], + "AreaType": "FILL" + } + ], + "AreaType": "SPLITTED" + } + ], + "AreaType": "SASH" + } + ], + "AreaType": "FRAME" + } + ] +} \ No newline at end of file diff --git a/Test.UI/Test.UI.csproj b/Test.UI/Test.UI.csproj index 8cf883b..75050e1 100644 --- a/Test.UI/Test.UI.csproj +++ b/Test.UI/Test.UI.csproj @@ -43,6 +43,9 @@ + + Always + Always diff --git a/WebWindowComplex/Compo/AreaFrameArcElem.razor b/WebWindowComplex/Compo/AreaFrameArcElem.razor new file mode 100644 index 0000000..0cdc13c --- /dev/null +++ b/WebWindowComplex/Compo/AreaFrameArcElem.razor @@ -0,0 +1,66 @@ + +
    +
    +
    Frame
    +
    +
    +
    +
    +
    +
    +
    + +
    +
    +
    + Qty element + @if (insertQty) + { + + } + else + { + + } +
    +
    +
    +
    +
    + +
    +
    + +
    +
    +
    +
    +
    +
    + +
    +
    +
    + Section + @if (!insertQty) + { + + } + else + { + + } +
    +
    +
    +
    +
    + +
    +
    + +
    +
    +
    +
    +
    diff --git a/WebWindowComplex/Compo/AreaFrameArcElem.razor.cs b/WebWindowComplex/Compo/AreaFrameArcElem.razor.cs new file mode 100644 index 0000000..5cc8d19 --- /dev/null +++ b/WebWindowComplex/Compo/AreaFrameArcElem.razor.cs @@ -0,0 +1,81 @@ +using Microsoft.AspNetCore.Components; +using System.Runtime.CompilerServices; +using WebWindowComplex.DTO; +using WebWindowComplex.Models; + +namespace WebWindowComplex.Compo +{ + public partial class AreaFrameArcElem + { + #region Public Properties + + [Parameter] + public Frame CurrFrame { get; set; } = null!; + + [Parameter] + public EventCallback EC_UpdatePreview { get; set; } + + #endregion Public Properties + + #region Protected Properties + + protected int ArcElementQty + { + get => CurrFrame.FrameArcElem.nQty; + set + { + CurrFrame.FrameArcElem.nQty = value; + _ = EC_UpdatePreview.InvokeAsync(CurrFrame); + } + } + + protected double ArcSection + { + get => CurrFrame.FrameArcElem.nSection; + set + { + CurrFrame.FrameArcElem.nSection = value; + _ = EC_UpdatePreview.InvokeAsync(CurrFrame); + } + } + + #endregion Protected Properties + + #region Protected Methods + + protected void IsCheckedQty() + { + insertQty = !insertQty; + } + + protected void IsCheckCutEdge() + { + CurrFrame.FrameArcElem.bCutEdge = !CurrFrame.FrameArcElem.bCutEdge; + _ = EC_UpdatePreview.InvokeAsync(CurrFrame); + } + + protected void IsCheckAlign() + { + CurrFrame.FrameArcElem.bIsAlign = !CurrFrame.FrameArcElem.bIsAlign; + _ = EC_UpdatePreview.InvokeAsync(CurrFrame); + } + + protected string IsUsedQty() + { + if (insertQty) + return "form-control"; + else + return "form-control disabled"; + } + + + #endregion Protected Methods + + #region Private Fields + + private bool insertQty = false; + + #endregion Private Fields + } + +} \ No newline at end of file diff --git a/WebWindowComplex/Compo/AreaSash.razor b/WebWindowComplex/Compo/AreaSash.razor index 5e91ec6..3ddd227 100644 --- a/WebWindowComplex/Compo/AreaSash.razor +++ b/WebWindowComplex/Compo/AreaSash.razor @@ -4,26 +4,29 @@
    Sash @(CurrSashGroup.SashList.Count == 1 ? "" : (IndexSash + 1))
    - + }
    diff --git a/WebWindowComplex/Compo/AreaSash.razor.cs b/WebWindowComplex/Compo/AreaSash.razor.cs index c62b8bf..c3cff0e 100644 --- a/WebWindowComplex/Compo/AreaSash.razor.cs +++ b/WebWindowComplex/Compo/AreaSash.razor.cs @@ -84,7 +84,7 @@ namespace WebWindowComplex.Compo { switch (CurrSashDim.MeasureType) { - case Json.WindowConst.MeasureTypes.ABSOLUT: + case Json.WindowConst.MeasureTypes.ABSOLUTE: { return 2; } diff --git a/WebWindowComplex/Compo/AreaSashArcElem.razor b/WebWindowComplex/Compo/AreaSashArcElem.razor new file mode 100644 index 0000000..b68d1f9 --- /dev/null +++ b/WebWindowComplex/Compo/AreaSashArcElem.razor @@ -0,0 +1,58 @@ + +
    +
    +
    Sash
    +
    +
    +
    +
    +
    +
    +
    + +
    +
    +
    + Qty element + @if (insertQty) + { + + } + else + { + + } +
    +
    +
    +
    +
    + +
    +
    + +
    +
    +
    +
    +
    +
    + +
    +
    +
    + Section + @if (!insertQty) + { + + } + else + { + + } +
    +
    +
    +
    +
    +
    diff --git a/WebWindowComplex/Compo/AreaSashArcElem.razor.cs b/WebWindowComplex/Compo/AreaSashArcElem.razor.cs new file mode 100644 index 0000000..eff80f7 --- /dev/null +++ b/WebWindowComplex/Compo/AreaSashArcElem.razor.cs @@ -0,0 +1,75 @@ +using Microsoft.AspNetCore.Components; +using System.Runtime.CompilerServices; +using WebWindowComplex.DTO; +using WebWindowComplex.Models; + +namespace WebWindowComplex.Compo +{ + public partial class AreaSashArcElem + { + #region Public Properties + + [Parameter] + public Sash CurrSashGroup { get; set; } = null!; + + [Parameter] + public EventCallback EC_UpdatePreview { get; set; } + + #endregion Public Properties + + #region Protected Properties + + protected int ArcElementQty + { + get => CurrSashGroup.SashArcElem.nQty; + set + { + CurrSashGroup.SashArcElem.nQty = value; + _ = EC_UpdatePreview.InvokeAsync(CurrSashGroup); + } + } + + protected double ArcSection + { + get => CurrSashGroup.SashArcElem.nSection; + set + { + CurrSashGroup.SashArcElem.nSection = value; + _ = EC_UpdatePreview.InvokeAsync(CurrSashGroup); + } + } + + #endregion Protected Properties + + #region Protected Methods + + protected void IsCheckedQty() + { + insertQty = !insertQty; + } + + protected void IsCheckCutEdge() + { + CurrSashGroup.SashArcElem.bCutEdge = !CurrSashGroup.SashArcElem.bCutEdge; + _ = EC_UpdatePreview.InvokeAsync(CurrSashGroup); + } + + protected string IsUsedQty() + { + if (insertQty) + return "form-control"; + else + return "form-control disabled"; + } + + + #endregion Protected Methods + + #region Private Fields + + private bool insertQty = false; + + #endregion Private Fields + } + +} \ No newline at end of file diff --git a/WebWindowComplex/Compo/CardArcElement.razor b/WebWindowComplex/Compo/CardArcElement.razor new file mode 100644 index 0000000..e29174e --- /dev/null +++ b/WebWindowComplex/Compo/CardArcElement.razor @@ -0,0 +1,27 @@ +
    +
    +
    +
    +
    Arc Element
    +
    +
    + +
    +
    +
    +
    +
    + + + + @foreach (var sashGroup in SashList) + { +
    + + + } +
    +
    +
    \ No newline at end of file diff --git a/WebWindowComplex/Compo/CardArcElement.razor.cs b/WebWindowComplex/Compo/CardArcElement.razor.cs new file mode 100644 index 0000000..19bc564 --- /dev/null +++ b/WebWindowComplex/Compo/CardArcElement.razor.cs @@ -0,0 +1,60 @@ +using Microsoft.AspNetCore.Components; +using WebWindowComplex.DTO; +using WebWindowComplex.Models; + +namespace WebWindowComplex.Compo +{ + public partial class CardArcElement + { + #region Public Properties + + /// + /// Finestra corrente + /// + [Parameter] + public Frame CurrFrame { get; set; } = null!; + + /// + /// Lista sash group + /// + [Parameter] + public List SashList { get; set; } = null!; + + [Parameter] + public EventCallback EC_UpdatePreview { get; set; } + + [Parameter] + public EventCallback EC_ReqClose { get; set; } + + #endregion Public Properties + + private async Task UpdatePreview() + { + var args = new DataUpdateFrame + { + currFrame = CurrFrame + }; + await EC_UpdatePreview.InvokeAsync(args); + } + + private async Task UpdatePreviewSash(Sash CurrSashGRoup) + { + var currRec = SashList.First(x => x.GroupId == CurrSashGRoup.GroupId); + if (currRec != null) + { + currRec = CurrSashGRoup; + var args = new DataUpdateFrame + { + currFrame = CurrFrame + }; + await EC_UpdatePreview.InvokeAsync(args); + } + } + + private void ReqClose() + { + _ = EC_ReqClose.InvokeAsync(true); + } + } + +} \ No newline at end of file diff --git a/WebWindowComplex/Compo/CardSashGroup.razor b/WebWindowComplex/Compo/CardSashGroup.razor index 33f4aa2..9689706 100644 --- a/WebWindowComplex/Compo/CardSashGroup.razor +++ b/WebWindowComplex/Compo/CardSashGroup.razor @@ -110,7 +110,7 @@
    @@ -188,6 +197,14 @@ EC_ReqClose="ReturnTree"> } + else if (currStep == CompileStep.ArcElement) + { + + + }
    diff --git a/WebWindowComplex/TableComp.razor.cs b/WebWindowComplex/TableComp.razor.cs index 20c4d59..16fbfb4 100644 --- a/WebWindowComplex/TableComp.razor.cs +++ b/WebWindowComplex/TableComp.razor.cs @@ -601,9 +601,11 @@ namespace WebWindowComplex new Joint(frame, 3, Joints.FULL_H), new Joint(frame, 4, Joints.FULL_H) }; + FrameArcElement ae = new FrameArcElement(frame, window, 10, true, true); JsonWindow jsonWindow = new JsonWindow("Profilo78", "Pino", "Black", "Vetro BE 2S 4T/16/4T"); JsonFrame jsonFrame = new JsonFrame(Shapes.RECTANGLE, false, 0, 1); jsonWindow.AreaList.Add(jsonFrame); + jsonFrame.ArcElement = ae.Serialize(); foreach (var Dimension in DimensionList) jsonFrame.DimensionList.Add(Dimension.Serialize()); foreach (var Joint in JointList) diff --git a/WebWindowComplex/WebWindowComplex.csproj b/WebWindowComplex/WebWindowComplex.csproj index be9f69c..a029df9 100644 --- a/WebWindowComplex/WebWindowComplex.csproj +++ b/WebWindowComplex/WebWindowComplex.csproj @@ -6,7 +6,7 @@ net8.0 enable enable - 2.7.11.2818 + 2.7.12.216 Annamaria Sassi Egalware Componente gestione Configurazioni avanzate Window per LUX @@ -191,6 +191,14 @@ + + + + + + + + diff --git a/WebWindowConfigurator/WebWindowConfigurator.csproj b/WebWindowConfigurator/WebWindowConfigurator.csproj index 7678d14..1e3e508 100644 --- a/WebWindowConfigurator/WebWindowConfigurator.csproj +++ b/WebWindowConfigurator/WebWindowConfigurator.csproj @@ -6,7 +6,7 @@ net8.0 enable enable - 2.7.11.2818 + 2.7.12.216 Annamaria Sassi Egalware Componente gestione JWD per LUX @@ -271,6 +271,24 @@ + + + + + + + + + + + + + + + + + + From ba80c4eca0c4924261d8cf496afea234cf30fa30 Mon Sep 17 00:00:00 2001 From: Annamaria Sassi Date: Tue, 2 Dec 2025 18:19:57 +0100 Subject: [PATCH 16/18] Aggiornato inserimento dimensioni frame con arco --- WebWindowComplex/Models/FrameDimension.cs | 97 +++++++++++++++++-- WebWindowComplex/WebWindowComplex.csproj | 7 +- .../WebWindowConfigurator.csproj | 3 +- 3 files changed, 97 insertions(+), 10 deletions(-) diff --git a/WebWindowComplex/Models/FrameDimension.cs b/WebWindowComplex/Models/FrameDimension.cs index 2d5dae9..02c71f6 100644 --- a/WebWindowComplex/Models/FrameDimension.cs +++ b/WebWindowComplex/Models/FrameDimension.cs @@ -35,14 +35,95 @@ namespace WebWindowComplex.Models { if(m_dValue != value) { - m_dValue = value; - if (value > MaxDim) + if (ParentFrame.SelShapeIndex == (int)Shapes.RECTANGLE || + ParentFrame.SelShapeIndex == (int)Shapes.RIGHTCHAMFER || + ParentFrame.SelShapeIndex == (int)Shapes.LEFTCHAMFER || + ParentFrame.SelShapeIndex == (int)Shapes.DOUBLECHAMFER) { - m_dValue = MaxDim; + if (value > MaxDim) + { + m_dValue = MaxDim; + } + else if (value < MinDim && !m_sName.Equals("Radius")) + { + m_dValue = MinDim; + } + else + m_dValue = value; } - else if (value < MinDim && !m_sName.Equals("Radius")) + else { - m_dValue = MinDim; + if (ParentFrame.SelShapeIndex == (int)Shapes.ARC_FULL) + { + var width = ParentFrame.DimensionList.First(x => x.sName.Equals("Width")).dValue; + var height = ParentFrame.DimensionList.First(x => x.sName.Equals("Height")).dValue; + if (sName.Equals("Height") && value > 0.5 * width && value < MaxDim) + { + m_dValue = value; + } + else if (sName.Equals("Width") && height > 0.5 * value && value > MinDim) + { + m_dValue = value; + } + } + else if (ParentFrame.SelShapeIndex == (int)Shapes.ARC) + { + var width = ParentFrame.DimensionList.First(x => x.sName.Equals("Width")).dValue; + var height = ParentFrame.DimensionList.First(x => x.sName.Equals("Height")).dValue; + var fullHeight = ParentFrame.DimensionList.First(x => x.sName.Equals("Full Height")).dValue; + if (sName.Equals("Full Height") && (value - height) < 0.5 * width && value < MaxDim) + { + m_dValue = value; + } + else if (sName.Equals("Height") && (fullHeight - value) < 0.5 * width && value < MaxDim) + { + m_dValue = value; + } + else if (sName.Equals("Width") && (fullHeight - height) < 0.5 * value && value < MaxDim) + { + m_dValue = value; + } + } + else if (ParentFrame.SelShapeIndex == (int)Shapes.THREECENTERARC) + { + var width = ParentFrame.DimensionList.First(x => x.sName.Equals("Width")).dValue; + var height = ParentFrame.DimensionList.First(x => x.sName.Equals("Height")).dValue; + var fullHeight = ParentFrame.DimensionList.First(x => x.sName.Equals("Full Height")).dValue; + if (sName.Equals("Full Height") && (value - height) < 0.5 * width && value < MaxDim) + { + m_dValue = value; + } + else if (sName.Equals("Height") && (fullHeight - value) < 0.5 * width && value < MaxDim) + { + m_dValue = value; + } + else if (sName.Equals("Width") && (fullHeight - height) < 0.5 * value) + { + m_dValue = value; + } + else if (sName.Equals("Radius") && value < 0.5 * width) + { + m_dValue = value; + } + } + else if (ParentFrame.SelShapeIndex == (int)Shapes.DOUBLEARC) + { + var width = ParentFrame.DimensionList.First(x => x.sName.Equals("Width")).dValue; + var height = ParentFrame.DimensionList.First(x => x.sName.Equals("Height")).dValue; + var fullHeight = ParentFrame.DimensionList.First(x => x.sName.Equals("Full Height")).dValue; + if (sName.Equals("Full Height") && (value - height) > 0.5 * width && value < MaxDim) + { + m_dValue = value; + } + else if (sName.Equals("Height") && (fullHeight - value) > 0.5 * width && value < MaxDim) + { + m_dValue = value; + } + else if (sName.Equals("Width") && (fullHeight - height) > 0.5 * value && value > MinDim) + { + m_dValue = value; + } + } } if (ParentFrame.AreaList.Count > 0) SearchAreaList(ParentFrame); @@ -87,9 +168,9 @@ namespace WebWindowComplex.Models if (node != null) { if (node.AreaType.Equals(AreaTypes.SASH)) - updateDimSubArea((Sash)node); + UpdateDimSubArea((Sash)node); else if (node.AreaType.Equals(AreaTypes.SPLIT)) - updateDimSubArea((Split)node); + UpdateDimSubArea((Split)node); foreach (var item in node.AreaList) { SearchAreaList(item); @@ -97,7 +178,7 @@ namespace WebWindowComplex.Models } } - protected void updateDimSubArea(Area area) + protected void UpdateDimSubArea(Area area) { if(area is Sash && sName.Equals("Width")) { diff --git a/WebWindowComplex/WebWindowComplex.csproj b/WebWindowComplex/WebWindowComplex.csproj index a029df9..27b6fa2 100644 --- a/WebWindowComplex/WebWindowComplex.csproj +++ b/WebWindowComplex/WebWindowComplex.csproj @@ -6,7 +6,7 @@ net8.0 enable enable - 2.7.12.216 + 2.7.12.218 Annamaria Sassi Egalware Componente gestione Configurazioni avanzate Window per LUX @@ -202,6 +202,11 @@ + + + + + diff --git a/WebWindowConfigurator/WebWindowConfigurator.csproj b/WebWindowConfigurator/WebWindowConfigurator.csproj index 1e3e508..ec2f12c 100644 --- a/WebWindowConfigurator/WebWindowConfigurator.csproj +++ b/WebWindowConfigurator/WebWindowConfigurator.csproj @@ -6,7 +6,7 @@ net8.0 enable enable - 2.7.12.216 + 2.7.12.218 Annamaria Sassi Egalware Componente gestione JWD per LUX @@ -306,5 +306,6 @@ + From 5e3e535139ba208a85b7aeaa4892106020369c07 Mon Sep 17 00:00:00 2001 From: Annamaria Sassi Date: Thu, 4 Dec 2025 16:19:51 +0100 Subject: [PATCH 17/18] - Corretto conversione misure dimensioni - Aggiornato tipi misure negli split (sia verticale sia orizzontale) - Aggiornati commenti --- Test.UI/Components/Pages/EditJWD.razor.cs | 4 +- WebWindowComplex/Compo/AreaFrame.razor.cs | 13 +- WebWindowComplex/Compo/AreaFrameArcElem.razor | 8 +- .../Compo/AreaFrameArcElem.razor.cs | 59 +++-- WebWindowComplex/Compo/AreaHwOption.razor.cs | 6 +- WebWindowComplex/Compo/AreaSash.razor | 8 +- WebWindowComplex/Compo/AreaSash.razor.cs | 20 +- WebWindowComplex/Compo/AreaSashArcElem.razor | 6 +- .../Compo/AreaSashArcElem.razor.cs | 49 ++-- WebWindowComplex/Compo/AreaSplit.razor.cs | 4 +- .../Compo/CardArcElement.razor.cs | 2 +- WebWindowComplex/Compo/CardFill.razor.cs | 4 +- WebWindowComplex/Compo/CardFrame.razor.cs | 20 +- WebWindowComplex/Compo/CardSashGroup.razor | 2 +- WebWindowComplex/Compo/CardSashGroup.razor.cs | 23 +- WebWindowComplex/Compo/CardSplit.razor | 10 +- WebWindowComplex/Compo/CardSplit.razor.cs | 19 +- WebWindowComplex/Compo/CardTree.razor.cs | 24 +- .../Compo/EditFrameDimensions.razor.cs | 6 + WebWindowComplex/Compo/EditJoint.razor.cs | 7 + .../Compo/EditOptionCombo.razor.cs | 6 + .../Compo/EditOptionText.razor.cs | 6 + .../Compo/EditSplitDimensions.razor | 2 +- .../Compo/EditSplitDimensions.razor.cs | 18 ++ WebWindowComplex/Compo/General.razor.cs | 16 ++ WebWindowComplex/ItemTable.cs | 12 + WebWindowComplex/Json/JsonUtility.cs | 244 +++++++++--------- WebWindowComplex/Models/AGBOptionText.cs | 4 +- WebWindowComplex/Models/Area.cs | 172 +++++++++++- WebWindowComplex/Models/Frame.cs | 105 +++++--- WebWindowComplex/Models/FrameArcElement.cs | 10 +- WebWindowComplex/Models/FrameDimension.cs | 70 ++++- .../{ => Models}/ParametriOpzioni.cs | 68 ++--- WebWindowComplex/Models/Sash.cs | 242 ++++++++--------- WebWindowComplex/Models/SashArcElement.cs | 10 +- WebWindowComplex/Models/SashDimension.cs | 94 ++++--- WebWindowComplex/Models/Split.cs | 44 +++- WebWindowComplex/Models/SplitDimension.cs | 130 ++++++---- WebWindowComplex/Models/Window.cs | 2 +- WebWindowComplex/TableComp.razor | 8 +- WebWindowComplex/TableComp.razor.cs | 19 +- WebWindowComplex/WebWindowComplex.csproj | 34 ++- .../WebWindowConfigurator.csproj | 53 +++- WebWindowConfigurator/Window.cs | 110 +------- WebWindowTest/Models/Sash.cs | 16 +- 45 files changed, 1107 insertions(+), 682 deletions(-) rename WebWindowComplex/{ => Models}/ParametriOpzioni.cs (54%) diff --git a/Test.UI/Components/Pages/EditJWD.razor.cs b/Test.UI/Components/Pages/EditJWD.razor.cs index 50f69ca..9995aad 100644 --- a/Test.UI/Components/Pages/EditJWD.razor.cs +++ b/Test.UI/Components/Pages/EditJWD.razor.cs @@ -127,8 +127,8 @@ namespace Test.UI.Components.Pages { ConfInit(); //InitialJwd = File.ReadAllText("Data\\FinestraSplitVert.jwd"); - //InitialJwd = File.ReadAllText("Data\\AntaDoppia.jwd"); - InitialJwd = File.ReadAllText("Data\\ArcoAntaDoppia.jwd"); + InitialJwd = File.ReadAllText("Data\\AntaDoppia.jwd"); + //InitialJwd = File.ReadAllText("Data\\ArcoAntaDoppia.jwd"); currJwd = InitialJwd; // rileggo altri dati await ReloadData(); diff --git a/WebWindowComplex/Compo/AreaFrame.razor.cs b/WebWindowComplex/Compo/AreaFrame.razor.cs index b9d1b94..b4c30d0 100644 --- a/WebWindowComplex/Compo/AreaFrame.razor.cs +++ b/WebWindowComplex/Compo/AreaFrame.razor.cs @@ -7,12 +7,21 @@ namespace WebWindowComplex.Compo { #region Public Properties + /// + /// Frame corrente + /// [CascadingParameter(Name = "CurrFrameWindow")] public Frame CurrFrameWindow { get; set; } = null!; + /// + /// Lista sash + /// [CascadingParameter(Name = "SashList")] public List SashList { get; set; } = null!; + /// + /// Lista split + /// [CascadingParameter(Name = "SplitList")] public List SplitList { get; set; } = null!; @@ -27,7 +36,7 @@ namespace WebWindowComplex.Compo #region Private Methods /// - /// Sollevo evento richiesta aggiunta sash + /// Sollevo evento richiesta aggiunta sash su frame /// /// private async Task RaiseAddSash() @@ -36,7 +45,7 @@ namespace WebWindowComplex.Compo } /// - /// Sollevo evento richiesta aggiunta window + /// Sollevo evento richiesta aggiunta split su frame /// /// private async Task RaiseAddSplit() diff --git a/WebWindowComplex/Compo/AreaFrameArcElem.razor b/WebWindowComplex/Compo/AreaFrameArcElem.razor index 0cdc13c..c167194 100644 --- a/WebWindowComplex/Compo/AreaFrameArcElem.razor +++ b/WebWindowComplex/Compo/AreaFrameArcElem.razor @@ -16,7 +16,7 @@ Qty element @if (insertQty) { - + @* *@ } else { @@ -27,7 +27,7 @@
    - + @* *@
    @@ -44,7 +44,7 @@ Section @if (!insertQty) { - + @* *@ } else { @@ -55,7 +55,7 @@
    - + @* *@
    diff --git a/WebWindowComplex/Compo/AreaFrameArcElem.razor.cs b/WebWindowComplex/Compo/AreaFrameArcElem.razor.cs index 5cc8d19..656101f 100644 --- a/WebWindowComplex/Compo/AreaFrameArcElem.razor.cs +++ b/WebWindowComplex/Compo/AreaFrameArcElem.razor.cs @@ -9,6 +9,9 @@ namespace WebWindowComplex.Compo { #region Public Properties + /// + /// Frame corrente + /// [Parameter] public Frame CurrFrame { get; set; } = null!; @@ -19,25 +22,25 @@ namespace WebWindowComplex.Compo #region Protected Properties - protected int ArcElementQty - { - get => CurrFrame.FrameArcElem.nQty; - set - { - CurrFrame.FrameArcElem.nQty = value; - _ = EC_UpdatePreview.InvokeAsync(CurrFrame); - } - } + //protected int ArcElementQty + //{ + // get => CurrFrame.FrameArcElem.nQty; + // set + // { + // CurrFrame.FrameArcElem.nQty = value; + // _ = EC_UpdatePreview.InvokeAsync(CurrFrame); + // } + //} - protected double ArcSection - { - get => CurrFrame.FrameArcElem.nSection; - set - { - CurrFrame.FrameArcElem.nSection = value; - _ = EC_UpdatePreview.InvokeAsync(CurrFrame); - } - } + //protected double ArcSection + //{ + // get => CurrFrame.FrameArcElem.nSection; + // set + // { + // CurrFrame.FrameArcElem.nSection = value; + // _ = EC_UpdatePreview.InvokeAsync(CurrFrame); + // } + //} #endregion Protected Properties @@ -48,17 +51,17 @@ namespace WebWindowComplex.Compo insertQty = !insertQty; } - protected void IsCheckCutEdge() - { - CurrFrame.FrameArcElem.bCutEdge = !CurrFrame.FrameArcElem.bCutEdge; - _ = EC_UpdatePreview.InvokeAsync(CurrFrame); - } + //protected void IsCheckCutEdge() + //{ + // CurrFrame.FrameArcElem.bCutEdge = !CurrFrame.FrameArcElem.bCutEdge; + // _ = EC_UpdatePreview.InvokeAsync(CurrFrame); + //} - protected void IsCheckAlign() - { - CurrFrame.FrameArcElem.bIsAlign = !CurrFrame.FrameArcElem.bIsAlign; - _ = EC_UpdatePreview.InvokeAsync(CurrFrame); - } + //protected void IsCheckAlign() + //{ + // CurrFrame.FrameArcElem.bIsAlign = !CurrFrame.FrameArcElem.bIsAlign; + // _ = EC_UpdatePreview.InvokeAsync(CurrFrame); + //} protected string IsUsedQty() { diff --git a/WebWindowComplex/Compo/AreaHwOption.razor.cs b/WebWindowComplex/Compo/AreaHwOption.razor.cs index ae1f6ff..c455ca6 100644 --- a/WebWindowComplex/Compo/AreaHwOption.razor.cs +++ b/WebWindowComplex/Compo/AreaHwOption.razor.cs @@ -15,7 +15,7 @@ namespace WebWindowComplex.Compo public Sash CurrSashGroup { get; set; } = null!; /// - /// Evento per aggiornare gli hardware option di tipo text + /// Evento per aggiornare gli hardware option /// [Parameter] public EventCallback EC_UpdateHwOpt { get; set; } @@ -80,12 +80,16 @@ namespace WebWindowComplex.Compo }; await EC_UpdateHwOpt.InvokeAsync(args); } + private bool IsLoadingHwOpt { get => IsLoading != null && IsLoading.Count > 0 && IsLoading.Contains("LoadHwOpt"); } } + /// + /// Classe per oggetto di aggiornamento delle opzioni + /// public class DataUpdateHwOption { public AGBOptionText AGBOptText { get; set; } = null; diff --git a/WebWindowComplex/Compo/AreaSash.razor b/WebWindowComplex/Compo/AreaSash.razor index 3ddd227..5474ae7 100644 --- a/WebWindowComplex/Compo/AreaSash.razor +++ b/WebWindowComplex/Compo/AreaSash.razor @@ -48,7 +48,7 @@
    *@ } diff --git a/WebWindowComplex/Compo/AreaSash.razor.cs b/WebWindowComplex/Compo/AreaSash.razor.cs index c3cff0e..0719022 100644 --- a/WebWindowComplex/Compo/AreaSash.razor.cs +++ b/WebWindowComplex/Compo/AreaSash.razor.cs @@ -22,13 +22,13 @@ namespace WebWindowComplex.Compo public SashDimension CurrSashDim { get; set; } = null!; /// - /// Sash group corrente + /// Lista delle sash /// [CascadingParameter(Name = "SashList")] public List SashList { get; set; } = null!; /// - /// Sash dimension corrente + /// Modalità di visualizzazione (view /edit) /// [Parameter] public bool EditMode { get; set; } = false; @@ -80,6 +80,10 @@ namespace WebWindowComplex.Compo } } + /// + /// Metodo per avere il numero di decimali da usare nella form-input + /// + /// public int CssDecimals() { switch (CurrSashDim.MeasureType) @@ -133,7 +137,7 @@ namespace WebWindowComplex.Compo } /// - /// Selezione tipo di apertura anta + /// Inserimento dimensione anta /// protected double Dimension { @@ -160,7 +164,7 @@ namespace WebWindowComplex.Compo } /// - /// Report aggiornamento joint + /// Aggiornamento joint /// /// /// @@ -177,7 +181,7 @@ namespace WebWindowComplex.Compo } /// - /// Sollevo evento per cambiare l'anta su cui � presente la maniglia + /// Metodo per cambiare l'anta su cui è presente la maniglia /// /// private async Task ChangeHandle() @@ -253,11 +257,17 @@ namespace WebWindowComplex.Compo } private bool isOpen = false; + private void ToggleDropdown() { isOpen = !isOpen; } + /// + /// Metodo per determinare la visualizzazione dei pulsanti dei joint + /// + /// + /// private string ButtonJointCss(WebWindowComplex.Json.WindowConst.Joints type) { foreach (var item in CurrSashDim.JointList) diff --git a/WebWindowComplex/Compo/AreaSashArcElem.razor b/WebWindowComplex/Compo/AreaSashArcElem.razor index b68d1f9..4c0f3ae 100644 --- a/WebWindowComplex/Compo/AreaSashArcElem.razor +++ b/WebWindowComplex/Compo/AreaSashArcElem.razor @@ -16,7 +16,7 @@ Qty element @if (insertQty) { - + @* *@ } else { @@ -27,7 +27,7 @@
    - + @* *@
    @@ -44,7 +44,7 @@ Section @if (!insertQty) { - + @* *@ } else { diff --git a/WebWindowComplex/Compo/AreaSashArcElem.razor.cs b/WebWindowComplex/Compo/AreaSashArcElem.razor.cs index eff80f7..07e06d7 100644 --- a/WebWindowComplex/Compo/AreaSashArcElem.razor.cs +++ b/WebWindowComplex/Compo/AreaSashArcElem.razor.cs @@ -9,6 +9,9 @@ namespace WebWindowComplex.Compo { #region Public Properties + /// + /// Sash corrente + /// [Parameter] public Sash CurrSashGroup { get; set; } = null!; @@ -19,25 +22,25 @@ namespace WebWindowComplex.Compo #region Protected Properties - protected int ArcElementQty - { - get => CurrSashGroup.SashArcElem.nQty; - set - { - CurrSashGroup.SashArcElem.nQty = value; - _ = EC_UpdatePreview.InvokeAsync(CurrSashGroup); - } - } + //protected int ArcElementQty + //{ + // get => CurrSashGroup.SashArcElem.nQty; + // set + // { + // CurrSashGroup.SashArcElem.nQty = value; + // _ = EC_UpdatePreview.InvokeAsync(CurrSashGroup); + // } + //} - protected double ArcSection - { - get => CurrSashGroup.SashArcElem.nSection; - set - { - CurrSashGroup.SashArcElem.nSection = value; - _ = EC_UpdatePreview.InvokeAsync(CurrSashGroup); - } - } + //protected double ArcSection + //{ + // get => CurrSashGroup.SashArcElem.nSection; + // set + // { + // CurrSashGroup.SashArcElem.nSection = value; + // _ = EC_UpdatePreview.InvokeAsync(CurrSashGroup); + // } + //} #endregion Protected Properties @@ -48,11 +51,11 @@ namespace WebWindowComplex.Compo insertQty = !insertQty; } - protected void IsCheckCutEdge() - { - CurrSashGroup.SashArcElem.bCutEdge = !CurrSashGroup.SashArcElem.bCutEdge; - _ = EC_UpdatePreview.InvokeAsync(CurrSashGroup); - } + //protected void IsCheckCutEdge() + //{ + // CurrSashGroup.SashArcElem.bCutEdge = !CurrSashGroup.SashArcElem.bCutEdge; + // _ = EC_UpdatePreview.InvokeAsync(CurrSashGroup); + //} protected string IsUsedQty() { diff --git a/WebWindowComplex/Compo/AreaSplit.razor.cs b/WebWindowComplex/Compo/AreaSplit.razor.cs index a2d43a2..aba53c8 100644 --- a/WebWindowComplex/Compo/AreaSplit.razor.cs +++ b/WebWindowComplex/Compo/AreaSplit.razor.cs @@ -37,7 +37,7 @@ namespace WebWindowComplex.Compo #region Private Methods /// - /// Sollevo evento richiesta copia sash + /// Metodo per copiare sash /// /// private async Task RaiseCopySash(int indexCurrSash) @@ -53,7 +53,7 @@ namespace WebWindowComplex.Compo } /// - /// Sollevo evento richiesta aggiunta sash + /// Metodo per aggiungere prima sash /// /// private async Task RaiseAddSash() diff --git a/WebWindowComplex/Compo/CardArcElement.razor.cs b/WebWindowComplex/Compo/CardArcElement.razor.cs index 19bc564..6d9646a 100644 --- a/WebWindowComplex/Compo/CardArcElement.razor.cs +++ b/WebWindowComplex/Compo/CardArcElement.razor.cs @@ -9,7 +9,7 @@ namespace WebWindowComplex.Compo #region Public Properties /// - /// Finestra corrente + /// Frame corrente /// [Parameter] public Frame CurrFrame { get; set; } = null!; diff --git a/WebWindowComplex/Compo/CardFill.razor.cs b/WebWindowComplex/Compo/CardFill.razor.cs index 5ee1ddc..7b5c001 100644 --- a/WebWindowComplex/Compo/CardFill.razor.cs +++ b/WebWindowComplex/Compo/CardFill.razor.cs @@ -37,7 +37,7 @@ namespace WebWindowComplex.Compo #region Protected Methods /// - /// Sollevo evento per cambiare solo il Fill corrente + /// Metodo per cambiare solo il Fill corrente /// /// tipo di fill richiesto /// @@ -52,7 +52,7 @@ namespace WebWindowComplex.Compo #region Private Methods /// - /// Sollevo evento per tornare alla pagina Tree + /// Metodo per tornare alla pagina Tree /// private void ReqClose() { diff --git a/WebWindowComplex/Compo/CardFrame.razor.cs b/WebWindowComplex/Compo/CardFrame.razor.cs index e49e527..f0b3b16 100644 --- a/WebWindowComplex/Compo/CardFrame.razor.cs +++ b/WebWindowComplex/Compo/CardFrame.razor.cs @@ -53,6 +53,9 @@ namespace WebWindowComplex.Compo #region Protected Properties + /// + /// Metodo per selezionare shape + /// protected int SelShapeIndex { get => CurrFrameWindow.SelShapeIndex; @@ -79,6 +82,9 @@ namespace WebWindowComplex.Compo } } + /// + /// Selezione quantità bottom rail + /// protected int FrameBottomRailQty { get => CurrFrameWindow.BottomRailQty; @@ -106,7 +112,7 @@ namespace WebWindowComplex.Compo #region Private Methods /// - /// Sollevo evento richiesta aggiunta sash + /// Metodo per aggiungere sash /// /// private async Task AddSash() @@ -121,7 +127,7 @@ namespace WebWindowComplex.Compo } /// - /// Sollevo evento richiesta aggiunta window + /// Metodo per aggiungere window /// /// private async Task AddSplit() @@ -133,11 +139,12 @@ namespace WebWindowComplex.Compo svgNoHw = true }; await EC_ReqResetDictShape.InvokeAsync(); + await EC_ReqOptionHw.InvokeAsync(CurrFrameWindow); await EC_UpdatePreview.InvokeAsync(args); } /// - /// Sollevo evento richiesta copia sash + /// Metodo per cambiare tutti i joint /// /// private async Task ChangeAllJoints(Json.WindowConst.Joints JointType, Area a) @@ -188,7 +195,7 @@ namespace WebWindowComplex.Compo } /// - /// Report aggiornamento joint + /// Aggiornamento joint /// /// /// @@ -209,6 +216,11 @@ namespace WebWindowComplex.Compo } } + /// + /// Metodo per la visualizzazione dei pulsanti joint + /// + /// + /// private string ButtonJointCss(WebWindowComplex.Json.WindowConst.Joints type) { foreach (var item in CurrFrameWindow.JointList) diff --git a/WebWindowComplex/Compo/CardSashGroup.razor b/WebWindowComplex/Compo/CardSashGroup.razor index 9689706..aa9f8d7 100644 --- a/WebWindowComplex/Compo/CardSashGroup.razor +++ b/WebWindowComplex/Compo/CardSashGroup.razor @@ -115,7 +115,7 @@
  • -
  • diff --git a/WebWindowComplex/Compo/CardSashGroup.razor.cs b/WebWindowComplex/Compo/CardSashGroup.razor.cs index 8e4f4a2..37dbb4c 100644 --- a/WebWindowComplex/Compo/CardSashGroup.razor.cs +++ b/WebWindowComplex/Compo/CardSashGroup.razor.cs @@ -51,7 +51,7 @@ namespace WebWindowComplex.Compo public EventCallback EC_ReqFirstOptionHw { get; set; } /// - /// Evento per segnalare cambio hw e richiesta calcolo + /// Evento per segnalare aggiornamento /// [Parameter] public EventCallback EC_UpdatePreview { get; set; } @@ -63,7 +63,7 @@ namespace WebWindowComplex.Compo public List SashList { get; set; } = null!; /// - /// Lista di sash + /// Frame corrente /// [Parameter] public Frame FrameWindow { get; set; } = null!; @@ -188,7 +188,7 @@ namespace WebWindowComplex.Compo #region Protected Methods /// - /// Sollevo evento per rimuovere area + /// Metodo per rimuovere area /// /// area da rimuovere /// @@ -204,6 +204,11 @@ namespace WebWindowComplex.Compo await EC_UpdateFrame.InvokeAsync(args); } + /// + /// Metodo per scegliere tipo di misura + /// + /// + /// protected async Task SetMeasureType(MeasureTypes type) { isOpen = !isOpen; @@ -218,6 +223,11 @@ namespace WebWindowComplex.Compo await EC_UpdatePreview.InvokeAsync(args); } + /// + /// Metodo per aggiornare la sash dimension + /// + /// + /// protected async Task UpdateSashDimension(SashDimension updateSD) { var currRec = CurrSashGroup.SashList.First(x => x.nSashId == updateSD.nSashId); @@ -232,6 +242,11 @@ namespace WebWindowComplex.Compo } } + /// + /// Metodo per aggiornare sash + /// + /// + /// protected async Task UpdateSash(Sash updateS) { if (updateS != null) @@ -269,7 +284,7 @@ namespace WebWindowComplex.Compo } /// - /// Report aggiornamento Option Combo + /// Aggiornamento opzioni hardware /// /// /// diff --git a/WebWindowComplex/Compo/CardSplit.razor b/WebWindowComplex/Compo/CardSplit.razor index bffee85..bc3cb28 100644 --- a/WebWindowComplex/Compo/CardSplit.razor +++ b/WebWindowComplex/Compo/CardSplit.razor @@ -34,7 +34,7 @@
  • -
  • @@ -99,7 +99,7 @@
    @@ -197,14 +197,14 @@ EC_ReqClose="ReturnTree"> } - else if (currStep == CompileStep.ArcElement) + @* else if (currStep == CompileStep.ArcElement) { - } + } *@
    diff --git a/WebWindowComplex/TableComp.razor.cs b/WebWindowComplex/TableComp.razor.cs index 16fbfb4..e5232b2 100644 --- a/WebWindowComplex/TableComp.razor.cs +++ b/WebWindowComplex/TableComp.razor.cs @@ -117,9 +117,6 @@ namespace WebWindowComplex { if (m_CurrWindow != null) { - //m_CurrWindow.OnPreview -= M_CurrWindow_OnPreview; - //m_CurrWindow.OnReqHwOption -= M_CurrWindow_OnHwOption; - //m_CurrWindow.OnReqShape -= M_CurrWindow_OnShape; m_CurrWindow = null; } } @@ -601,11 +598,11 @@ namespace WebWindowComplex new Joint(frame, 3, Joints.FULL_H), new Joint(frame, 4, Joints.FULL_H) }; - FrameArcElement ae = new FrameArcElement(frame, window, 10, true, true); + //FrameArcElement ae = new FrameArcElement(frame, window, 10, true, true); JsonWindow jsonWindow = new JsonWindow("Profilo78", "Pino", "Black", "Vetro BE 2S 4T/16/4T"); JsonFrame jsonFrame = new JsonFrame(Shapes.RECTANGLE, false, 0, 1); jsonWindow.AreaList.Add(jsonFrame); - jsonFrame.ArcElement = ae.Serialize(); + //jsonFrame.ArcElement = ae.Serialize(); foreach (var Dimension in DimensionList) jsonFrame.DimensionList.Add(Dimension.Serialize()); foreach (var Joint in JointList) @@ -684,8 +681,16 @@ namespace WebWindowComplex { for (int i = 0; i < 2; i++) m_CurrWindow.AreaList.First().DimensionList[i].dValue = m_PreviousWindow.AreaList.First().DimensionList[i].dValue; - for (int i = 0; i < 4; i++) - m_CurrWindow.AreaList.First().JointList[i].SetSelJointType(m_PreviousWindow.AreaList.First().JointList[i].SelJointType); + if(m_CurrWindow.AreaList.First().Shape == Shapes.TRIANGLE) + { + for (int i = 0; i < 2; i++) + m_CurrWindow.AreaList.First().JointList[i].SetSelJointType(m_PreviousWindow.AreaList.First().JointList[i].SelJointType); + } + else + { + for (int i = 0; i < 4; i++) + m_CurrWindow.AreaList.First().JointList[i].SetSelJointType(m_PreviousWindow.AreaList.First().JointList[i].SelJointType); + } } if (m_CurrWindow != null) { diff --git a/WebWindowComplex/WebWindowComplex.csproj b/WebWindowComplex/WebWindowComplex.csproj index 27b6fa2..fde8c42 100644 --- a/WebWindowComplex/WebWindowComplex.csproj +++ b/WebWindowComplex/WebWindowComplex.csproj @@ -6,7 +6,7 @@ net8.0 enable enable - 2.7.12.218 + 2.7.12.416 Annamaria Sassi Egalware Componente gestione Configurazioni avanzate Window per LUX @@ -193,6 +193,38 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/WebWindowConfigurator/WebWindowConfigurator.csproj b/WebWindowConfigurator/WebWindowConfigurator.csproj index ec2f12c..709fe2f 100644 --- a/WebWindowConfigurator/WebWindowConfigurator.csproj +++ b/WebWindowConfigurator/WebWindowConfigurator.csproj @@ -6,7 +6,7 @@ net8.0 enable enable - 2.7.12.218 + 2.7.12.416 Annamaria Sassi Egalware Componente gestione JWD per LUX @@ -289,6 +289,57 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/WebWindowConfigurator/Window.cs b/WebWindowConfigurator/Window.cs index 223bd9b..c35b778 100644 --- a/WebWindowConfigurator/Window.cs +++ b/WebWindowConfigurator/Window.cs @@ -1011,114 +1011,12 @@ namespace WebWindowConfigurator } } - //private Hardware m_SelHardware; - //public Hardware SelHardware - //{ - // get - // { - // return m_SelHardware; - // } - // 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"); - // } - // } - // } - //} - - //internal void SetSelHardware(Hardware value) - //{ - // m_SelHardware = value; - //} - - //internal void SetSelHardwareFromId(string sId) - //{ - // m_SelHardware = m_HardwareList.FirstOrDefault(x => x.sId == sId); - // if (IsNothing(m_SelHardware)) - // m_SelHardware = m_HardwareList(0); - //} - - //internal void SetFirstHardware() - //{ - // if (m_HardwareList.Count > 0) - // { - // m_SelHardware = m_HardwareList(0); - // } - //} - - private ObservableCollection m_HwdOptionList = new ObservableCollection(); - public ObservableCollection HwdOptionList + private ObservableCollection m_HwOptionList = new ObservableCollection(); + public ObservableCollection HwOptionList { get { - return m_HwdOptionList; + return m_HwOptionList; } } @@ -1248,7 +1146,7 @@ namespace WebWindowConfigurator internal void RefreshHardwareOptionList() { - m_HwdOptionList.Clear(); + m_HwOptionList.Clear(); } internal OpeningSides GetOpeningSide(Openings OpeningType) diff --git a/WebWindowTest/Models/Sash.cs b/WebWindowTest/Models/Sash.cs index aaa2f6e..2ecb53d 100644 --- a/WebWindowTest/Models/Sash.cs +++ b/WebWindowTest/Models/Sash.cs @@ -78,7 +78,7 @@ namespace WebWindowTest.Models { get { - return m_HwdOptionList; + return m_HwOptionList; } } @@ -86,7 +86,7 @@ namespace WebWindowTest.Models { get { - return m_SelHwdOptionList; + return m_SelHwOptionList; } } @@ -652,7 +652,7 @@ namespace WebWindowTest.Models internal void RefreshHardwareOptionList() { - m_HwdOptionList.Clear(); + m_HwOptionList.Clear(); //ReqRefreshHwOption(); } @@ -718,19 +718,19 @@ namespace WebWindowTest.Models HwOptions = (ParametriOpzioni)serializer.Deserialize(reader); if (HwOptions.Items != null) { - m_HwdOptionList.Clear(); + m_HwOptionList.Clear(); foreach (var HwOption in HwOptions.Items) { switch (HwOption.Tipo) { case "Text": { - m_HwdOptionList.Add(new AGBOptionText(HwOption)); + m_HwOptionList.Add(new AGBOptionText(HwOption)); break; } case "List": { - m_HwdOptionList.Add(new AGBOptionCombo(HwOption)); + m_HwOptionList.Add(new AGBOptionCombo(HwOption)); break; } } @@ -873,8 +873,8 @@ namespace WebWindowTest.Models private string m_CurrShape = ""; private List m_HardwareList = new List(); - private List m_HwdOptionList = new List(); - private Dictionary m_SelHwdOptionList = new Dictionary(); + private List m_HwOptionList = new List(); + private Dictionary m_SelHwOptionList = new Dictionary(); private List m_JointList = new List(); From b43071ceec977875a1fd8cf455effa13127ba04c Mon Sep 17 00:00:00 2001 From: Annamaria Sassi Date: Fri, 5 Dec 2025 15:36:35 +0100 Subject: [PATCH 18/18] - Aggiornato svuotamento dizionario shape e opzioni hw - Aggiornato calcolo altezza split --- Test.UI/Components/Pages/EditJWD.razor.cs | 9 +- WebWindowComplex/Compo/AreaSash.razor | 8 +- WebWindowComplex/Compo/CardFrame.razor.cs | 4 +- WebWindowComplex/Compo/CardSashGroup.razor | 4 +- WebWindowComplex/Compo/CardSashGroup.razor.cs | 15 +- WebWindowComplex/Compo/CardSplit.razor | 4 +- WebWindowComplex/Compo/CardSplit.razor.cs | 30 +- WebWindowComplex/LayoutConst.cs | 17 ++ WebWindowComplex/Models/Frame.cs | 2 +- WebWindowComplex/Models/Split.cs | 286 +++++++++--------- WebWindowComplex/Models/SplitDimension.cs | 48 +-- WebWindowComplex/TableComp.razor | 3 +- WebWindowComplex/TableComp.razor.cs | 30 +- WebWindowComplex/WebWindowComplex.csproj | 7 +- .../WebWindowConfigurator.csproj | 46 ++- 15 files changed, 283 insertions(+), 230 deletions(-) diff --git a/Test.UI/Components/Pages/EditJWD.razor.cs b/Test.UI/Components/Pages/EditJWD.razor.cs index 9995aad..bb5d928 100644 --- a/Test.UI/Components/Pages/EditJWD.razor.cs +++ b/Test.UI/Components/Pages/EditJWD.razor.cs @@ -9,6 +9,7 @@ using System.Diagnostics; using System.Security.AccessControl; using WebWindowComplex; using WebWindowComplex.DTO; +using static WebWindowComplex.LayoutConst; namespace Test.UI.Components.Pages { @@ -229,18 +230,18 @@ namespace Test.UI.Components.Pages /// Esecuzione azione richiesta /// /// Azione richiesta - private void DoAction(TableComp.DataAction actReq) + private void DoAction(DataAction actReq) { switch (actReq) { - case TableComp.DataAction.None: + case DataAction.None: break; - case TableComp.DataAction.ResetDictShape: + case DataAction.ResetDictShape: CurrData.DictShape = new Dictionary(); break; - case TableComp.DataAction.ResetHwOpt: + case DataAction.ResetHwOpt: CurrData.DictOptionsXml = new Dictionary(); break; diff --git a/WebWindowComplex/Compo/AreaSash.razor b/WebWindowComplex/Compo/AreaSash.razor index 5474ae7..47d99f5 100644 --- a/WebWindowComplex/Compo/AreaSash.razor +++ b/WebWindowComplex/Compo/AreaSash.razor @@ -1,7 +1,7 @@ @using EgwCoreLib.Razor @if(mode == ModeView.View) { -
    +
    Sash @(CurrSashGroup.SashList.Count == 1 ? "" : (IndexSash + 1))
    @if(CurrSashGroup.SashList.Count > 1) @@ -27,7 +27,7 @@
    } - +
    @@ -95,7 +95,7 @@ else
    -
    +