From 036d50b29b8a01c906fe18267bb1a751e9a2a3e3 Mon Sep 17 00:00:00 2001 From: Annamaria Sassi Date: Wed, 10 Sep 2025 18:45:57 +0200 Subject: [PATCH] aggiunto hardware --- Test.UI/Components/Pages/Gerarchia.razor | 10 +- Test.UI/Components/Pages/Gerarchia.razor.cs | 42 +- Test.UI/Hardware/Setup.json | 47 ++ Test.UI/Test.UI.csproj | 4 + WebWindowComplex/TableComp.razor | 335 +++++++------ WebWindowComplex/TableComp.razor.cs | 56 ++- WebWindowComplex/Window.cs | 399 ++++++++-------- .../WebWindowConfigurator.csproj | 20 +- WebWindowConfigurator/WebWindowMaker.razor | 441 ++++++++++-------- WebWindowConfigurator/WebWindowMaker.razor.cs | 87 ++-- WebWindowConfigurator/Window.cs | 112 ++--- 11 files changed, 871 insertions(+), 682 deletions(-) create mode 100644 Test.UI/Hardware/Setup.json diff --git a/Test.UI/Components/Pages/Gerarchia.razor b/Test.UI/Components/Pages/Gerarchia.razor index 1e7901d..6c0c77f 100644 --- a/Test.UI/Components/Pages/Gerarchia.razor +++ b/Test.UI/Components/Pages/Gerarchia.razor @@ -5,10 +5,12 @@ Gerarchia + IN_SelTemplate="@SelTemplate" + IN_FamilyHardware="@FamilyHardware" + IN_HardwareList="@AvailHardwareList" + EC_OnUpdate="SaveJWD" + EC_OnSelectedTemplate="SetTemplate" + LiveSVG="@currSvg"> @*

