diff --git a/Test.UI/Test.UI/Components/Pages/Home.razor b/Test.UI/Test.UI/Components/Pages/Home.razor index fb2dc2d..60f99b6 100644 --- a/Test.UI/Test.UI/Components/Pages/Home.razor +++ b/Test.UI/Test.UI/Components/Pages/Home.razor @@ -3,9 +3,8 @@ Home - diff --git a/Test.UI/Test.UI/Components/Pages/Home.razor.cs b/Test.UI/Test.UI/Components/Pages/Home.razor.cs index 8af4f23..a1623da 100644 --- a/Test.UI/Test.UI/Components/Pages/Home.razor.cs +++ b/Test.UI/Test.UI/Components/Pages/Home.razor.cs @@ -38,7 +38,7 @@ namespace Test.UI.Components.Pages //return base.OnInitializedAsync(); AvailTemplateList = new List(); await Task.Delay(100); - // brutale,d a rivedere... + // brutale, da rivedere... if (File.Exists(cFile)) { string rawVal = File.ReadAllText(cFile); diff --git a/Test.UI/Test.UI/Data/AntaDoppia.jwd b/Test.UI/Test.UI/Data/AntaDoppia.jwd index c8e166b..fe1c70c 100644 --- a/Test.UI/Test.UI/Data/AntaDoppia.jwd +++ b/Test.UI/Test.UI/Data/AntaDoppia.jwd @@ -7,12 +7,12 @@ { "nIndex": 1, "sName": "Width", - "dValue": 900.0 + "dValue": 1200.0 }, { "nIndex": 2, "sName": "Height", - "dValue": 1200.0 + "dValue": 1500.0 } ], "JointList": [ diff --git a/WebWindowConfigurator/WebWindowMaker.razor b/WebWindowConfigurator/WebWindowMaker.razor index 2f0ea0e..5325328 100644 --- a/WebWindowConfigurator/WebWindowMaker.razor +++ b/WebWindowConfigurator/WebWindowMaker.razor @@ -72,61 +72,61 @@ } - @foreach (FrameDimension dimension in m_frame.DimensionList) - { -
- @dimension.nIndex - @dimension.sName - -
- } -
- - -
-
- @foreach (Joint joint in m_frame.JointList) - { -
- - -
- } -
-
-
- -
-
- -
-
-
- BottomRailQty - -
@* *@ } else if (currStep == CompileStep.Sash) {
- @*
- SashQty - -
*@ + @foreach (FrameDimension dimension in m_frame.DimensionList) + { +
+ @dimension.nIndex + @dimension.sName + +
+ } +
+ + +
+
+ @foreach (Joint joint in m_frame.JointList) + { +
+ + +
+ } +
+
+
+ +
+
+ +
+
+
+ BottomRailQty + +
@* *@
} diff --git a/WebWindowConfigurator/WebWindowMaker.razor.cs b/WebWindowConfigurator/WebWindowMaker.razor.cs index 2ff92d5..96bcc48 100644 --- a/WebWindowConfigurator/WebWindowMaker.razor.cs +++ b/WebWindowConfigurator/WebWindowMaker.razor.cs @@ -22,14 +22,25 @@ namespace WebWindowConfigurator [Parameter] public EventCallback EC_OnSelectedTemplate { get; set; } - [Parameter] - public string OUT_CurrJwd { get; set; } = null!; - [Parameter] public List IN_TemplateDTOList { get; set; } = null!; [Parameter] - public Template IN_SelTemplate { get; set; } = null!; + public Template IN_SelTemplate + { + get => mSelTemplate; + set { + if (value != null && !string.IsNullOrEmpty(value.JWD)) + { + mSelTemplate = value; + JsonWindow WindowFromJson = JsonConvert.DeserializeObject(mSelTemplate.JWD, new PolymorphicJsonConverter()); + m_CurrWindow = WindowFromJson.Deserialize(); + } + } + } + + + private Template mSelTemplate { get; set; } = null!; public TemplateSelectDTO? SelTemplateDTO { get; set; } = null; @@ -40,13 +51,6 @@ namespace WebWindowConfigurator #region Public Methods - public void ReadJwd() - { - if (IN_SelTemplate == null || string.IsNullOrEmpty(IN_SelTemplate.JWD)) { return; } - JsonWindow WindowFromJson = JsonConvert.DeserializeObject(IN_SelTemplate.JWD, new PolymorphicJsonConverter()); - m_CurrWindow = WindowFromJson.Deserialize(); - } - #endregion Public Methods #region Protected Enums @@ -54,7 +58,7 @@ namespace WebWindowConfigurator protected enum CompileStep { General = 0, - Sash=1, + Sash = 1, Split, Fill } @@ -71,35 +75,30 @@ namespace WebWindowConfigurator #endregion Protected Properties #region Protected Methods - - protected async Task DoClose() + protected override void OnInitialized() { - await EC_OnClose.InvokeAsync(true); - } - - protected async Task DoSave() - { - OUT_CurrJwd = JsonConvert.SerializeObject(m_CurrWindow.Serialize(), Formatting.Indented); - await EC_OnUpdate.InvokeAsync(OUT_CurrJwd); + //base.OnInitialized(); + //m_CurrWindow = new Window(); + //Frame NewFrame = (Frame)Frame.CreateFrame(m_CurrWindow); + //m_CurrWindow.AreaList.Add(NewFrame); + //m_SelArea = NewFrame; + //Sash NewSash = Sash.CreateSash(NewFrame); + //NewFrame.AreaList.Add(NewSash); } protected async void DoSelect(TemplateSelectDTO newSel) { SelTemplateDTO = newSel; await EC_OnSelectedTemplate.InvokeAsync(newSel); - // carico template - ReadJwd(); } - - protected override void OnInitialized() + protected async Task DoSave() { - //base.OnInitialized(); - m_CurrWindow = new Window(); - Frame NewFrame = (Frame)Frame.CreateFrame(m_CurrWindow); - m_CurrWindow.AreaList.Add(NewFrame); - m_SelArea = NewFrame; - Sash NewSash = Sash.CreateSash(NewFrame); - NewFrame.AreaList.Add(NewSash); + var CurrJwd = JsonConvert.SerializeObject(m_CurrWindow.Serialize(), Formatting.Indented); + await EC_OnUpdate.InvokeAsync(CurrJwd); + } + protected async Task DoClose() + { + await EC_OnClose.InvokeAsync(true); } #endregion Protected Methods @@ -121,13 +120,6 @@ namespace WebWindowConfigurator private void AdvStep(CompileStep newStep) { currStep = newStep; - //switch(newStep) - //{ - // case CompileStep.General: - // { - // break; - // } - //} } #endregion Private Methods diff --git a/WebWindowConfigurator/Window.cs b/WebWindowConfigurator/Window.cs index c0de030..bbc9d9c 100644 --- a/WebWindowConfigurator/Window.cs +++ b/WebWindowConfigurator/Window.cs @@ -1096,7 +1096,7 @@ namespace WebWindowConfigurator internal override JsonArea Serialize() { - JsonSash JsonSash = new JsonSash(m_bIsSashVertical, m_SashType, m_SelHardware.sId); + JsonSash JsonSash = new JsonSash(m_bIsSashVertical, m_SashType/*, m_SelHardware.sId*/); foreach (var SashDimension in SashList) JsonSash.SashList.Add(SashDimension.Serialize()); foreach (var Joint in JointList)