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 @@ + + + + + + + + + + + + +