diff --git a/Test.UI/Components/Pages/Gerarchia.razor.cs b/Test.UI/Components/Pages/Gerarchia.razor.cs index d170762..ca282c5 100644 --- a/Test.UI/Components/Pages/Gerarchia.razor.cs +++ b/Test.UI/Components/Pages/Gerarchia.razor.cs @@ -4,6 +4,7 @@ using EgwCoreLib.Lux.Data.Services; using Microsoft.AspNetCore.Components; using Newtonsoft.Json; using NLog; +using System.Diagnostics; using WebWindowComplex; using WebWindowComplex.DTO; @@ -13,7 +14,7 @@ namespace Test.UI.Components.Pages { #region Public Properties - public Template SelTemplate { get; set; } = new Template(0, "---SELECT---", "", ""); + public Template SelTemplate { get; set; } = new Template(0, "---SELECT---", "", ""); #endregion Public Properties @@ -27,7 +28,7 @@ namespace Test.UI.Components.Pages #endregion Public Methods #region Protected Fields - + protected string currJwd = "..."; protected Dictionary m_CurrArgs = new Dictionary(); @@ -36,6 +37,9 @@ namespace Test.UI.Components.Pages #region Protected Properties protected List AvailTemplateList { get; set; } = new List(); + protected List AvailHardwareList { get; set; } = new List(); + + protected string FamilyHardware { get; set; } = "Natura"; [Inject] protected IConfiguration Config { get; set; } = null!; @@ -69,7 +73,8 @@ namespace Test.UI.Components.Pages private string apiUrl = ""; private string calcTag = ""; private string CalcUid = "CurrWindow"; - private string cFile = "Data/Setup.json"; + private string cFileTemplate = "Data/Setup.json"; + private string cFileHardware = "Hardware/Setup.json"; private TemplateSelectDTO? currSel = null; private string currSvg = ""; @@ -78,24 +83,9 @@ namespace Test.UI.Components.Pages private string subChannel = ""; - #endregion Private Fields - - #region Private Properties - private string windowUid = "CurrWindow"; - //{ - // get - // { - // string answ = ""; - // if (currSel != null) - // { - // answ = currSel.SVGFileName.Replace(".svg", ""); - // } - // return answ; - // } - //} - #endregion Private Properties + #endregion Private Fields #region Private Methods @@ -132,11 +122,12 @@ namespace Test.UI.Components.Pages { //return base.OnInitializedAsync(); AvailTemplateList = new List(); + AvailHardwareList = new List(); await Task.Delay(100); // brutale, da rivedere... - if (File.Exists(cFile)) + if (File.Exists(cFileTemplate)) { - string rawVal = File.ReadAllText(cFile); + string rawVal = File.ReadAllText(cFileTemplate); var rawList = JsonConvert.DeserializeObject>(rawVal) ?? new List(); // calcolo URL immagini... DTO interno da rivedere? @@ -146,6 +137,15 @@ namespace Test.UI.Components.Pages AvailTemplateList.Add(item); } } + if (File.Exists(cFileHardware)) + { + string rawValHW = File.ReadAllText(cFileHardware); + var rawListHW = JsonConvert.DeserializeObject>(rawValHW) ?? new List(); + foreach (var item in rawListHW) + { + AvailHardwareList.Add(item); + } + } } private async Task SaveJWD(Dictionary CurrArgs) diff --git a/Test.UI/Hardware/Setup.json b/Test.UI/Hardware/Setup.json new file mode 100644 index 0000000..476545f --- /dev/null +++ b/Test.UI/Hardware/Setup.json @@ -0,0 +1,47 @@ +[ + { + "sId": "000100", + "sFamily": "Natura", + "sName": "Natura_ANTA_RIBALTA_RECTANGLE_1SASH_2T_12_2T", + "sOpeningType": "ANTA_RIBALTA", + "sShape": "RECTANGLE", + "nSashQty": "1", + "nSashPosition": "1" + }, + { + "sId": "000101", + "sFamily": "Natura", + "sName": "Natura_ANTA_RIBALTA_RECTANGLE_1SASH_3T_12_3T", + "sOpeningType": "ANTA_RIBALTA", + "sShape": "RECTANGLE", + "nSashQty": "1", + "nSashPosition": "1" + }, + { + "sId": "000102", + "sFamily": "Natura", + "sName": "Natura_ANTA_RIBALTA_RECTANGLE_2SASH_3T_12_3T", + "sOpeningType": "ANTA_RIBALTA", + "sShape": "RECTANGLE", + "nSashQty": "2", + "nSashPosition": "1" + }, + { + "sId": "000103", + "sFamily": "Optima", + "sName": "Optima_ANTA_RIBALTA_RECTANGLE_1SASH_3T_12_3T", + "sOpeningType": "ANTA_RIBALTA", + "sShape": "RECTANGLE", + "nSashQty": "1", + "nSashPosition": "1" + }, + { + "sId": "000104", + "sFamily": "Optima", + "sName": "Optima_ANTA_RIBALTA_RECTANGLE_2SASH_3T_12_3T", + "sOpeningType": "ANTA_RIBALTA", + "sShape": "RECTANGLE", + "nSashQty": "2", + "nSashPosition": "1" + } +] \ No newline at end of file diff --git a/Test.UI/Test.UI.csproj b/Test.UI/Test.UI.csproj index ab68a8a..96e6f06 100644 --- a/Test.UI/Test.UI.csproj +++ b/Test.UI/Test.UI.csproj @@ -8,11 +8,15 @@ + + + Always + Always diff --git a/WebWindowComplex/TableComp.razor b/WebWindowComplex/TableComp.razor index b9310fd..5d76915 100644 --- a/WebWindowComplex/TableComp.razor +++ b/WebWindowComplex/TableComp.razor @@ -219,7 +219,7 @@

Frame
- +
@@ -257,7 +257,7 @@
- @if (currSplit.ParentArea is Splitted || currSplit.ParentArea is Sash) + @if ((currSplit.ParentArea is Splitted || currSplit.ParentArea is Sash) && SashList.Count > 0) { @for (int j = 0; j < SashList.Count; j++) { @@ -286,9 +286,12 @@
Split
-
- -
+ @if (currSplit.nSplitQty == 1) + { +
+ +
+ }
Number @@ -348,8 +351,22 @@
Area split
-
- +
+
+
+ +
+
+ @for (int j = 0; j < SashList.Count; j++) + { + int Index = j; +
+
+ +
+
+ } +
@@ -488,163 +505,108 @@ } else if (currStep == CompileStep.Sash) { - @if (currSash > SashList.Count) + @if (currSash >= SashList.Count || currSash == -1) { currStep = CompileStep.Gerarchia; } - Sash item = SashList[currSash]; -
-
-
-
-
- Number - -
-
-
-
-
-
-
-
Orientation
-
- - -
+ else + { + Sash item = SashList[currSash]; +
+
+
+
+
+ Number +
-
-
-
-
Bottom rail
-
- Quantity - -
-
-
-
-
-
- @for (int i = 0; i <= item.SashList.Count / 2; i++) - { - for (int j = 0; j < 2 && (i * 2 + j <= item.SashList.Count - 1); j++) - { - SashDimension sash = item.SashList[i * 2 + j]; -
-
-
- @if (item.SashList.Count == 1) - { -
Opening
- } - else - { -
Sash opening @(i * 2 + j + 1)
- } -
- - -
-
- Dimension - - % -
-
-
- -
-
- -
-
-
- @for (int k = 1; k <= i*2+j; k++) - { - int IndexCopy = k; - int IndexModify = i * 2 + j; -
-
- -
-
- } -
-
-
-
- } - } -
-
-
-
-
-
Sash joints
-
-
- -
-
- -
-
- -
-
- @foreach (Joint joint in item.JointList) - { +
+
+
+
+
Orientation
- - + +
- } +
+
+
+
+
+
+
Bottom rail
+
+ Quantity + +
+
-
- @for (int i = 0; i < item.AreaList.Count; i++) +
+ @for (int i = 0; i <= item.SashList.Count / 2; i++) { - Area anta; - @if (item.AreaList[i] is Splitted) + for (int j = 0; j < 2 && (i * 2 + j <= item.SashList.Count - 1); j++) { - anta = item.AreaList[i]; - } - else - { - anta = item; - } - @if (!(anta.AreaList[0] is Split)) - { -
+ SashDimension sash = item.SashList[i * 2 + j]; +
-
Anta @(i + 1)
+ @if (item.SashList.Count == 1) + { +
Opening
+ } + else + { +
Sash opening @(i * 2 + j + 1)
+ }
- + + +
+
+ Dimension + + % +
+
+
+ +
+
+ +
+
+
+ @for (int k = 1; k <= i * 2 + j; k++) + { + int IndexCopy = k; + int IndexModify = i * 2 + j; +
+
+ +
+
+ }
@@ -652,10 +614,85 @@ } }
+
+
+
+
+
Sash joints
+
+
+ +
+
+ +
+
+ +
+
+ @foreach (Joint joint in item.JointList) + { +
+ + +
+ } +
+
+
+
+ @for (int i = 0; i < item.AreaList.Count; i++) + { + Area anta; + @if (item.AreaList[i] is Splitted) + { + anta = item.AreaList[i]; + } + else + { + anta = item; + } + @if (!(anta.AreaList[0] is Split)) + { +
+
+
+
Anta @(i + 1)
+
+ +
+
+
+
+ } + } +
+
+
+
+
+
+
Hardware
+
+ + +
+
+
+
+
-
-
+ } } else if (currStep == CompileStep.Fill) { diff --git a/WebWindowComplex/TableComp.razor.cs b/WebWindowComplex/TableComp.razor.cs index db781f6..7cf52e0 100644 --- a/WebWindowComplex/TableComp.razor.cs +++ b/WebWindowComplex/TableComp.razor.cs @@ -65,6 +65,10 @@ namespace WebWindowComplex m_ItemTableList = new List(); CreateWindowsList(m_CurrWindow.AreaList[0], false); CreateElementTable(m_CurrWindow.AreaList[0], 1, 1, 1, 1); + foreach (var item in SashList) + { + item.RefreshHardwareList(IN_HardwareList, IN_FamilyHardware); + } } } } @@ -72,6 +76,12 @@ namespace WebWindowComplex [Parameter] public List IN_TemplateDTOList { get; set; } = null!; + [Parameter] + public string IN_FamilyHardware { get; set; } = null; + + [Parameter] + public List IN_HardwareList { get; set; } = null; + [Parameter] public string LiveSVG { @@ -117,6 +127,14 @@ namespace WebWindowComplex Nero } + protected enum positionJoints + { + BL = 0, // Bottom Left + BR = 1, // Bottom Right + TR, // Top Right + TL // Top Left + } + #endregion Protected Enums #region Protected Properties @@ -243,7 +261,7 @@ namespace WebWindowComplex // popolo le liste Fill, Sash e Split CreateWindowsList(m_CurrWindow.AreaList[0], false); CreateElementTable(m_CurrWindow.AreaList[0], 1, 1, 1, 1); - //currSash = -1; + currSash = -1; await DoPreviewSvg(); } @@ -565,14 +583,35 @@ namespace WebWindowComplex await DoPreviewSvg(); } - private void CopyContent(Sash sashItem, int IndexCopy, int IndexModify) + /// + /// Metodo per copiare contenuto di un'anta in un'altra anta + /// + /// Sash dove si torva anta + /// Indice dell'anta che si copia + /// Indice dell'anta che si modifica + private async Task CopyContent(Sash sashItem, int IndexCopy, int IndexModify) { + // Anta selezionata + Area sashSplitted = sashItem.AreaList[IndexModify]; // Rimuovo riempimento da anta selezionata - sashItem.AreaList[IndexModify].AreaList.RemoveAt(0); + sashSplitted.AreaList.RemoveAt(0); // Creo la copia dell'anta scelta - Area a = sashItem.AreaList[IndexCopy-1].AreaList[0].Copy(); + Area a = sashItem.AreaList[IndexCopy-1].AreaList[0].Copy(sashSplitted); // Aggiungo copia all'anta selezionata sashItem.AreaList[IndexModify].AreaList.Add(a); + await DoPreviewSvg(); + } + + private async Task CopySplitted(Splitted currSplitted, int numSash) + { + //Rimuovo contenuto di Splitted + currSplitted.AreaList.RemoveAll(i => i != null); + // Copio sash + Area a = SashList[numSash].Copy(currSplitted); + a.SetParentArea(currSplitted); + // Aggiungo copia a Splitted + currSplitted.AreaList.Add(a); + await DoPreviewSvg(); } private async Task SwapTwoAree(Area currArea) @@ -581,7 +620,6 @@ namespace WebWindowComplex await DoPreviewSvg(); } - #endregion Protected Methods #region Private Fields @@ -609,14 +647,6 @@ namespace WebWindowComplex private int m_maxCol = 0; private int m_maxRow = 0; - private enum positionJoints - { - BL = 0, // Bottom Left - BR = 1, // Bottom Right - TR, // Top Right - TL // Top Left - } - #endregion Private Fields #region Private Properties diff --git a/WebWindowComplex/Window.cs b/WebWindowComplex/Window.cs index fa52611..9331d5c 100644 --- a/WebWindowComplex/Window.cs +++ b/WebWindowComplex/Window.cs @@ -155,7 +155,7 @@ namespace WebWindowComplex internal abstract JsonArea Serialize(); - public void AddSplit() + public void AddSplit(Area ParentArea) { List ContentArea = new List(); // Salvo gli oggetti già presenti e li cancello da AreaList @@ -171,17 +171,19 @@ namespace WebWindowComplex List newSplittedList = new List(); for (int i = 0; i < 2; i++) newSplittedList.Add(Splitted.CreateSplitted(SplitArea)); - // Inserisco nelle aree Splitted il Fill salvato e un Fill uguale (e setto ParentArea) + // Inserisco nelle aree Splitted il Fill salvato e un Fill uguale (e setto ParentArea del fill) + ContentArea[0].SetParentArea(newSplittedList[0]); newSplittedList[0].AreaList.Add(ContentArea[0]); - newSplittedList[0].AreaList[0].SetParentArea(newSplittedList[0]); if (ContentArea[0] is Fill) { - Fill fill2 = (Fill)ContentArea[0]; - newSplittedList[1].AreaList.Add(Fill.CreateFill(newSplittedList[1], fill2.FillType)); + Fill fill1 = (Fill)ContentArea[0]; + Fill fill2 = Fill.CreateFill(newSplittedList[1], fill1.FillType); + newSplittedList[1].AreaList.Add(fill2); } else { - newSplittedList[1].AreaList.Add(Fill.CreateFill(newSplittedList[1], FillTypes.GLASS)); + Fill fill2 = Fill.CreateFill(newSplittedList[1], FillTypes.GLASS); + newSplittedList[1].AreaList.Add(fill2); } // All'area Split aggiunto le due aree Splitted for (int i = 0; i < 2; i++) @@ -233,7 +235,7 @@ namespace WebWindowComplex } } - public abstract Area Copy(); + public abstract Area Copy(Area ParentArea); } public class Frame : Area @@ -636,7 +638,7 @@ namespace WebWindowComplex } } - public override Frame Copy() + public override Frame Copy(Area ParentArea) { return null; } @@ -700,9 +702,7 @@ namespace WebWindowComplex } else { - // Se tolgo singola anta, ma tengo split SashList.RemoveAt(0); - } } if(m_SashList.Count == 0) @@ -1063,107 +1063,107 @@ namespace WebWindowComplex } } - //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; - // } + 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"); - // } - // } - // } - //} + // 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 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 SetSelHardwareFromId(string sId) + { + m_SelHardware = m_HardwareList.FirstOrDefault(x => x.sId == sId); + if (m_SelHardware != null) + m_SelHardware = m_HardwareList[0]; + } - //internal void SetFirstHardware() - //{ - // if (m_HardwareList.Count > 0) - // { - // 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 @@ -1197,6 +1197,11 @@ namespace WebWindowComplex //NewSash.SetFirstHardware(); return NewSash; } + private string FindSashShape() + { + // Return "R" + return "RECTANGLE"; + } internal OpeningTypes GetOpeningType(Openings OpeningType) { @@ -1251,109 +1256,120 @@ namespace WebWindowComplex private string ConvertOpeningType() { - if (m_SashList.Any(x => GetOpeningType(x.OpeningType) == OpeningTypes.TILTTURN)) - return "AR"; + if(m_SashList.Count > 1) + { + if (GetOpeningType(m_SashList[0].OpeningType) == OpeningTypes.TURNONLY) + return "ANTA_BANDIERA"; + else + return "ANTA_RIBALTA"; + } else + { switch (GetOpeningType(m_SashList[0].OpeningType)) { + case OpeningTypes.TILTTURN: + { + return "ANTA_RIBALTA"; + } case OpeningTypes.TURNONLY: { - return "AB"; + return "ANTA_BANDIERA"; } - case OpeningTypes.TILTONLY: { - return "VA"; + return "VASISTAS"; } - case OpeningTypes.PIVOT: { - return "BI"; + return "PIVOT"; } case OpeningTypes.COMPLANARSLIDE: { - return "CO"; + return "COMPLANARE"; } case OpeningTypes.LIFTSLIDE: { - return "AS"; + return "ALZANTE_SCORREVOLE"; } - default: { return ""; } } + } } - //internal void RefreshHardwareList() - //{ - // m_HardwareList.Clear(); - // string sSashShape = FindSashShape(); - // string sOpeningType = ConvertOpeningType(); - // m_HardwareList = new ObservableCollection(from Hardware in Map.refManageWindowVM.HardwareList - // where Hardware.sId == "000000" || (Hardware.nSashQty == nSashQty && Hardware.sShape == sSashShape && Hardware.sOpeningType == sOpeningType) - // select Hardware); - //} + public void RefreshHardwareList(List HardwareCompleteList, string nameFamily) + { + m_HardwareList.Clear(); + string sSashShape = FindSashShape(); + string sOpeningType = ConvertOpeningType(); + m_HardwareList = new ObservableCollection(from Hardware in HardwareCompleteList + where Hardware.sId == "000000" || (Hardware.sFamily == nameFamily && Hardware.nSashQty == nSashQty && Hardware.sShape == sSashShape && Hardware.sOpeningType == sOpeningType) + select Hardware); + } internal void RefreshHardwareOptionList() { m_HwdOptionList.Clear(); } - internal OpeningSides GetOpeningSide(Openings OpeningType) + //internal OpeningSides GetOpeningSide(Openings OpeningType) + //{ + // switch (OpeningType) + // { + // case Openings.TURNONLY_LEFT: + // case Openings.TILTTURN_LEFT: + // case Openings.TILTONLY_TOP: + // case Openings.COMPLANARSLIDE_LEFT: + // case Openings.LIFTSLIDE_LEFT: + // { + // return OpeningSides.LEFT; + // } + + // case Openings.TURNONLY_RIGHT: + // case Openings.TILTTURN_RIGHT: + // case Openings.TILTONLY_BOTTOM: + // case Openings.COMPLANARSLIDE_RIGHT: + // case Openings.LIFTSLIDE_RIGHT: + // { + // return OpeningSides.RIGHT; + // } + + // default: + // { + // return OpeningSides.NULL; + // } + // } + //} + + public override Sash Copy(Area newParentArea) { - switch (OpeningType) - { - case Openings.TURNONLY_LEFT: - case Openings.TILTTURN_LEFT: - case Openings.TILTONLY_TOP: - case Openings.COMPLANARSLIDE_LEFT: - case Openings.LIFTSLIDE_LEFT: - { - return OpeningSides.LEFT; - } - - case Openings.TURNONLY_RIGHT: - case Openings.TILTTURN_RIGHT: - case Openings.TILTONLY_BOTTOM: - case Openings.COMPLANARSLIDE_RIGHT: - case Openings.LIFTSLIDE_RIGHT: - { - return OpeningSides.RIGHT; - } - - default: - { - return OpeningSides.NULL; - } - } - } - - public override Sash Copy() - { - Sash newSash = new Sash(ParentArea, m_ParentWindow); + Sash newSash = new Sash(newParentArea, m_ParentWindow); newSash.SetAreaType(AreaType); + // Imposta la quantità di ante e definisce SashDimension di ogni anta ai valori di default newSash.SetSashQty(nSashQty); newSash.SetIsSashVertical(bIsSashVertical); newSash.SetOrientationSashType(OrientationSashType); newSash.SetSashBottomRailQty(SashBottomRailQty); - foreach (var item in SashList) + for (int i = 0; i 2) + if (AreaList.Count > 2) { for (var SplitIndex = SplitPositionList.Count; SplitIndex <= AreaList.Count - 1; SplitIndex++) { @@ -1439,6 +1453,7 @@ namespace WebWindowComplex else { Splitted s = (Splitted)AreaList[0]; + s.SetParentArea(ParentArea); ParentArea.AreaList.Add(s.AreaList[0]); ParentArea.AreaList.Remove(this); } @@ -1559,15 +1574,15 @@ namespace WebWindowComplex return Split; } - public override Split Copy() + public override Split Copy(Area newParentArea) { - Split newSplit = new Split(ParentArea, ParentWindow); + Split newSplit = new Split(newParentArea, ParentWindow); newSplit.SetSplitQty(nSplitQty); newSplit.SetSplitShape(SelSplitShape, true); newSplit.SetAreaType(AreaType); foreach(var item in AreaList) { - Area a = item.Copy(); + Area a = item.Copy(newSplit); newSplit.AreaList.Add(a); } return newSplit; @@ -1591,20 +1606,20 @@ namespace WebWindowComplex { } - internal static Splitted CreateSplitted(Area Area) + internal static Splitted CreateSplitted(Area ParentArea) { - Splitted Splitted = new Splitted(Area, Area.ParentWindow); + Splitted Splitted = new Splitted(ParentArea, ParentArea.ParentWindow); Splitted.SetAreaType(AreaTypes.SPLITTED); return Splitted; } - public override Splitted Copy() + public override Splitted Copy(Area newParentArea) { - Splitted newSplitted = new Splitted(ParentArea, ParentWindow); + Splitted newSplitted = new Splitted(newParentArea, ParentWindow); newSplitted.SetAreaType(AreaType); foreach (var item in AreaList) { - Area a = item.Copy(); + Area a = item.Copy(newSplitted); newSplitted.AreaList.Add(a); } return newSplitted; @@ -1674,17 +1689,17 @@ namespace WebWindowComplex { } - internal static Fill CreateFill(Area Area, FillTypes FillType) + internal static Fill CreateFill(Area AreaParent, FillTypes FillType) { - Fill Fill = new Fill(Area, Area.ParentWindow); + Fill Fill = new Fill(AreaParent, AreaParent.ParentWindow); Fill.SetAreaType(AreaTypes.FILL); Fill.SetFillType(FillType); return Fill; } - public override Fill Copy() + public override Fill Copy(Area newParentArea) { - Fill newFill = new Fill(ParentArea, m_ParentWindow); + Fill newFill = new Fill(newParentArea, m_ParentWindow); newFill.SetFillType(SelFillType); newFill.SetAreaType(AreaType); return newFill; @@ -1835,6 +1850,15 @@ namespace WebWindowComplex } } + private string m_sFamily; + public string sFamily + { + get + { + return m_sFamily; + } + } + private string m_sName; public string sName { @@ -1880,9 +1904,10 @@ namespace WebWindowComplex } } - public Hardware(string sId, string sName, string sOpeningType, string sShape, int nSashQty, int nSashPosition) + public Hardware(string sId, string sFamily, string sName, string sOpeningType, string sShape, int nSashQty, int nSashPosition) { m_sId = sId; + m_sFamily = sFamily; m_sName = sName; m_sOpeningType = sOpeningType; m_sShape = sShape; @@ -2123,7 +2148,7 @@ namespace WebWindowComplex { m_SelOpeningType = value; //m_Parent.RefreshHardwareList(); - m_Parent.RefreshHardwareOptionList(); + //m_Parent.RefreshHardwareOptionList(); //m_Parent.SetFirstHardware(); } } diff --git a/WebWindowConfigurator/WebWindowConfigurator.csproj b/WebWindowConfigurator/WebWindowConfigurator.csproj index e2ac932..2323f24 100644 --- a/WebWindowConfigurator/WebWindowConfigurator.csproj +++ b/WebWindowConfigurator/WebWindowConfigurator.csproj @@ -4,7 +4,7 @@ net8.0 enable enable - 2.7.9.913 + 2.7.9.1018 Annamaria Sassi Egalware Componente gestione JWD per LUX @@ -244,6 +244,24 @@ + + + + + + + + + + + + + + + + + + diff --git a/WebWindowConfigurator/WebWindowMaker.razor b/WebWindowConfigurator/WebWindowMaker.razor index 1d47688..c93c263 100644 --- a/WebWindowConfigurator/WebWindowMaker.razor +++ b/WebWindowConfigurator/WebWindowMaker.razor @@ -3,7 +3,7 @@
-
+
- - @if(currStep != CompileStep.Template) + @if (currStep != CompileStep.Template) { - +
+ +
} - +
+ +
+
+ +
@@ -164,96 +170,109 @@ } else if (currStep == CompileStep.Split) { - int numSash = 1; - int numSplit = 1; + int numSplit = 0;
- @for(int i = 0; i < SplitParentList.Count; i++) + @for (int i = 0; i < SplitList.Count; i++) { - @for (int j = 0; j < 2 && (i * 2 + j <= SplitParentList.Count - 1); j++) - { - SplitParent currSplitParent = m_SplitParentList[i * 2 + j]; - @if (currSplitParent.Split != null) - { - Split currSplit = (Split)currSplitParent.Split; -
-
-
- @if(currSplitParent.Description.Contains("Sash")) + Split currSplit = SplitList[i]; +
+
+
+ @if ((currSplit.ParentArea is Splitted || currSplit.ParentArea is Sash) && SashList.Count > 0) + { + @for (int j = 0; j < SashList.Count; j++) + { + @if (SashList[j].Equals(currSplit.ParentArea)) { -
@("Area " + currSplitParent.Description + " " + numSash )
- numSash++; +
@("Sash " + (j + 1))
} - else if(currSplitParent.Description.Contains("Split")) + else if (SashList[j].Equals(currSplit.ParentArea.ParentArea)) + { + @for (int k = 0; k < SashList[j].AreaList.Count; k++) + { + @if (SashList[j].AreaList[k].AreaList[0].Equals(currSplit)) + { +
@("Sash " + (j + 1) + " - anta " + (k + 1))
+ } + } + } + } + } + else if (currSplit.ParentArea is Splitted) + { + for(int j = 0; j < SplittedList.Count; j++) + { + if (SplittedList[j].Equals(currSplit.ParentArea)) { -
@("Area " + currSplitParent.Description + " " + numSplit)
numSplit++; +
@("Area di split " + numSplit)
} - else - { -
@("Area " + currSplitParent.Description)
- } -
-
-
-
Split
-
- -
-
- Number - -
-
- - -
- @foreach (var dim in currSplit.SplitPositionList) - { - string desc = ""; - @if (currSplit.SelSplitShape == Json.WindowConst.SplitShapes.VERTICAL) - { - @if (currSplit.SplitPositionList.IndexOf(dim) == 0) - { - desc = "Larg. area sx split"; - } - else - { - desc = "Larg. area dx split"; - } - } - else - { - @if (currSplit.SplitPositionList.IndexOf(dim) == 0) - { - desc = "Altez. area sotto split"; - } - else - { - desc = "Altez. area sopra split"; - } - } -
- @desc - - % -
- } -
+ } + } + else + { +
@("Frame")
+ } +
+
+
+
Split
+
+
+
+ Number + +
+
+ + +
+ @foreach (var dim in currSplit.SplitPositionList) + { + string desc = ""; + @if (currSplit.SelSplitShape == Json.WindowConst.SplitShapes.VERTICAL) + { + @if (currSplit.SplitPositionList.IndexOf(dim) == 0) + { + desc = "Larg. area sx split"; + } + else + { + desc = "Larg. area dx split"; + } + } + else + { + @if (currSplit.SplitPositionList.IndexOf(dim) == 0) + { + desc = "Altez. area sotto split"; + } + else + { + desc = "Altez. area sopra split"; + } + } +
+ @desc + + % +
+ }
- } - } +
+
}
@@ -262,98 +281,165 @@ } else if (currStep == CompileStep.Sash) { - @if (currSash > SashList.Count) + @if (currSash >= SashList.Count || currSash == -1) { currStep = CompileStep.Frame; } - Sash item = SashList[currSash]; -
-
-
-
-
-
-
+ else + { + Sash item = SashList[currSash]; +
+
+
+
+
+ Number + +
+
+
+
+
+
+
+
Orientation
- Number - + +
-
-
-
-
-
Orientation
+
+
+
+
Bottom rail
+
+ Quantity + +
+
+
+
+
+
+ @for (int i = 0; i <= item.SashList.Count / 2; i++) + { + for (int j = 0; j < 2 && (i * 2 + j <= item.SashList.Count - 1); j++) + { + SashDimension sash = item.SashList[i * 2 + j]; +
+
+
+ @if (item.SashList.Count == 1) + { +
Opening
+ } + else + { +
Sash opening @(i * 2 + j + 1)
+ } +
+ + +
+
+ Dimension + + % +
+
+
+ +
+
+ +
+
+ @*
+ @for (int k = 1; k <= i * 2 + j; k++) + { + int IndexCopy = k; + int IndexModify = i * 2 + j; +
+
+ +
+
+ } +
*@ +
+
+
+ } + } +
+
+
+
+
+
Sash joints
+
+
+ +
+
+ +
+
+ +
+
+ @foreach (Joint joint in item.JointList) + {
- - + + +
-
-
-
-
-
-
-
Bottom rail
-
- Quantity - -
-
+ }
-
- @for(int i = 0; i <= item.SashList.Count / 2; i ++) +
+ @for (int i = 0; i < item.AreaList.Count; i++) { - for (int j = 0; j < 2 && (i * 2 + j <= item.SashList.Count - 1); j ++) + Area anta; + @if (item.AreaList[i] is Splitted) { - SashDimension sash = item.SashList[i*2+j]; -
+ anta = item.AreaList[i]; + } + else + { + anta = item; + } + @if (!(anta.AreaList[0] is Split)) + { +
- @if (item.SashList.Count == 1) - { -
Opening
- } - else - { -
Sash opening @(i * 2 + j + 1)
- } +
Anta @(i + 1)
- - -
-
- Dimension - - % -
-
-
- -
-
- -
+
@@ -361,41 +447,11 @@ } }
-
-
-
-
-
Sash joints
-
-
- -
-
- -
-
- -
-
- @foreach (Joint joint in item.JointList) - { -
- - -
- } -
-
-
-
+
-
+ } } else if (currStep == CompileStep.Fill) { @@ -544,7 +600,6 @@

- @* *@
diff --git a/WebWindowConfigurator/WebWindowMaker.razor.cs b/WebWindowConfigurator/WebWindowMaker.razor.cs index 67d583f..fa301f1 100644 --- a/WebWindowConfigurator/WebWindowMaker.razor.cs +++ b/WebWindowConfigurator/WebWindowMaker.razor.cs @@ -57,8 +57,8 @@ namespace WebWindowConfigurator m_FillList = new List(); m_SashList = new List(); m_SplitList = new List(); - m_SplitParentList = new List(); - CreateWindowsList(m_CurrWindow.AreaList[0], false); + m_SplittedList = new List(); + CreateWindowsList(m_CurrWindow.AreaList[0]); } } } @@ -147,9 +147,9 @@ namespace WebWindowConfigurator { get => m_FillList; } - protected List SplitParentList + protected List SplittedList { - get => m_SplitParentList; + get => m_SplittedList; } protected TemplateSelectDTO? SelTemplateDTO { get; set; } = null; @@ -220,9 +220,10 @@ namespace WebWindowConfigurator m_FillList = new List(); m_SashList = new List(); m_SplitList = new List(); - m_SplitParentList = new List(); + m_SplittedList = new List(); // popolo le liste Fill, Sash e Split - CreateWindowsList(m_CurrWindow.AreaList[0], false); + CreateWindowsList(m_CurrWindow.AreaList[0]); + currSash = -1; await DoPreviewSvg(); } @@ -258,32 +259,31 @@ namespace WebWindowConfigurator await DoPreviewSvg(); } - /// - /// Metodo per identificare oggetti nella Window e popolare le liste Fill, Sash e Split, SplitParent - /// - /// - //protected void CreateWindowsList(Area node) + //protected void CreateWindowsList(Area node, bool IntoSash) //{ // if (node != null) // { + // bool nodeIntoSash = false; + // if (node.ParentArea is Sash || IntoSash == true) + // nodeIntoSash = true; // switch (node.AreaType) // { // case AreaTypes.FRAME: // { // FrameWindow = (Frame)node; // if (node.AreaList[0] is Split) - // SplitParentList.Add(new SplitParent(AreaTypes.FRAME, "Frame", false, node.AreaList[0], null)); + // SplitParentList.Add(new SplitParent(AreaTypes.FRAME, "Frame", nodeIntoSash, node.AreaList[0], null)); // else - // SplitParentList.Add(new SplitParent(AreaTypes.FRAME, "Frame", false, null, node)); + // SplitParentList.Add(new SplitParent(AreaTypes.FRAME, "Frame", nodeIntoSash, null, node)); // break; // } // case AreaTypes.SASH: // { // m_SashList.Add((Sash)node); // if (node.AreaList[0] is Fill) - // SplitParentList.Add(new SplitParent(AreaTypes.SPLITTED, "Sash", true, null, node)); - // else if(node.AreaList[0] is Split) - // SplitParentList.Add(new SplitParent(AreaTypes.SPLITTED, "Sash into split", true, node.AreaList[0], node)); + // SplitParentList.Add(new SplitParent(AreaTypes.SPLITTED, "Sash", nodeIntoSash, null, node)); + // else if (node.AreaList[0] is Split) + // SplitParentList.Add(new SplitParent(AreaTypes.SPLITTED, "Sash into split", nodeIntoSash, node.AreaList[0], node)); // break; // } // case AreaTypes.FILL: @@ -298,61 +298,51 @@ namespace WebWindowConfigurator // } // case AreaTypes.SPLITTED: // { + // m_SplittedList.Add((Splitted)node); // if (node.AreaList[0] is Split) // { // if (node.ParentArea is Sash) - // SplitParentList.Add(new SplitParent(AreaTypes.SPLITTED, "Sash", true, node.AreaList[0], node)); + // SplitParentList.Add(new SplitParent(AreaTypes.SPLITTED, "Sash", nodeIntoSash, node.AreaList[0], node)); // else - // SplitParentList.Add(new SplitParent(AreaTypes.SPLITTED, "Split", false, node.AreaList[0], node)); + // SplitParentList.Add(new SplitParent(AreaTypes.SPLITTED, "Split", nodeIntoSash, node.AreaList[0], node)); // } // else if (node.AreaList[0] is Sash) // { - // SplitParentList.Add(new SplitParent(AreaTypes.SPLITTED, "Split area with sash", false, null, node)); + // SplitParentList.Add(new SplitParent(AreaTypes.SPLITTED, "Split area with sash", nodeIntoSash, null, node)); // } // else // { // if (node.ParentArea is Sash) - // SplitParentList.Add(new SplitParent(AreaTypes.SPLITTED, "Sash", true, null, node)); - // else if (node.ParentArea.ParentArea is Sash) - // SplitParentList.Add(new SplitParent(AreaTypes.SPLITTED, "Split into sash", true, null, node)); + // SplitParentList.Add(new SplitParent(AreaTypes.SPLITTED, "Sash", nodeIntoSash, null, node)); + // else if (nodeIntoSash) + // SplitParentList.Add(new SplitParent(AreaTypes.SPLITTED, "Area split into sash", nodeIntoSash, null, node)); // else - // SplitParentList.Add(new SplitParent(AreaTypes.SPLITTED, "Split", false, null, node)); + // SplitParentList.Add(new SplitParent(AreaTypes.SPLITTED, "Split", nodeIntoSash, null, node)); // } // break; // } // } // foreach (var item in node.AreaList) // { - // CreateWindowsList(item); + // CreateWindowsList(item, nodeIntoSash); // } // } //} - protected void CreateWindowsList(Area node, bool IntoSash) + protected void CreateWindowsList(Area node) { if (node != null) { - bool nodeIntoSash = false; - if (node.ParentArea is Sash || IntoSash == true) - nodeIntoSash = true; switch (node.AreaType) { case AreaTypes.FRAME: { FrameWindow = (Frame)node; - if (node.AreaList[0] is Split) - SplitParentList.Add(new SplitParent(AreaTypes.FRAME, "Frame", nodeIntoSash, node.AreaList[0], null)); - else - SplitParentList.Add(new SplitParent(AreaTypes.FRAME, "Frame", nodeIntoSash, null, node)); break; } case AreaTypes.SASH: { m_SashList.Add((Sash)node); - if (node.AreaList[0] is Fill) - SplitParentList.Add(new SplitParent(AreaTypes.SPLITTED, "Sash", nodeIntoSash, null, node)); - else if (node.AreaList[0] is Split) - SplitParentList.Add(new SplitParent(AreaTypes.SPLITTED, "Sash into split", nodeIntoSash, node.AreaList[0], node)); break; } case AreaTypes.FILL: @@ -367,32 +357,13 @@ namespace WebWindowConfigurator } case AreaTypes.SPLITTED: { - if (node.AreaList[0] is Split) - { - if (node.ParentArea is Sash) - SplitParentList.Add(new SplitParent(AreaTypes.SPLITTED, "Sash", nodeIntoSash, node.AreaList[0], node)); - else - SplitParentList.Add(new SplitParent(AreaTypes.SPLITTED, "Split", nodeIntoSash, node.AreaList[0], node)); - } - else if (node.AreaList[0] is Sash) - { - SplitParentList.Add(new SplitParent(AreaTypes.SPLITTED, "Split area with sash", nodeIntoSash, null, node)); - } - else - { - if (node.ParentArea is Sash) - SplitParentList.Add(new SplitParent(AreaTypes.SPLITTED, "Sash", nodeIntoSash, null, node)); - else if (nodeIntoSash) - SplitParentList.Add(new SplitParent(AreaTypes.SPLITTED, "Area split into sash", nodeIntoSash, null, node)); - else - SplitParentList.Add(new SplitParent(AreaTypes.SPLITTED, "Split", nodeIntoSash, null, node)); - } + m_SplittedList.Add((Splitted)node); break; } } foreach (var item in node.AreaList) { - CreateWindowsList(item, nodeIntoSash); + CreateWindowsList(item); } } } @@ -477,7 +448,7 @@ namespace WebWindowConfigurator private List m_FillList = new List(); - private List m_SplitParentList = new List(); + private List m_SplittedList = new List(); private enum positionJoints { diff --git a/WebWindowConfigurator/Window.cs b/WebWindowConfigurator/Window.cs index 36f92ba..4ccfedd 100644 --- a/WebWindowConfigurator/Window.cs +++ b/WebWindowConfigurator/Window.cs @@ -680,7 +680,7 @@ namespace WebWindowConfigurator } else if (value < m_SashList.Count) { - if(value > 0) + if (value > 0) { double dLastDimension = 0; for (var SplitIndex = m_SashList.Count - 1; SplitIndex >= value; SplitIndex += -1) @@ -693,14 +693,16 @@ namespace WebWindowConfigurator } else { + // Se tolgo singola anta, ma tengo split SashList.RemoveAt(0); + } } - if(m_SashList.Count == 0) + if (m_SashList.Count == 0) { Area child = AreaList[0]; // Se nella singola anta ho uno split - if(!(child is Fill)) + if (!(child is Fill)) { child = child.AreaList[0].AreaList[0]; } @@ -708,62 +710,61 @@ namespace WebWindowConfigurator this.ParentArea.AreaList.Remove(this); this.ParentArea.AreaList.Add(child); } + // Se ho singola anta else if (m_SashList.Count == 1) { + // Metto come padre dell'area nello splitted l'anta stessa List ContentArea = new List(); - while (AreaList.Count > 0) - { - if (AreaList.Count == 1 & AreaList[0].AreaList.Count > 0) - { - foreach (Area selArea in AreaList[0].AreaList) - { - ContentArea.Add(selArea); - } - } - AreaList.Remove(AreaList[AreaList.Count - 1]); - } - if (ContentArea.Count > 0) - { - AreaList = ContentArea; - } + ContentArea.Add(AreaList[0].AreaList[0]); + ContentArea[0].SetParentArea(this); + AreaList.Clear(); + AreaList.Add(ContentArea[0]); } else { - List ContentArea = new List(); - if (AreaList.Count == 1 & SashList.Count > AreaList.Count) + // Se aggiungo ante + if (SashList.Count > AreaList.Count) { - ContentArea.Add(AreaList.ElementAt(0)); - AreaList.Clear(); - } - for (int SplitIndex = AreaList.Count; SplitIndex <= SashList.Count - 1; SplitIndex++) - { - AreaList.Add(Splitted.CreateSplitted(this)); - } - for (int SplitIndex = SashList.Count; SplitIndex <= AreaList.Count() - 1; SplitIndex++) - { - AreaList.Remove(AreaList[AreaList.Count - 1]); - } - if (AreaList[AreaList.Count - 1].AreaList.Count == 0) - { - if (ContentArea.Count > 0) + List ContentArea = new List(); + // Salvo in ContentArea il sottoalbero delle singole aree che mantengo + if (AreaList.Count >= 1 & SashList.Count > AreaList.Count) { - for (int SplitIndex = 0; SplitIndex <= AreaList.Count() - 1; SplitIndex++) + foreach (Area area in AreaList) { - if (SplitIndex == 0) - { - AreaList[0].AreaList.Add(ContentArea[0]); - } + if (area is Splitted) + ContentArea.Add(area.AreaList[0]); else - { - Fill f1 = (Fill)ContentArea[0]; - AreaList[SplitIndex].AreaList.Add(Fill.CreateFill(AreaList[SplitIndex], f1.FillType)); - } + ContentArea.Add(area); } + AreaList.Clear(); } - else + for (int SplitIndex = AreaList.Count; SplitIndex <= SashList.Count - 1; SplitIndex++) { - Fill f1 = (Fill)AreaList[AreaList.Count - 2].AreaList[0]; - AreaList[AreaList.Count - 1].AreaList.Add(Fill.CreateFill(AreaList[AreaList.Count - 1], f1.FillType)); + AreaList.Add(Splitted.CreateSplitted(this)); + } + // Riaggiungo i sottoalberi che avevo salvato + for (int i = 0; i < AreaList.Count - 1; i++) + { + if (AreaList.Count == 2) + { + ContentArea[i].SetParentArea(AreaList[i]); + } + AreaList[i].AreaList.Add(ContentArea[i]); + + } + // Aggiungo all'ultimo Splitted l'area di vetro + Fill newFill = new Fill(AreaList[1], ParentWindow); + newFill.SetFillType(FillTypes.GLASS); + newFill.SetAreaType(AreaTypes.FILL); + AreaList[AreaList.Count - 1].AreaList.Add(newFill); + } + // Se tolgo anta + else + { + for (int SplitIndex = SashList.Count; SplitIndex <= AreaList.Count() - 1; SplitIndex++) + { + AreaList.Remove(AreaList[AreaList.Count - 1]); + break; } } } @@ -1319,7 +1320,7 @@ namespace WebWindowConfigurator for (var SplitIndex = m_SplitPositionList.Count; SplitIndex <= value; SplitIndex++) SplitPositionList.Add(new SplitDimension(dNewDimension, true, this)); } - else if(value == 0) + else if (value == 0) { SplitPositionList.RemoveAt(1); SplitPositionList.RemoveAt(0); @@ -1336,19 +1337,17 @@ namespace WebWindowConfigurator dLastDimension += m_SplitPositionList[SplitPositionList.Count - 1].dDimension; SplitPositionList[SplitPositionList.Count - 1].SetDimension(dLastDimension); } - for(var SplitIndex = AreaList.Count; SplitIndex <= SplitPositionList.Count - 1; SplitIndex++) + // Se aggiungo split devo aggiungere vetro nell'area splitted aggiunta + for (var SplitIndex = AreaList.Count; SplitIndex <= SplitPositionList.Count - 1; SplitIndex++) { AreaList.Add(Splitted.CreateSplitted(this)); - if(AreaList[AreaList.Count - 2].AreaList[0] is Fill) - { - Fill f1 = (Fill)AreaList[AreaList.Count - 2].AreaList[0]; - AreaList.Last().AreaList.Add(Fill.CreateFill(AreaList.Last(), f1.FillType)); - } - else - AreaList.Last().AreaList.Add(Fill.CreateFill(AreaList.Last(), FillTypes.GLASS)); + Fill newFill = new Fill(AreaList.Last(), ParentWindow); + newFill.SetFillType(FillTypes.GLASS); + newFill.SetAreaType(AreaTypes.FILL); + AreaList[AreaList.Count - 1].AreaList.Add(newFill); } // Se ho più di uno split, elimino l'ultimo - if(AreaList.Count > 2) + if (AreaList.Count > 2) { for (var SplitIndex = SplitPositionList.Count; SplitIndex <= AreaList.Count - 1; SplitIndex++) { @@ -1359,6 +1358,7 @@ namespace WebWindowConfigurator else { Splitted s = (Splitted)AreaList[0]; + s.SetParentArea(ParentArea); ParentArea.AreaList.Add(s.AreaList[0]); ParentArea.AreaList.Remove(this); }