diff --git a/Directory.Packages.props b/Directory.Packages.props index cc64997..8cbcbcc 100644 --- a/Directory.Packages.props +++ b/Directory.Packages.props @@ -4,6 +4,10 @@ false + + runtime; build; native; contentfiles; analyzers; buildtransitive + all + @@ -13,6 +17,8 @@ + + \ No newline at end of file diff --git a/Test.UI/Components/Pages/Aedifica.razor.cs b/Test.UI/Components/Pages/Aedifica.razor.cs index 02d45aa..faad37c 100644 --- a/Test.UI/Components/Pages/Aedifica.razor.cs +++ b/Test.UI/Components/Pages/Aedifica.razor.cs @@ -37,12 +37,12 @@ namespace Test.UI.Components.Pages protected Dictionary m_CurrArgs = new Dictionary(); - protected override async Task OnInitializedAsync() + protected override Task OnInitializedAsync() { ConfInit(); DLService.PipeSvg.EA_NewMessage += PipeSvg_EA_NewMessage; //await ReloadData(); - await Task.Delay(1); + return Task.Delay(1); } private void ConfInit() diff --git a/Test.UI/Components/Pages/BaseEdit.razor.cs b/Test.UI/Components/Pages/BaseEdit.razor.cs index 96bd8e4..48bd8d7 100644 --- a/Test.UI/Components/Pages/BaseEdit.razor.cs +++ b/Test.UI/Components/Pages/BaseEdit.razor.cs @@ -514,7 +514,7 @@ namespace Test.UI.Components.Pages /// Rilettura dati /// /// - private async Task ReloadData() + private Task ReloadData() { //return base.OnInitializedAsync(); AvailHardwareList = new List(); @@ -527,7 +527,7 @@ namespace Test.UI.Components.Pages AvailHardwareList.Add(item); } } - await Task.Delay(100); + return Task.Delay(100); } private void updateInfoJwd(string currSer, string? newFamilyHardware, Hardware? newHardware, string? newColorMaterial, string? newMaterial, string? newGlass, string? newProfile) diff --git a/Test.UI/Components/Pages/EditJWD.razor.cs b/Test.UI/Components/Pages/EditJWD.razor.cs index 8e1dcad..e8f722c 100644 --- a/Test.UI/Components/Pages/EditJWD.razor.cs +++ b/Test.UI/Components/Pages/EditJWD.razor.cs @@ -253,6 +253,7 @@ namespace Test.UI.Components.Pages {"Sash_Slide_Movable_Top_DimStd", 80}, {"Frame_BottomRail_Overlap", 33.2}, {"French_In_Overlap", 26}, + {"French_Out_Overlap", 26}, {"Mixed_Bottom_Overlap", 26}, {"Mixed_Split_Bottom_Overlap", 41}, {"Mixed_Split_Top_Overlap", 41}, @@ -263,6 +264,7 @@ namespace Test.UI.Components.Pages {"NO_Slide_MovableBack_Threshold_Overlap", 0}, {"NO_Slide_Threshold_Overlap", 0}, {"Sash_Active_Overlap", 26}, + {"Sash_Inactive_Overlap", 26}, {"Sash_BottomRail_Overlap", 24.5}, {"Sash_Bottom_Overlap", 26}, {"Sash_Horizontal_Bottom_Overlap", 26}, @@ -585,7 +587,7 @@ namespace Test.UI.Components.Pages /// Rilettura dati /// /// - private async Task ReloadData() + private Task ReloadData() { AvailHardwareList = new List(); if (File.Exists(cFileHardware)) @@ -597,7 +599,7 @@ namespace Test.UI.Components.Pages AvailHardwareList.Add(item); } } - await Task.Delay(100); + return Task.Delay(100); } private void updateInfoJwd(string currSer, string? newFamilyHardware, Hardware? newHardware, string? newColorMaterial, string? newMaterial, string? newGlass, string? newProfile) diff --git a/Test.UI/Components/Pages/Home.razor.cs b/Test.UI/Components/Pages/Home.razor.cs index 9efeaad..09fc270 100644 --- a/Test.UI/Components/Pages/Home.razor.cs +++ b/Test.UI/Components/Pages/Home.razor.cs @@ -115,7 +115,7 @@ namespace Test.UI.Components.Pages isInteractive = true; } } - protected override async Task OnInitializedAsync() + protected override Task OnInitializedAsync() { ConfInit(); Random random = new Random(); @@ -124,7 +124,7 @@ namespace Test.UI.Components.Pages DLService.PipeSvg.EA_NewMessage += PipeSvg_EA_NewMessage; DLService.PipeShape.EA_NewMessage += PipeShape_EA_NewMessage; DLService.PipeHwOpt.EA_NewMessage += PipeHwOption_EA_NewMessage; - await ReloadData(); + return ReloadData(); } #endregion Protected Methods diff --git a/Test.UI/Components/Pages/SimpleEditOld.razor.cs b/Test.UI/Components/Pages/SimpleEditOld.razor.cs index 52d2709..292c672 100644 --- a/Test.UI/Components/Pages/SimpleEditOld.razor.cs +++ b/Test.UI/Components/Pages/SimpleEditOld.razor.cs @@ -329,7 +329,7 @@ namespace Test.UI.Components.Pages /// Rilettura dati /// /// - private async Task ReloadData() + private Task ReloadData() { //return base.OnInitializedAsync(); AvailHardwareList = new List(); @@ -342,7 +342,7 @@ namespace Test.UI.Components.Pages AvailHardwareList.Add(item); } } - await Task.Delay(100); + return Task.Delay(100); } #endregion Private Methods diff --git a/Test.UI/Data/AntaDoppia.jwd b/Test.UI/Data/AntaDoppia.jwd index f78a0d0..9e2534c 100644 --- a/Test.UI/Data/AntaDoppia.jwd +++ b/Test.UI/Data/AntaDoppia.jwd @@ -57,17 +57,19 @@ "Threshold": "Bottom", "BottomRail": false, "BottomRailQty": 0, + "BottomRailElemDimList": [], "GroupId": 1, "AreaList": [ { "IsSashVertical": true, + "IsDimensionLight": true, "SashList": [ { "SashId": 1, "OpeningType": "TILTTURN_LEFT", + "MeasureType": "PROPORTIONAL", + "Dimension": 1, "HasHandle": true, - "Dimension": 50.0, - "MeasureType": "PERCENTAGE", "ElementDimensionList": [ { "Index": 1, @@ -108,9 +110,9 @@ { "SashId": 2, "OpeningType": "TURNONLY_RIGHT", + "MeasureType": "PROPORTIONAL", + "Dimension": 1, "HasHandle": false, - "Dimension": 50.0, - "MeasureType": "PERCENTAGE", "ElementDimensionList": [ { "Index": 1, @@ -152,43 +154,9 @@ "SashType": "NULL", "BottomRail": false, "BottomRailQty": 0, - "BottomRailElemDimList": [ - { - "Index": 1, - "Value": 78.0 - } - ], - "Hardware": "000633", - "HwOptionList": [ - { - "Name": "Entrata", - "Value": "15" - }, - { - "Name": "LavManigliaPassante", - "Value": "false" - }, - { - "Name": "PosizioneForoCilindro", - "Value": "sotto" - }, - { - "Name": "Deviatore", - "Value": "false" - }, - { - "Name": "ModelloCilindro", - "Value": "c999" - }, - { - "Name": "LavCilindroPassante", - "Value": "false" - }, - { - "Name": "HMan", - "Value": "400" - } - ], + "BottomRailElemDimList": [], + "Hardware": "000631", + "HwOptionList": [], "GroupId": 2, "AreaList": [ { diff --git a/Test.UI/Data/FinestraSplitGrid.jwd b/Test.UI/Data/FinestraSplitGrid.jwd index f1d93c7..0df35d6 100644 --- a/Test.UI/Data/FinestraSplitGrid.jwd +++ b/Test.UI/Data/FinestraSplitGrid.jwd @@ -108,16 +108,6 @@ "Index": 2, "Value": 78.0, "Area": 1 - }, - { - "Index": 1, - "Value": 78.0, - "Area": 2 - }, - { - "Index": 2, - "Value": 78.0, - "Area": 2 } ], "GroupId": 2, diff --git a/Test.UI/Program.cs b/Test.UI/Program.cs index cd7c56c..f7388cb 100644 --- a/Test.UI/Program.cs +++ b/Test.UI/Program.cs @@ -1,6 +1,7 @@ using EgwCoreLib.Lux.Data.Services; using Microsoft.Extensions.Configuration; using NLog; +using NLog.Web; using StackExchange.Redis; using System.Reflection; using Test.UI.Client.Pages; @@ -10,7 +11,12 @@ var builder = WebApplication.CreateBuilder(args); var assemblyVersion = Assembly.GetExecutingAssembly().GetName().Version?.ToString(); +var logger = LogManager.Setup() + .LoadConfigurationFromAppSettings() + .GetCurrentClassLogger(); + ConfigurationManager configuration = builder.Configuration; +logger.Info("Program.cs: startup"); // Add services to the container. builder.Services.AddRazorComponents() @@ -36,6 +42,7 @@ var app = builder.Build(); // aggiunt base URL x routing corretto string baseUrl = configuration.GetValue("ServerConf:BaseUrl") ?? ""; app.UsePathBase(baseUrl); +logger.Info($"BaseUrl: {baseUrl}"); // Configure the HTTP request pipeline. if (app.Environment.IsDevelopment()) diff --git a/Test.UI/Test.UI.csproj b/Test.UI/Test.UI.csproj index 6776bd9..e067628 100644 --- a/Test.UI/Test.UI.csproj +++ b/Test.UI/Test.UI.csproj @@ -29,6 +29,12 @@ + + runtime; build; native; contentfiles; analyzers; buildtransitive + all + + + diff --git a/Test.UI/appsettings.json b/Test.UI/appsettings.json index fcc297e..8c5f5d9 100644 --- a/Test.UI/appsettings.json +++ b/Test.UI/appsettings.json @@ -6,6 +6,50 @@ "Microsoft.AspNetCore": "Warning" } }, + "NLog": { + "variables": { + "baseFileDir": "${basedir}/logs/", + "layout": "${longdate} | ${uppercase:${level}} | ${logger:shortName=false} | ${message}" + }, + // "internalLogLevel": "Info", + // "internalLogFile": "c:\\temp\\internal-nlog.txt", + "extensions": [ + { "assembly": "NLog.Extensions.Logging" }, + { "assembly": "NLog.Web.AspNetCore" } + ], + "throwConfigExceptions": true, + "targets": { + "async": true, + "logfile": { + "type": "File", + "fileName": "${basedir}/logs/${shortdate}.log", + "layout": "${layout}", + "archiveEvery": "Day", + "archiveFileName": "${basedir}/logs/old/${shortdate}_{#}.log", + "archiveNumbering": "DateAndSequence", + "archiveAboveSize": "1024000", + "archiveDateFormat": "HH", + "maxArchiveFiles": "60", + "maxArchiveDays": "30" + }, + "logconsole": { + "type": "ColoredConsole", + "layout": "${longdate} | ${uppercase:${level}} | ${logger:shortName=true} | ${message}" + } + }, + "rules": [ + { + "logger": "*", + "minLevel": "Trace", + "writeTo": "logconsole" + }, + { + "logger": "*", + "minLevel": "Info", + "writeTo": "logfile" + } + ] + }, "AllowedHosts": "*", "ConnectionStrings": { "Redis": "redis.ufficio:26379, serviceName=devel, DefaultDatabase=6, keepAlive=180, connectTimeout=15000, syncTimeout=15000, asyncTimeout=15000, abortConnect=false, ssl=false, allowAdmin=true" diff --git a/WebWindowComplex/Compo/AreaFrame.razor.cs b/WebWindowComplex/Compo/AreaFrame.razor.cs index b4c30d0..48180ac 100644 --- a/WebWindowComplex/Compo/AreaFrame.razor.cs +++ b/WebWindowComplex/Compo/AreaFrame.razor.cs @@ -39,18 +39,18 @@ namespace WebWindowComplex.Compo /// Sollevo evento richiesta aggiunta sash su frame /// /// - private async Task RaiseAddSash() + private Task RaiseAddSash() { - await EC_AddSash.InvokeAsync(true); + return EC_AddSash.InvokeAsync(true); } /// /// Sollevo evento richiesta aggiunta split su frame /// /// - private async Task RaiseAddSplit() + private Task RaiseAddSplit() { - await EC_AddSplit.InvokeAsync(true); + return EC_AddSplit.InvokeAsync(true); } #endregion Private Methods diff --git a/WebWindowComplex/Compo/AreaHwOption.razor.cs b/WebWindowComplex/Compo/AreaHwOption.razor.cs index ecdf397..e478947 100644 --- a/WebWindowComplex/Compo/AreaHwOption.razor.cs +++ b/WebWindowComplex/Compo/AreaHwOption.razor.cs @@ -39,6 +39,10 @@ namespace WebWindowComplex.Compo } } + /// + /// Metodo per aprire/chiudere area per hw option + /// + /// private async Task changeCollapsed() { hwOptCollapsed = !hwOptCollapsed; @@ -58,13 +62,13 @@ namespace WebWindowComplex.Compo /// /// /// - private async Task RaiseOptCombo(AGBOptionCombo updRec) + private Task RaiseOptCombo(AGBOptionCombo updRec) { var args = new DataUpdateHwOption { AGBOptCombo = updRec }; - await EC_UpdateHwOpt.InvokeAsync(args); + return EC_UpdateHwOpt.InvokeAsync(args); } /// @@ -72,13 +76,13 @@ namespace WebWindowComplex.Compo /// /// /// - private async Task RaiseOptText(AGBOptionText updRec) + private Task RaiseOptText(AGBOptionText updRec) { var args = new DataUpdateHwOption { AGBOptText = updRec }; - await EC_UpdateHwOpt.InvokeAsync(args); + return EC_UpdateHwOpt.InvokeAsync(args); } private bool IsLoadingHwOpt diff --git a/WebWindowComplex/Compo/AreaSash.razor.cs b/WebWindowComplex/Compo/AreaSash.razor.cs index a4eaf32..520d797 100644 --- a/WebWindowComplex/Compo/AreaSash.razor.cs +++ b/WebWindowComplex/Compo/AreaSash.razor.cs @@ -116,29 +116,29 @@ namespace WebWindowComplex.Compo return 0; } - /// - /// Metodo per avere il lo step da usare nella form-input - /// - /// - public double CssStepNumber() - { - switch (CurrSashDim.MeasureType) - { - case Json.WindowConst.MeasureTypes.ABSOLUTE: - { - return 0.5; - } - case Json.WindowConst.MeasureTypes.PROPORTIONAL: - { - return 1; - } - case Json.WindowConst.MeasureTypes.PERCENTAGE: - { - return 0.5; - } - } - return 0; - } + ///// + ///// Metodo per avere il lo step da usare nella form-input + ///// + ///// + //public double CssStepNumber() + //{ + // switch (CurrSashDim.MeasureType) + // { + // case Json.WindowConst.MeasureTypes.ABSOLUTE: + // { + // return 0.5; + // } + // case Json.WindowConst.MeasureTypes.PROPORTIONAL: + // { + // return 1; + // } + // case Json.WindowConst.MeasureTypes.PERCENTAGE: + // { + // return 0.5; + // } + // } + // return 0; + //} /// /// Selezione tipo di apertura anta @@ -192,18 +192,19 @@ namespace WebWindowComplex.Compo /// /// Sollevo evento richiesta per cambiare tutti i Joint /// + /// Tipo di giunto che si vuole /// - private async Task ChangeAllJoints(Json.WindowConst.Joints JointType) + private Task ChangeAllJoints(Json.WindowConst.Joints JointType) { foreach (var item in CurrSashDim.JointList) item.SetSelJointType(JointType); - await EC_UpdateSashDim.InvokeAsync(CurrSashDim); + return EC_UpdateSashDim.InvokeAsync(CurrSashDim); } /// /// Aggiornamento joint /// - /// + /// Tipo di giunto che si vuole /// private async Task UpdateJoint(Joint updRec) { @@ -220,7 +221,7 @@ namespace WebWindowComplex.Compo /// /// Aggiornamento element /// - /// + /// Tipo di giunto che si vuole /// private async Task UpdateElement(ElementDimension updRec) { @@ -238,7 +239,7 @@ namespace WebWindowComplex.Compo /// Metodo per cambiare l'anta su cui è presente la maniglia /// /// - private async Task ChangeHandle() + private Task ChangeHandle() { // Cerco la Sash che si sta considerando nella lista Sash var s = SashList.Where(x => x.GroupId == CurrSashGroup.GroupId).FirstOrDefault(); @@ -284,14 +285,16 @@ namespace WebWindowComplex.Compo sash = CurrSashGroup, reqProfile = true }; - await EC_UpdateSash.InvokeAsync(args); + return EC_UpdateSash.InvokeAsync(args); } - + /// /// Copio contenuto anta da indexCopy a IndexModify /// + /// Indice dell'ante di cui voglio copiare contenuto + /// Indice dell'ante di cui voglio modificare contenuto /// - private async Task CopyContentSash(int IndexCopy, int IndexModify) + private Task CopyContentSash(int IndexCopy, int IndexModify) { isOpen = !isOpen; // Anta selezionata @@ -307,14 +310,14 @@ namespace WebWindowComplex.Compo sash = CurrSashGroup, reqProfile = true }; - await EC_UpdateSash.InvokeAsync(args); + return EC_UpdateSash.InvokeAsync(args); } /// /// Metodo per aggiungere lo split nella singola anta /// /// - private async Task AddSplitToSash() + private Task AddSplitToSash() { CurrAnta.AddSplit(); DataUpdateProfile args = new DataUpdateProfile() @@ -322,7 +325,7 @@ namespace WebWindowComplex.Compo sash = CurrSashGroup, reqProfile = true }; - await EC_UpdateSash.InvokeAsync(args); + return EC_UpdateSash.InvokeAsync(args); } private bool isOpen = false; @@ -353,6 +356,7 @@ namespace WebWindowComplex.Compo View = 1, Edit = 2 } + protected override void OnParametersSet() { if (EditMode) diff --git a/WebWindowComplex/Compo/AreaSplit.razor.cs b/WebWindowComplex/Compo/AreaSplit.razor.cs index aba53c8..a272dfa 100644 --- a/WebWindowComplex/Compo/AreaSplit.razor.cs +++ b/WebWindowComplex/Compo/AreaSplit.razor.cs @@ -39,27 +39,25 @@ namespace WebWindowComplex.Compo /// /// Metodo per copiare sash /// + /// Indice della finestra che si vuole copiare /// - private async Task RaiseCopySash(int indexCurrSash) + private Task RaiseCopySash(int indexCurrSash) { - //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); + return EC_UpdateSplitted.InvokeAsync(CurrSplitted); } /// /// Metodo per aggiungere prima sash /// /// - private async Task RaiseAddSash() + private Task RaiseAddSash() { CurrSplitted.AddFirstSash(); - await EC_UpdateSplitted.InvokeAsync(CurrSplitted); + return EC_UpdateSplitted.InvokeAsync(CurrSplitted); } #endregion Private Methods diff --git a/WebWindowComplex/Compo/BottomRail.razor b/WebWindowComplex/Compo/BottomRail.razor new file mode 100644 index 0000000..97cc835 --- /dev/null +++ b/WebWindowComplex/Compo/BottomRail.razor @@ -0,0 +1,30 @@ + + + + + + + + + Bottom Rail + + + + @if(CurrFrame() != null) + { + @for (int i = CurrFrame().BottomRailElemDimList.Count - 1; i >= 0; i-- ) + { + + } + } + @if (CurrSash() != null) + { + @for (int i = CurrSash().BottomRailElemDimList.Count - 1; i >= 0; i--) + { + + } + } + + + + \ No newline at end of file diff --git a/WebWindowComplex/Compo/BottomRail.razor.cs b/WebWindowComplex/Compo/BottomRail.razor.cs new file mode 100644 index 0000000..960e105 --- /dev/null +++ b/WebWindowComplex/Compo/BottomRail.razor.cs @@ -0,0 +1,79 @@ +using Microsoft.AspNetCore.Components; +using WebWindowComplex.Models; + +namespace WebWindowComplex.Compo +{ + public partial class BottomRail + { + #region Public Properties + + [Parameter] + public Area CurrArea { get; set; } = null!; + + [Parameter] + public EventCallback EC_UpdateBottomRail { get; set; } + + #endregion Public Properties + + #region Private Properties + + /// + /// Aggiornamento element Bottom Rail + /// + /// + /// + private async Task UpdateElement(ElementDimension updRec) + { + if (updRec != null) + { + DataBottomRail ans = new(); + ElementDimension currRec = new(CurrArea, -1, 0); + if (CurrFrame() != null) + { + // cerco il record + currRec = CurrFrame().BottomRailElemDimList.FirstOrDefault(x => x.ParentArea == updRec.ParentArea && x.nIndex == updRec.nIndex); + + } + else if(CurrSash() != null) + { + // cerco il record + currRec = CurrSash().BottomRailElemDimList.FirstOrDefault(x => x.ParentArea == updRec.ParentArea && x.nIndex == updRec.nIndex); + } + if (currRec != null) + { + currRec = updRec; + ans = new DataBottomRail + { + frame = CurrFrame(), + sash = CurrSash() + }; + } + await EC_UpdateBottomRail.InvokeAsync(ans); + } + } + + private Frame? CurrFrame() + { + if(CurrArea is Frame) + return (Frame)CurrArea; + else + return null; + } + + private Sash? CurrSash() + { + if (CurrArea is Sash) + return (Sash)CurrArea; + else + return null; + } + + #endregion Private Properties + } + + public class DataBottomRail + { + public Sash? sash { get; set; } + public Frame? frame { get; set; } + } +} \ No newline at end of file diff --git a/WebWindowComplex/Compo/CardArcElement.razor.cs b/WebWindowComplex/Compo/CardArcElement.razor.cs index 6d9646a..aac2d0e 100644 --- a/WebWindowComplex/Compo/CardArcElement.razor.cs +++ b/WebWindowComplex/Compo/CardArcElement.razor.cs @@ -28,13 +28,10 @@ namespace WebWindowComplex.Compo #endregion Public Properties - private async Task UpdatePreview() + private Task UpdatePreview() { - var args = new DataUpdateFrame - { - currFrame = CurrFrame - }; - await EC_UpdatePreview.InvokeAsync(args); + var args = new DataUpdateFrame { currFrame = CurrFrame }; + return EC_UpdatePreview.InvokeAsync(args); } private async Task UpdatePreviewSash(Sash CurrSashGRoup) diff --git a/WebWindowComplex/Compo/CardFill.razor.cs b/WebWindowComplex/Compo/CardFill.razor.cs index f1e1c36..6ce6aa9 100644 --- a/WebWindowComplex/Compo/CardFill.razor.cs +++ b/WebWindowComplex/Compo/CardFill.razor.cs @@ -45,12 +45,12 @@ namespace WebWindowComplex.Compo /// /// Metodo per cambiare solo il Fill corrente /// - /// tipo di fill richiesto + /// Tipo di fill richiesto /// - protected async Task ChangeOneFill(FillTypes reqFillType) + protected Task ChangeOneFill(FillTypes reqFillType) { CurrFill.SetFillType(reqFillType); - await EC_UpdateFill.InvokeAsync(CurrFill); + return EC_UpdateFill.InvokeAsync(CurrFill); } #endregion Protected Methods diff --git a/WebWindowComplex/Compo/CardFrame.razor b/WebWindowComplex/Compo/CardFrame.razor index 0dcce3a..1c8f405 100644 --- a/WebWindowComplex/Compo/CardFrame.razor +++ b/WebWindowComplex/Compo/CardFrame.razor @@ -80,11 +80,11 @@ } else { - @if (CurrFrameWindow.BottomRailQty > 0) { - + } + } @@ -102,17 +102,17 @@ { - ChangeAllJoints(WebWindowComplex.Json.WindowConst.Joints.ANGLED, CurrFrameWindow)">Angled + ChangeAllJoints(WebWindowComplex.Json.WindowConst.Joints.ANGLED)">Angled - ChangeAllJoints(WebWindowComplex.Json.WindowConst.Joints.FULL_H, CurrFrameWindow)">Horizontal + ChangeAllJoints(WebWindowComplex.Json.WindowConst.Joints.FULL_H)">Horizontal - ChangeAllJoints(WebWindowComplex.Json.WindowConst.Joints.FULL_V, CurrFrameWindow)">Vertical + ChangeAllJoints(WebWindowComplex.Json.WindowConst.Joints.FULL_V)">Vertical } diff --git a/WebWindowComplex/Compo/CardFrame.razor.cs b/WebWindowComplex/Compo/CardFrame.razor.cs index 72c3603..c189523 100644 --- a/WebWindowComplex/Compo/CardFrame.razor.cs +++ b/WebWindowComplex/Compo/CardFrame.razor.cs @@ -190,22 +190,16 @@ namespace WebWindowComplex.Compo /// /// Metodo per cambiare tutti i joint /// + /// /// - private async Task ChangeAllJoints(Json.WindowConst.Joints JointType, Area a) + private Task ChangeAllJoints(Json.WindowConst.Joints JointType) { - if (a is Frame) + foreach (Joint joint in CurrFrameWindow.JointList) { - foreach (Joint joint in CurrFrameWindow.JointList) - { - joint.SetSelJointType(JointType); - } + joint.SetSelJointType(JointType); } - var args = new DataUpdateFrame() - { - currFrame = CurrFrameWindow, - svgNoHw = false - }; - await EC_UpdateFrame.InvokeAsync(args); + var args = new DataUpdateFrame() { currFrame = CurrFrameWindow, svgNoHw = false }; + return EC_UpdateFrame.InvokeAsync(args); } /// @@ -219,7 +213,8 @@ namespace WebWindowComplex.Compo /// /// Aggiornamento dimensione editata /// - /// + /// Dimensione aggiornata + /// private async Task UpdateDim(FrameDimension updRec) { // cerco il record @@ -285,15 +280,15 @@ namespace WebWindowComplex.Compo } /// - /// Aggiornamento Bottom Rail + /// Aggiornamento Frame /// /// - private async Task UpdateFrame(Frame updRec) + private async Task UpdateFrame(DataBottomRail updRec) { // lo aggiorno - if (updRec != null) + if (updRec.frame != null) { - CurrFrameWindow = updRec; + CurrFrameWindow = updRec.frame; var args = new DataUpdateFrame() { currFrame = CurrFrameWindow, @@ -308,7 +303,7 @@ namespace WebWindowComplex.Compo /// /// /// - private string ButtonJointCss(WebWindowComplex.Json.WindowConst.Joints type) + private string ButtonJointCss(Json.WindowConst.Joints type) { foreach (var item in CurrFrameWindow.JointList) { @@ -330,6 +325,7 @@ namespace WebWindowComplex.Compo public Frame currFrame { get; set; } = null!; public bool svgNoHw { get; set; } = false; + public int groupIdDelete { get; set; } = -1; #endregion Public Properties } diff --git a/WebWindowComplex/Compo/CardSashGroup.razor b/WebWindowComplex/Compo/CardSashGroup.razor index e340b36..e2e88a3 100644 --- a/WebWindowComplex/Compo/CardSashGroup.razor +++ b/WebWindowComplex/Compo/CardSashGroup.razor @@ -14,10 +14,10 @@ RemoveArea()">Remove sash group - @* + ChangeTypeDimension()"> Solo luce - *@ + } @@ -69,11 +69,11 @@ } else { - @if (CurrSashGroup.SashBottomRailQty > 0) { - + } + } @@ -198,6 +198,7 @@ EditMode="editMode" EC_UpdateSash="UpdateSash" EC_UpdateSashDim="UpdateSashDimension" + EC_ReqResetDict="ResetDict" EC_EditView="EditView"> } diff --git a/WebWindowComplex/Compo/CardSashGroup.razor.cs b/WebWindowComplex/Compo/CardSashGroup.razor.cs index da4f366..1822049 100644 --- a/WebWindowComplex/Compo/CardSashGroup.razor.cs +++ b/WebWindowComplex/Compo/CardSashGroup.razor.cs @@ -198,9 +198,8 @@ namespace WebWindowComplex.Compo #region Protected Methods /// - /// Metodo per rimuovere area + /// Metodo per rimuovere area corrente /// - /// area da rimuovere /// protected async Task RemoveArea() { @@ -208,7 +207,8 @@ namespace WebWindowComplex.Compo FrameWindow.SetSelThresholdFromName(FrameWindow.ThresholdList.FirstOrDefault(x => x.Name != "Threshold")?.Name); var args = new DataUpdateFrame() { - currFrame = FrameWindow + currFrame = FrameWindow, + groupIdDelete = CurrSashGroup.GroupId }; // richiesta reset dict shape await EC_ReqResetDict.InvokeAsync(new DataUpdateRes { req=DataAction.ResetDictShape}); @@ -218,56 +218,52 @@ namespace WebWindowComplex.Compo } /// - /// Metodo per cambiare l'anta su cui è presente la maniglia + /// Metodo per cambiare dimensione solo luce /// /// - //private async Task ChangeTypeDimension() - //{ - // CurrSashGroup.bIsDimensionLight = !CurrSashGroup.bIsDimensionLight; - // foreach(var CurrSashDim in CurrSashGroup.SashList) - // { - // if(CurrSashDim.SelMeasureType is MeasureTypes.ABSOLUTE) - // { - // if (CurrSashGroup.bIsDimensionLight) - // { - // CurrSashDim.SetDimensionLight(CurrSashDim.dDimension - - // CurrSashDim.ElementDimensionList.ElementAt(1).dDimension - - // CurrSashDim.ElementDimensionList.ElementAt(3).dDimension); - // } - // else - // { - // CurrSashDim.SetDimensionLight(CurrSashDim.dDimension + - // CurrSashDim.ElementDimensionList.ElementAt(1).dDimension + - // CurrSashDim.ElementDimensionList.ElementAt(3).dDimension); - // } - // } - // } - // DataUpdateSash args = new DataUpdateSash() - // { - // currSash = CurrSashGroup, - // noSvg = false - // }; - // await EC_UpdateSashGroup.InvokeAsync(args); - //} + private Task ChangeTypeDimension() + { + CurrSashGroup.bIsDimensionLight = !CurrSashGroup.bIsDimensionLight; + foreach (var CurrSashDim in CurrSashGroup.SashList) + { + if (CurrSashDim.SelMeasureType is MeasureTypes.ABSOLUTE) + { + if (CurrSashGroup.bIsDimensionLight) + { + CurrSashDim.SetDimensionLight(CurrSashDim.dDimension - + CurrSashDim.ElementDimensionList.ElementAt(1).dDimension - + CurrSashDim.ElementDimensionList.Last().dDimension); + } + else + { + CurrSashDim.SetDimensionLight(CurrSashDim.dDimension + + CurrSashDim.ElementDimensionList.ElementAt(1).dDimension + + CurrSashDim.ElementDimensionList.Last().dDimension); + } + } + } + DataUpdateSash args = new DataUpdateSash() + { + currSash = CurrSashGroup, + noSvg = false + }; + return EC_UpdateSashGroup.InvokeAsync(args); + } /// /// Metodo per scegliere tipo di misura /// /// /// - protected async Task SetMeasureType(MeasureTypes type) + protected Task SetMeasureType(MeasureTypes type) { isOpen = !isOpen; - for(int i = 0; i < CurrSashGroup.SashList.Count; i++) + for (int i = 0; i < CurrSashGroup.SashList.Count; i++) { CurrSashGroup.SashList.ElementAt(i).SetSelMeasureType(type, i); } - var args = new DataUpdateSash - { - currSash = CurrSashGroup, - noSvg = true - }; - await EC_UpdateSashGroup.InvokeAsync(args); + var args = new DataUpdateSash { currSash = CurrSashGroup, noSvg = true }; + return EC_UpdateSashGroup.InvokeAsync(args); } /// @@ -292,7 +288,7 @@ namespace WebWindowComplex.Compo } /// - /// Metodo per aggiornare sash + /// Metodo per aggiornare sash group /// /// /// @@ -313,9 +309,27 @@ namespace WebWindowComplex.Compo } /// - /// Metodo per aggiornare sash + /// Metodo per aggiornare sash group /// - /// + /// + /// + protected async Task UpdateBottomRail(DataBottomRail updRec) + { + if (updRec.sash != null) + { + CurrSashGroup = updRec.sash; + var args = new DataUpdateSash + { + currSash = CurrSashGroup + }; + await EC_UpdateSashGroup.InvokeAsync(args); + } + } + + /// + /// Metodo per aggiornare bottom rail + /// + /// /// protected async Task UpdateBottomRail(ElementDimension updRec) { @@ -331,9 +345,14 @@ namespace WebWindowComplex.Compo } } - protected async Task ResetDict(DataUpdateRes args) + /// + /// Metodo per resettare dizionario richiesto + /// + /// + /// + protected Task ResetDict(DataUpdateRes args) { - await EC_ReqResetDict.InvokeAsync(args); + return EC_ReqResetDict.InvokeAsync(args); } #endregion Protected Methods @@ -362,7 +381,7 @@ namespace WebWindowComplex.Compo /// /// Aggiornamento opzioni hardware /// - /// + /// /// private async Task UpdateOpt(DataUpdateHwOption argsHw) { @@ -372,59 +391,33 @@ namespace WebWindowComplex.Compo { // 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 - }; - await EC_UpdateSashGroup.InvokeAsync(args); - await EC_ReqOptionHw.InvokeAsync(CurrSashGroup); - } + currRec = AGBOptCombo; } - else + else if(AGBOptText != null) { // cerco il record var currRec = CurrSashGroup.HwOptionList.FirstOrDefault(x => x.sName == AGBOptText.sName && x.sDescription == AGBOptText.sDescription); - // lo aggiorno - if (AGBOptText != null) + currRec = AGBOptText; + } + if(AGBOptCombo != null || AGBOptText != null) + { + var args = new DataUpdateSash { - currRec = AGBOptText; - var args = new DataUpdateSash - { - currSash = CurrSashGroup - }; - await EC_UpdateSashGroup.InvokeAsync(args); - await EC_ReqOptionHw.InvokeAsync(CurrSashGroup); - } + currSash = CurrSashGroup + }; + await EC_UpdateSashGroup.InvokeAsync(args); + await EC_ReqOptionHw.InvokeAsync(CurrSashGroup); } } /// /// Prima chiamata hw option list /// - /// /// - private async Task FirstHwOptionList() + private Task FirstHwOptionList() { - var args = new DataUpdateSash - { - currSash = CurrSashGroup - }; - //await EC_UpdatePreview.InvokeAsync(args); - await EC_ReqFirstOptionHw.InvokeAsync(CurrSashGroup); - } - - private string ButtonMeasureCss(MeasureTypes type) - { - foreach(var item in CurrSashGroup.SashList) - { - if (!item.SelMeasureType.Equals(type)) - return "btn btn-outline-secondary btn-sm"; - } - return "btn btn-secondary btn-sm"; + var args = new DataUpdateSash { currSash = CurrSashGroup }; + return EC_ReqFirstOptionHw.InvokeAsync(CurrSashGroup); } private bool isOpen = false; diff --git a/WebWindowComplex/Compo/CardSplit.razor b/WebWindowComplex/Compo/CardSplit.razor index 7d3f8f9..3f5db0a 100644 --- a/WebWindowComplex/Compo/CardSplit.razor +++ b/WebWindowComplex/Compo/CardSplit.razor @@ -181,7 +181,7 @@ Element vert - @foreach (var element in CurrSplit.ElemDimVertList) + @foreach (var element in vertList()) { } @@ -193,7 +193,7 @@ Element horiz - @foreach (var element in CurrSplit.ElemDimHorizList) + @foreach (var element in horizList()) { } diff --git a/WebWindowComplex/Compo/CardSplit.razor.cs b/WebWindowComplex/Compo/CardSplit.razor.cs index 40efacc..e80a4db 100644 --- a/WebWindowComplex/Compo/CardSplit.razor.cs +++ b/WebWindowComplex/Compo/CardSplit.razor.cs @@ -196,12 +196,34 @@ namespace WebWindowComplex.Compo /// private async Task UpdateElement(SplitElementDimension updRec) { - // cerco il record - var currRec = CurrSplit.ElemDimHorizList.FirstOrDefault(x => x.ParentArea == updRec.ParentArea && x.nIndex == updRec.nIndex); - // lo aggiorno if (updRec != null) { - currRec = updRec; + SplitElementDimension? currRec = new SplitElementDimension(null, 0,0,-1); + if (updRec.nSubArea != 0) + { + List ElemIndexList = new List(); + if (CurrSplit.bSplitStartVert) + ElemIndexList = CurrSplit.ElemDimHorizList + .Where(x => x.nSubArea != updRec.nSubArea && x.nIndex == updRec.nIndex) + .ToList(); + else + ElemIndexList = CurrSplit.ElemDimVertList + .Where(x => x.nSubArea == updRec.nSubArea && x.nIndex == updRec.nIndex) + .ToList(); + foreach (var item in ElemIndexList) + { + item.dDimension = updRec.dDimension; + } + } + else + { + if(CurrSplit.bSplitStartVert) + currRec = CurrSplit.ElemDimVertList.FirstOrDefault(x => x.ParentArea == updRec.ParentArea && x.nIndex == updRec.nIndex); + else + currRec = CurrSplit.ElemDimHorizList.FirstOrDefault(x => x.ParentArea == updRec.ParentArea && x.nIndex == updRec.nIndex); + // lo aggiorno + currRec = updRec; + } var args = new DataUpdateSplit() { currSplit = CurrSplit, @@ -313,7 +335,7 @@ namespace WebWindowComplex.Compo /// /// nuovo tipo /// - protected async Task SetMeasureType(MeasureTypes type) + protected Task SetMeasureType(MeasureTypes type) { isOpen = !isOpen; foreach (var item in CurrSplit.SplitVertList) @@ -329,7 +351,19 @@ namespace WebWindowComplex.Compo currSplit = CurrSplit, noSvg = true }; - await EC_UpdateSplit.InvokeAsync(args); + return EC_UpdateSplit.InvokeAsync(args); + } + + private List horizList() + { + int subAreaMin = CurrSplit.ElemDimHorizList.Min(x => x.nSubArea); + return CurrSplit.ElemDimHorizList.Where(x => x.nSubArea == subAreaMin).ToList(); + } + + private List vertList() + { + int subAreaMin = CurrSplit.ElemDimVertList.Min(x => x.nSubArea); + return CurrSplit.ElemDimVertList.Where(x => x.nSubArea == subAreaMin).ToList(); } } diff --git a/WebWindowComplex/Compo/CardTree.razor b/WebWindowComplex/Compo/CardTree.razor index ad3f3d5..077894d 100644 --- a/WebWindowComplex/Compo/CardTree.razor +++ b/WebWindowComplex/Compo/CardTree.razor @@ -7,46 +7,81 @@ @for (int j = 0; j < maxCol; j++) { - CompileStep cs = CompileStep.Frame; - int ind = -1; - string s = "Vai a step "; - @if (j + 1 == ItemTableList[i].Col) - { - @if (ItemTableList[i].Type is Json.WindowConst.AreaTypes.FRAME) - { - cs = CompileStep.Frame; - s = s + cs.ToString(); - } - else if (ItemTableList[i].Type is Json.WindowConst.AreaTypes.SPLIT) - { - cs = CompileStep.Split; - ind = ItemTableList[i].IndexItem; - s = s + cs.ToString() + ((ind + 1) > 0 ? (ind + 1): ""); - } - else if (ItemTableList[i].Type is Json.WindowConst.AreaTypes.SASH) - { - cs = CompileStep.Sash; - ind = ItemTableList[i].IndexItem; - s = s + cs.ToString() + ((ind + 1) > 0 ? (ind + 1) : ""); - } - else if (ItemTableList[i].Type is Json.WindowConst.AreaTypes.FILL) - { - cs = CompileStep.Fill; - ind = ItemTableList[i].IndexItem; - s = s + cs.ToString() + ((ind + 1) > 0 ? (ind + 1) : ""); - } - - RaiseNextStep(cs, ind)" title="@(s)">@ItemTableList[i].Desc - @* @if (ItemTableList[i].Type is Json.WindowConst.AreaTypes.SASH || - ItemTableList[i].Type is Json.WindowConst.AreaTypes.SPLIT) - { - Remove(cs, ind)" title="Remove">Canc - } *@ - + var index = RowCollapsedDict.Keys.Where(k => k <= i).LastOrDefault(); + @if ((RowCollapsedDict.ContainsValue(true) && RowCollapsedDict.GetValueOrDefault(index)) + && i - 1 > 0 && ItemTableList.ElementAt(i).Col > ItemTableList.ElementAt(index-1).Col){ + continue; } else { - @FillTable(i, j) + CompileStep cs = CompileStep.Frame; + int row = i; + int ind = -1; + string s = "Vai a step "; + @if (j + 1 == ItemTableList[i].Col) + { + @if (ItemTableList[i].Type is Json.WindowConst.AreaTypes.FRAME) + { + cs = CompileStep.Frame; + s = s + cs.ToString(); + } + else if (ItemTableList[i].Type is Json.WindowConst.AreaTypes.SPLIT) + { + cs = CompileStep.Split; + ind = ItemTableList[i].IndexItem; + s = s + cs.ToString() + ((ind + 1) > 0 ? (ind + 1): ""); + } + else if (ItemTableList[i].Type is Json.WindowConst.AreaTypes.SASH) + { + cs = CompileStep.Sash; + ind = ItemTableList[i].IndexItem; + s = s + cs.ToString() + ((ind + 1) > 0 ? (ind + 1) : ""); + } + else if (ItemTableList[i].Type is Json.WindowConst.AreaTypes.FILL) + { + cs = CompileStep.Fill; + ind = ItemTableList[i].IndexItem; + s = s + cs.ToString() + ((ind + 1) > 0 ? (ind + 1) : ""); + } + + + + RaiseNextStep(cs, ind)" title="@(s)" + style="font-size: 1rem;"> + @ItemTableList[i].Desc + + + @if (ItemTableList[row].NumChild > 4) + { + + ChangeCollapsed(ItemTableList[row].Row)" + style="--bs-btn-padding-y: .25rem; --bs-btn-padding-x: .5rem; --bs-btn-font-size: .75rem;"> + + + + @* changeCollapsed(ItemTableList[row].Row)"> + + *@ + } + @* + + + + *@ + + @* @if (ItemTableList[i].Type is Json.WindowConst.AreaTypes.SASH || + ItemTableList[i].Type is Json.WindowConst.AreaTypes.SPLIT) + { + Remove(cs, ind)" title="Remove">Canc + } *@ + + } + else + { + @FillTable(i, j) + } } } diff --git a/WebWindowComplex/Compo/CardTree.razor.cs b/WebWindowComplex/Compo/CardTree.razor.cs index ad4d1b5..233d574 100644 --- a/WebWindowComplex/Compo/CardTree.razor.cs +++ b/WebWindowComplex/Compo/CardTree.razor.cs @@ -22,24 +22,106 @@ namespace WebWindowComplex.Compo [Parameter] public int maxCol { get; set; } = 0; + /// + /// Dizionario con elementi che possono collassare + /// + [Parameter] + public Dictionary RowCollapsedDict { get; set; } = new Dictionary(); + + /// + /// Dizionario con numero di figli per elementi che possono collassare + /// + [Parameter] + public Dictionary ChildDict { get; set; } = new Dictionary(); + /// /// Evento richiesta prossimo step /// [Parameter] public EventCallback EC_NextStep { get; set; } + /// + /// Evento aggiornamento dizionari per collasso righe + /// + [Parameter] + public EventCallback> EC_Collapsed { get; set; } + /// /// Metodo per richiesta prossimo step /// /// - private async Task RaiseNextStep(CompileStep cs, int indexStep) + private Task RaiseNextStep(CompileStep cs, int indexStep) { var Args = new DataNextStep { currCompileStep = cs, index = indexStep, }; - await EC_NextStep.InvokeAsync(Args); + return EC_NextStep.InvokeAsync(Args); + } + + //private Dictionary RowCollapsedDict { get; set; } = new Dictionary(); + //private Dictionary Child { get; set; } = new Dictionary(); + + //protected override void OnAfterRender(bool firstRender) + //{ + // if (firstRender) + // { + // foreach (var key in RowCollapsedDict.Keys.ToList()) + // { + // RowCollapsedDict[key] = false; + // Child[key] = -1; + // } + // //for (int i = 0; i < ItemTableList.Count; i++) + // //{ + // // for (int j = 0; j < maxCol; j++) + // // { + // // if (j + 1 == ItemTableList[i].Col) + // // { + // // TableList.Add(new DataTable + // // { + // // item = ItemTableList[i], + // // row = i, + // // col = j, + // // hidden = false + // // }); + // // } + // // else + // // { + // // FillTable(i, j); + // // } + // // } + // //} + // } + //} + + //protected override void OnParametersSet() + //{ + // RowCollapsedDict.Clear(); + // Child.Clear(); + // foreach (var item in ItemTableList) + // { + // if(item.NumChild > 4) + // { + // RowCollapsedDict.Add(item.Row, false); + // Child.Add(item.Row, item.NumChild); + // } + // } + //} + + /// + /// Metodo per aprire/chiudere sottorighe + /// + /// + private Task ChangeCollapsed(int row) + { + RowCollapsedDict[row] = RowCollapsedDict[row] ? false : true; + return EC_Collapsed.InvokeAsync(RowCollapsedDict); + } + + private string hwIcon(int row) + { + return RowCollapsedDict[row] ? "fa-solid fa-chevron-down" : "fa-solid fa-chevron-up"; } //private async Task Remove(CompileStep cs, int indexStep) @@ -136,6 +218,157 @@ namespace WebWindowComplex.Compo return " "; } } + + private bool HideRow(int row, int col) + { + List itemSameCol = new List(); + for (int k = 0; k < row; k++) + { + if (ItemTableList[k].Col == col + 1) + { + itemSameCol.Add(ItemTableList[k]); + } + continue; + } + if(itemSameCol.Count > 0) + return RowCollapsedDict.GetValueOrDefault(itemSameCol.First().Row - 1); + return false; + } + + // private void FillTable(int row, int col) + // { + // List itemSameCol = new List(); + // for (int k = 0; k < row; k++) + // { + // if (ItemTableList[k].Col == col + 1) + // { + // itemSameCol.Add(ItemTableList[k]); + // } + // continue; + // } + // int numItemNextCol = 0; + // for (int k = 0; k < row; k++) + // { + // if (ItemTableList[k].Row <= row && ItemTableList[k].Col == col + 2) + // { + // numItemNextCol++; + // } + // continue; + // } + // if (itemSameCol.Count > 1) + // { + // for (int i = 0; i <= itemSameCol.Count - 2; i++) + // { + // if (itemSameCol[i].NumChild > 0) + // numItemNextCol = numItemNextCol - itemSameCol[i].NumChild; + // } + // } + // if (itemSameCol.Count > 0) + // { + // // Sono alla riga successiva di un elemento e nella stessa colonna + // if (itemSameCol.Last().Row == row) + // { + // // se ha un solo figlio + // if (itemSameCol.Last().NumChild == 1) + // { + // TableList.Add(new DataTable + // { + // symbol = "â””", + // row = row, + // col = col, + // hidden = false + // }); + // } + // else if (itemSameCol.Last().NumChild == 0) + // { + // TableList.Add(new DataTable + // { + // symbol = " ", + // row = row, + // col = col, + // hidden = false + // }); + // } + // else + // { + // TableList.Add(new DataTable + // { + // symbol = "├", + // row = row, + // col = col, + // hidden = false + // }); + // } + // } + // // Non sono alla riga successiva + // else + // { + // // se ha un solo figlio + // if (itemSameCol.Last().NumChild == 1) + // { + // TableList.Add(new DataTable + // { + // symbol = " ", + // row = row, + // col = col, + // hidden = false + // }); + // } + // else if (col + 2 <= maxCol && ItemTableList[row].Col == col + 2) + // { + // if (numItemNextCol < itemSameCol.Last().NumChild && numItemNextCol != (itemSameCol.Last().NumChild - 1)) + // { + // TableList.Add(new DataTable + // { + // symbol = "├", + // row = row, + // col = col, + // hidden = false + // }); + // } + // TableList.Add(new DataTable + // { + // symbol = "â””", + // row = row, + // col = col, + // hidden = false + // }); + // } + // else if (numItemNextCol < itemSameCol.Last().NumChild) + // { + // TableList.Add(new DataTable + // { + // symbol = "│", + // row = row, + // col = col, + // hidden = false + // }); + // } + // else + // { + // TableList.Add(new DataTable + // { + // symbol = " ", + // row = row, + // col = col, + // hidden = false + // }); + // } + // } + // } + // else + // { + // TableList.Add(new DataTable + // { + // symbol = " ", + // row = row, + // col = col, + // hidden = false + // }); + // } + // } + //} + } /// @@ -146,4 +379,5 @@ namespace WebWindowComplex.Compo public CompileStep currCompileStep { get; set; } public int index { get; set; } } + } diff --git a/WebWindowComplex/Compo/EditElement.razor.cs b/WebWindowComplex/Compo/EditElement.razor.cs index 14fd91c..ba82bbd 100644 --- a/WebWindowComplex/Compo/EditElement.razor.cs +++ b/WebWindowComplex/Compo/EditElement.razor.cs @@ -30,7 +30,7 @@ namespace WebWindowComplex.Compo #region Private Properties /// - /// Metodo per aggiornare element corrente + /// Metodo per aggiornare nome element corrente /// private string name() { diff --git a/WebWindowComplex/Compo/EditSplitElement.razor b/WebWindowComplex/Compo/EditSplitElement.razor index d120612..2b7c6fa 100644 --- a/WebWindowComplex/Compo/EditSplitElement.razor +++ b/WebWindowComplex/Compo/EditSplitElement.razor @@ -1,6 +1,6 @@ @using static WebWindowComplex.LayoutConst - @name() + @CurrRec.nIndex @if (User) { diff --git a/WebWindowComplex/Compo/EditSplitElement.razor.cs b/WebWindowComplex/Compo/EditSplitElement.razor.cs index 2a94a83..8256c5d 100644 --- a/WebWindowComplex/Compo/EditSplitElement.razor.cs +++ b/WebWindowComplex/Compo/EditSplitElement.razor.cs @@ -8,7 +8,7 @@ namespace WebWindowComplex.Compo #region Public Properties /// - /// Joint corrente + /// Element corrente /// [Parameter] public SplitElementDimension CurrRec { get; set; } = null!; @@ -42,14 +42,15 @@ namespace WebWindowComplex.Compo } } } - private string name() - { - string ans = ""; - if (CurrRec.nSubArea > 0) - ans = ans + "A:" + CurrRec.nSubArea + ", "; - ans = ans + "N:" + CurrRec.nIndex; - return ans; - } + + //private string name() + //{ + // string ans = ""; + // if (CurrRec.nSubArea > 0) + // ans = ans + "A:" + CurrRec.nSubArea + ", "; + // ans = ans + "N:" + CurrRec.nIndex; + // return ans; + //} #endregion Private Properties } diff --git a/WebWindowComplex/Compo/FrameBottomRail.razor.cs b/WebWindowComplex/Compo/FrameBottomRail.razor.cs index bf3abbe..ff50155 100644 --- a/WebWindowComplex/Compo/FrameBottomRail.razor.cs +++ b/WebWindowComplex/Compo/FrameBottomRail.razor.cs @@ -21,7 +21,7 @@ namespace WebWindowComplex.Compo #region Private Properties /// - /// Aggiornamento element + /// Aggiornamento element Bottom Rail /// /// /// diff --git a/WebWindowComplex/Compo/SashBottomRail.razor.cs b/WebWindowComplex/Compo/SashBottomRail.razor.cs index 37a7306..4846335 100644 --- a/WebWindowComplex/Compo/SashBottomRail.razor.cs +++ b/WebWindowComplex/Compo/SashBottomRail.razor.cs @@ -14,7 +14,7 @@ namespace WebWindowComplex.Compo public Sash SashGroup { get; set; } = null!; [Parameter] - public EventCallback EC_UpdateSash { get; set; } + public EventCallback EC_UpdateSash { get; set; } #endregion Public Properties @@ -33,12 +33,7 @@ namespace WebWindowComplex.Compo if (updRec != null) { currRec = updRec; - DataUpdateProfile ans = new DataUpdateProfile - { - sash = SashGroup, - reqProfile = false - }; - await EC_UpdateSash.InvokeAsync(ans); + await EC_UpdateSash.InvokeAsync(SashGroup); } } diff --git a/WebWindowComplex/DTO/LivePayload.cs b/WebWindowComplex/DTO/LivePayload.cs index 9d00a07..946b8b3 100644 --- a/WebWindowComplex/DTO/LivePayload.cs +++ b/WebWindowComplex/DTO/LivePayload.cs @@ -61,7 +61,7 @@ namespace WebWindowComplex.DTO return false; if (!DictUtils.DictAreEqual(DictShape, item.DictShape)) return false; - if (ProfElementList.Count == item.ProfElementList.Count && !ProfElementList.OrderBy(x => x).SequenceEqual(item.ProfElementList.OrderBy(x => x))) + if (ProfElementList.Count != item.ProfElementList.Count || !ProfElementList.OrderBy(x => x.GroupId).SequenceEqual(item.ProfElementList.OrderBy(x => x.GroupId))) return false; return true; } diff --git a/WebWindowComplex/Json/JsonUtility.cs b/WebWindowComplex/Json/JsonUtility.cs index b8cecc9..32e9ffa 100644 --- a/WebWindowComplex/Json/JsonUtility.cs +++ b/WebWindowComplex/Json/JsonUtility.cs @@ -305,13 +305,23 @@ namespace WebWindowComplex.Json newFrame.SetSelThresholdFromName(m_Threshold); newFrame.SetBottomRail(m_bBottomRail); newFrame.SetBottomRailQty(m_nBottomRailQty); - for (int i = 0; i < m_nBottomRailQty; i++) + if(m_nBottomRailQty > 1) { - newFrame.BottomRailElemDimList.Add(new ElementDimension(newFrame, BottomRailElemDimList[i].Index, BottomRailElemDimList[i].Value)); - newFrame.BottomRailElemDimList.ElementAt(i).SetNameElement("Frame_Rail_Bottom"); + for (int i = 0; i < m_nBottomRailQty-1; i++) + { + newFrame.BottomRailElemDimList.Add(new ElementDimension(newFrame, BottomRailElemDimList[i].Index, BottomRailElemDimList[i].Value)); + newFrame.BottomRailElemDimList.ElementAt(i).SetNameElement("Frame_Rail"); + newFrame.BottomRailElemDimList.ElementAt(i).SetMinDimension(Window.m_ParameterList.GetValueOrDefault(newFrame.BottomRailElemDimList.ElementAt(i).sName + "_DimMin")); + newFrame.BottomRailElemDimList.ElementAt(i).SetMaxDimension(Window.m_ParameterList.GetValueOrDefault(newFrame.BottomRailElemDimList.ElementAt(i).sName + "_DimMax")); + } + } + if (m_nBottomRailQty > 0) + { + newFrame.BottomRailElemDimList.Add(new ElementDimension(newFrame, BottomRailElemDimList.Last().Index, BottomRailElemDimList.Last().Value)); + newFrame.BottomRailElemDimList.Last().SetNameElement("Frame_Fill_Rail"); + newFrame.BottomRailElemDimList.Last().SetMinDimension(Window.m_ParameterList.GetValueOrDefault(newFrame.BottomRailElemDimList.Last().sName + "_DimMin")); + newFrame.BottomRailElemDimList.Last().SetMaxDimension(Window.m_ParameterList.GetValueOrDefault(newFrame.BottomRailElemDimList.Last().sName + "_DimMax")); } - if(m_nBottomRailQty > 0) - newFrame.BottomRailElemDimList.ElementAt(m_nBottomRailQty - 1).SetNameElement("Frame_Fill_Rail"); //if(ArcElement != null) // newFrame.SetFrameArcElem(ArcElement.Deserialize(newFrame, ParentWindow)); //Frame.AppliedDone(); @@ -349,19 +359,19 @@ namespace WebWindowComplex.Json } } - //private bool m_bIsDimensionLight; - //[JsonProperty] - //public bool IsDimensionLight - //{ - // get - // { - // return m_bIsDimensionLight; - // } - // set - // { - // m_bIsDimensionLight = value; - // } - //} + private bool m_bIsDimensionLight; + [JsonProperty] + public bool IsDimensionLight + { + get + { + return m_bIsDimensionLight; + } + set + { + m_bIsDimensionLight = value; + } + } private List m_SashList = new List(); [JsonProperty] @@ -476,10 +486,10 @@ namespace WebWindowComplex.Json { } - public JsonSash(bool IsSashVertical, SashTypes SashType, bool SashBottomRail, int SashBottomRailQty, string Hardware, int GroupId) : base(AreaTypes.SASH) + public JsonSash(bool IsSashVertical, SashTypes SashType, bool SashBottomRail, int SashBottomRailQty, string Hardware, int GroupId, bool IsDimensionLight = false) : base(AreaTypes.SASH) { m_bIsSashVertical = IsSashVertical; - //m_bIsDimensionLight = IsDimensionLight; + m_bIsDimensionLight = IsDimensionLight; m_SashType = SashType; m_bBottomRail = SashBottomRail; m_nBottomRailQty = SashBottomRailQty; @@ -492,18 +502,28 @@ namespace WebWindowComplex.Json Sash newSash = new Sash(ParentArea, ParentWindow); newSash.SetGroupId(GroupId); newSash.SetAreaType(AreaTypes.SASH); - //newSash.SetIsDimensionLight(IsDimensionLight); + newSash.SetIsDimensionLight(IsDimensionLight); newSash.SetSashQty(m_SashList.Count); newSash.SetIsSashVertical(m_bIsSashVertical); newSash.SetSashBottomRail(m_bBottomRail); newSash.SetSashBottomRailQty(m_nBottomRailQty); - for(int i = 0; i < m_nBottomRailQty; i++) + if (m_nBottomRailQty > 1) { - newSash.BottomRailElemDimList.Add(new ElementDimension(newSash, BottomRailElemDimList[i].Index, BottomRailElemDimList[i].Value)); - newSash.BottomRailElemDimList.ElementAt(i).SetNameElement("Sash_Rail_Bottom"); + for (int i = 0; i < m_nBottomRailQty - 1; i++) + { + newSash.BottomRailElemDimList.Add(new ElementDimension(newSash, BottomRailElemDimList[i].Index, BottomRailElemDimList[i].Value)); + newSash.BottomRailElemDimList.ElementAt(i).SetNameElement("Sash_Rail"); + newSash.BottomRailElemDimList.ElementAt(i).SetMinDimension(Window.m_ParameterList.GetValueOrDefault(newSash.BottomRailElemDimList.ElementAt(i).sName + "_DimMin")); + newSash.BottomRailElemDimList.ElementAt(i).SetMaxDimension(Window.m_ParameterList.GetValueOrDefault(newSash.BottomRailElemDimList.ElementAt(i).sName + "_DimMax")); + } } if (m_nBottomRailQty > 0) - newSash.BottomRailElemDimList.ElementAt(m_nBottomRailQty - 1).SetNameElement("Sash_Fill_Rail"); + { + newSash.BottomRailElemDimList.Add(new ElementDimension(newSash, BottomRailElemDimList.Last().Index, BottomRailElemDimList.Last().Value)); + newSash.BottomRailElemDimList.Last().SetNameElement("Sash_Fill_Rail"); + newSash.BottomRailElemDimList.Last().SetMinDimension(Window.m_ParameterList.GetValueOrDefault(newSash.BottomRailElemDimList.Last().sName + "_DimMin")); + newSash.BottomRailElemDimList.Last().SetMaxDimension(Window.m_ParameterList.GetValueOrDefault(newSash.BottomRailElemDimList.Last().sName + "_DimMax")); + } for (var SashIndex = 0; SashIndex <= m_SashList.Count - 1; SashIndex++) { newSash.SashList[SashIndex].SetOpeningType(m_SashList[SashIndex].OpeningType); @@ -641,7 +661,9 @@ namespace WebWindowComplex.Json split.SplitVertList[SplitIndex].SetDimension(m_SplitVertList[SplitIndex].Dimension); split.SplitVertList[SplitIndex].SetMeasureType(m_SplitVertList[SplitIndex].MeasureType); } - for (int index = 0; index < ElementDimVertList.Count; index++) + int subAreaMin = ElementDimVertList.Min(x => x.Area); + List vertList = ElementDimVertList.Where(x => x.Area == subAreaMin).ToList(); + for (int index = 0; index < vertList.Count; index++) { split.ElemDimVertList.ElementAt(index).SetSubArea(m_ElemDimVertList[index].Area); split.ElemDimVertList.ElementAt(index).SetIndex(m_ElemDimVertList[index].Index); @@ -659,7 +681,9 @@ namespace WebWindowComplex.Json split.SplitHorizList[SplitIndex].SetDimension(m_SplitHorizList[SplitIndex].Dimension); split.SplitHorizList[SplitIndex].SetMeasureType(m_SplitHorizList[SplitIndex].MeasureType); } - for (int index = 0; index < ElementDimHorizList.Count; index++) + int subAreaMin = ElementDimHorizList.Min(x => x.Area); + List horizList = ElementDimHorizList.Where(x => x.Area == subAreaMin).ToList(); + for (int index = 0; index < horizList.Count; index++) { split.ElemDimHorizList.ElementAt(index).SetSubArea(m_ElemDimHorizList[index].Area); split.ElemDimHorizList.ElementAt(index).SetIndex(m_ElemDimHorizList[index].Index); diff --git a/WebWindowComplex/Models/Area.cs b/WebWindowComplex/Models/Area.cs index 1b521e9..46ea61b 100644 --- a/WebWindowComplex/Models/Area.cs +++ b/WebWindowComplex/Models/Area.cs @@ -1,4 +1,5 @@ using System.ComponentModel.Design; +using System.Linq; using WebWindowComplex.Json; using static WebWindowComplex.Json.WindowConst; @@ -101,9 +102,18 @@ namespace WebWindowComplex.Models public void AddFirstSash() { // Salvo il parent - Area ParentArea = AreaList[0].ParentArea; + if(this is Frame || ParentArea.AreaList.Last().Equals(this)) + { + Frame f = null; + if (this is Frame) + f = (Frame)this; + else + f = (Frame)ParentWindow.AreaList.First(); + f.BottomRailQty = 0; + f.BottomRailElemDimList.Clear(); + } // Creo area sash di default - Sash SashArea = Sash.CreateSash(ParentArea); + Sash SashArea = Sash.CreateSash(this); // Inserisco famiglia hardware vuota SashArea.SetSelFamilyHardware(""); // Inserisco hardware di default @@ -249,7 +259,7 @@ namespace WebWindowComplex.Models Sash s = (Sash)node; List dimList = new List(); foreach (var item in s.SashList) - dimList.Add(new AreaDimension(item.dDimension, item.MeasureType)); + dimList.Add(new AreaDimension(item.dDimension, item.MeasureType, item.Parent)); if(nameDim.Equals("Width")) SearchAreaList(node.AreaList.ElementAt(i), s.SashList.ElementAt(i).CalculateAbsoluteValue(dimList, dim), nameDim); else @@ -262,7 +272,7 @@ namespace WebWindowComplex.Models if (s.SplitHorizList.Count > 0 && i < s.SplitHorizList.Count) { foreach (var item in s.SplitHorizList) - dimList.Add(new AreaDimension(item.dDimension, item.MeasureType)); + dimList.Add(new AreaDimension(item.dDimension, item.MeasureType, item.Parent)); if(nameDim.Equals("Width")) SearchAreaList(node.AreaList.ElementAt(i), dim, nameDim); else @@ -271,7 +281,7 @@ namespace WebWindowComplex.Models if (s.SplitVertList.Count > 0 && i < s.SplitVertList.Count) { foreach (var item in s.SplitVertList) - dimList.Add(new AreaDimension(item.dDimension, item.MeasureType)); + dimList.Add(new AreaDimension(item.dDimension, item.MeasureType, item.Parent)); if(nameDim.Equals("Width")) SearchAreaList(node.AreaList.ElementAt(i), s.SplitVertList.ElementAt(i).CalculateAbsoluteValue(dimList, dim), nameDim); else @@ -279,7 +289,21 @@ namespace WebWindowComplex.Models } } else - SearchAreaList(node.AreaList.ElementAt(i), dim, nameDim); + { + //Frame? f = node.ParentWindow.AreaList.First(); + //double dimAvail = 0; + //if (nameDim.Equals("Width")) + // dimAvail = dim - f.ElementDimensionList.ElementAt(1).dDimension + // - f.ElementDimensionList.Last().dDimension + // + f.ElementDimensionList.ElementAt(1).dOverlap + // + f.ElementDimensionList.Last().dOverlap; + //else + // dimAvail = dim - f.ElementDimensionList.First().dDimension + // - f.ElementDimensionList.ElementAt(f.ElementDimensionList.Count - 2).dDimension + // + f.ElementDimensionList.First().dOverlap + // + f.ElementDimensionList.ElementAt(f.ElementDimensionList.Count - 2).dOverlap; + SearchAreaList(node.AreaList.ElementAt(i), dim, nameDim); + } } } } @@ -298,23 +322,38 @@ namespace WebWindowComplex.Models split = (Split)sash.ParentArea.ParentArea; if (sash.ParentArea is Frame || (sash.ParentArea.ParentArea is Split && split.SplitHorizList.Count > 0)) { - Frame frame = new Frame(null, null); - if(split.SplitHorizList.Count > 0) - frame = (Frame)sash.ParentArea.ParentArea.ParentArea; - else - frame = (Frame)sash.ParentArea; - foreach (var i in frame.DimensionList) - dimList.Add(new AreaDimension(i.dDimension, i.SelMeasureType)); + Frame? frame = sash.m_ParentWindow.AreaList.FirstOrDefault(); + if(frame != null) + { + foreach (var i in frame.DimensionList) + dimList.Add(new AreaDimension(i.dDimension, i.SelMeasureType, i.Parent)); + } } else { - //Split s = (Split)sash.ParentArea.ParentArea; foreach (var i in split.SplitVertList) - dimList.Add(new AreaDimension(i.dDimension, i.SelMeasureType)); + dimList.Add(new AreaDimension(i.dDimension, i.SelMeasureType, i.Parent)); } if (countAbsolute == sash.SashList.Count) { double sum = sash.SashList.Sum(x => x.dDimension); + if (sash.bIsDimensionLight) + { + dim = dim - sash.SashList.First().ElementDimensionList.ElementAt(1).dDimension + - sash.SashList.First().ElementDimensionList.Last().dDimension; + for (int i = 1; i < sash.SashList.Count; i++) + { + dim = dim - sash.SashList[i].ElementDimensionList.ElementAt(1).dDimension + - sash.SashList[i].ElementDimensionList.Last().dDimension + + sash.SashList[i].ElementDimensionList.Last().dOverlap; + } + } + else + { + for (int i = 1; i < sash.SashList.Count; i++) + dim = dim + sash.SashList[i].ElementDimensionList.Last().dOverlap + + sash.SashList.First().ElementDimensionList.Last().dOverlap; + } double res = dim - sum; if (res > 0) { @@ -323,7 +362,7 @@ namespace WebWindowComplex.Models sashDim.SetDimension(sashDim.dDimension + res / countAbsolute); } } - else + else if (res < 0) { foreach (var sashDim in sash.SashList) { @@ -349,14 +388,23 @@ namespace WebWindowComplex.Models { Split split = (Split)area; List splitList = new List(); + double sum = 0; if (nameDim.Equals("Width")) + { splitList = split.SplitVertList; + foreach (var item in split.ElemDimVertList) + sum = sum + item.dDimension; + } else + { splitList = split.SplitHorizList; + foreach (var item in split.ElemDimHorizList) + sum = sum + item.dDimension; + } int countAbsolute = splitList.Where(x => x.MeasureType.Equals(MeasureTypes.ABSOLUTE)).Count(); if (countAbsolute != 0 && countAbsolute == splitList.Count) { - double sum = splitList.Sum(x => x.dDimension); + sum = sum + splitList.Sum(x => x.dDimension); double res = 0; res = dim - sum; if (res > 0) @@ -405,7 +453,7 @@ namespace WebWindowComplex.Models List adList = new List(); foreach (var it in sashGroup.SashList) { - adList.Add(new AreaDimension(it.dDimension, it.SelMeasureType)); + adList.Add(new AreaDimension(it.dDimension, it.SelMeasureType, it.Parent)); } //Somma misura non proporzionali double sumNotProp = sashGroup.SashList @@ -442,7 +490,7 @@ namespace WebWindowComplex.Models List adList = new List(); foreach (var it in splitList) { - adList.Add(new AreaDimension(it.dDimension, it.SelMeasureType)); + adList.Add(new AreaDimension(it.dDimension, it.SelMeasureType, it.Parent)); } //Somma misura non proporzionali double sumNotProp = splitList diff --git a/WebWindowComplex/Models/AreaDimension.cs b/WebWindowComplex/Models/AreaDimension.cs index 43662ac..4d97fb7 100644 --- a/WebWindowComplex/Models/AreaDimension.cs +++ b/WebWindowComplex/Models/AreaDimension.cs @@ -11,11 +11,11 @@ namespace WebWindowComplex.Models { #region Public Constructors - public AreaDimension(double dDimension, MeasureTypes MeasureType) + public AreaDimension(double dDimension, MeasureTypes MeasureType, Area Parent) { m_dDimension = dDimension; m_SelMeasureType = MeasureType; - //m_Parent = Parent; + m_Parent = Parent; } #endregion Public Constructors @@ -34,17 +34,17 @@ namespace WebWindowComplex.Models } } - //public Area Parent - //{ - // get - // { - // return m_Parent; - // } - // set - // { - // m_Parent = value; - // } - //} + public Area Parent + { + get + { + return m_Parent; + } + set + { + m_Parent = value; + } + } public MeasureTypes MeasureType { @@ -105,7 +105,7 @@ namespace WebWindowComplex.Models protected MeasureTypes m_SelMeasureType; // reference - // protected Area m_Parent; + protected Area m_Parent; #endregion Private Fields @@ -122,7 +122,7 @@ namespace WebWindowComplex.Models /// Vecchio tipo /// Nuovo tipo /// - public double ConvertDimension(List itemList, MeasureTypes oldType, MeasureTypes newType, double widthTot, int indexSash) + public double ConvertDimension(List itemList, MeasureTypes oldType, MeasureTypes newType, double widthTot, int indexSash, double overlap) { switch (oldType) { @@ -131,7 +131,7 @@ namespace WebWindowComplex.Models if (newType.Equals(MeasureTypes.PERCENTAGE)) { //return Double.Round((m_dDimension / m_Parent.Width) * 100, 1); - return (dDimension / widthTot) * 100; + return (dDimension / widthTot) * 100; } else { @@ -250,6 +250,23 @@ namespace WebWindowComplex.Models case MeasureTypes.ABSOLUTE: { //return Double.Round(dDimension, 2); + double overlapElem = 0; + if (m_Parent is Sash) + { + // Calcolo overlap + Sash s = (Sash)m_Parent; + int indexSash = -1; + if (this is SashDimension) + { + SashDimension sashDimCurr = (SashDimension)this; + indexSash = s.SashList.IndexOf(sashDimCurr); + } + else + indexSash = itemList.IndexOf(this); + int indElem = indexSash == 0 ? 1 : s.SashList.ElementAt(indexSash).ElementDimensionList.Count - 1; + if (!s.bIsDimensionLight) + overlapElem = s.SashList.ElementAt(indexSash).ElementDimensionList.ElementAt(indElem).dOverlap / 2; + } return dDimension; } case MeasureTypes.PROPORTIONAL: diff --git a/WebWindowComplex/Models/ElementDimension.cs b/WebWindowComplex/Models/ElementDimension.cs index 7798ab5..2047e21 100644 --- a/WebWindowComplex/Models/ElementDimension.cs +++ b/WebWindowComplex/Models/ElementDimension.cs @@ -34,6 +34,32 @@ namespace WebWindowComplex.Models { if(dDimension != value) { + if(m_ParentArea is Split) + { + if (value > m_dMax) + value = m_dMax; + else if (value < m_dMin) + value = m_dMin; + Split s = (Split)m_ParentArea; + SplitElementDimension splitElem = (SplitElementDimension)this; + List elemList = new List(); + if (s.ElemDimVertList.Contains(splitElem)) + elemList = s.SplitVertList; + else if (s.ElemDimHorizList.Contains(splitElem)) + elemList = s.SplitHorizList; + if (value > m_dDimension) + { + double diff = (value - m_dDimension)/2; + elemList.ElementAt(m_nIndex - 1).SetDimension(elemList.ElementAt(m_nIndex - 1).dDimension - diff); + elemList.ElementAt(m_nIndex ).SetDimension(elemList.ElementAt(m_nIndex).dDimension - diff); + } + else + { + double diff = (m_dDimension - value)/2; + elemList.ElementAt(m_nIndex - 1).SetDimension(elemList.ElementAt(m_nIndex - 1).dDimension + diff); + elemList.ElementAt(m_nIndex).SetDimension(elemList.ElementAt(m_nIndex).dDimension + diff); + } + } if (value > m_dMax) m_dDimension = m_dMax; else if (value < m_dMin) diff --git a/WebWindowComplex/Models/Frame.cs b/WebWindowComplex/Models/Frame.cs index e5fae04..92c3454 100644 --- a/WebWindowComplex/Models/Frame.cs +++ b/WebWindowComplex/Models/Frame.cs @@ -97,17 +97,36 @@ namespace WebWindowComplex.Models } set { - if (m_nBottomRailQty >= 0) + if (value >= 0) { if(value > m_nBottomRailQty) { - // Aggiungo un element + // Aggiungo un element in coda BottomRailElemDimList.Add(new ElementDimension(this, BottomRailElemDimList.Count + 1, 78)); + BottomRailElemDimList.Last().SetNameElement("Frame_Fill_Rail"); + BottomRailElemDimList.Last().SetMinDimension(Window.m_ParameterList.GetValueOrDefault(BottomRailElemDimList.Last().sName + "_DimMin")); + BottomRailElemDimList.Last().SetMaxDimension(Window.m_ParameterList.GetValueOrDefault(BottomRailElemDimList.Last().sName + "_DimMax")); + BottomRailElemDimList.Last().SetDimension(Window.m_ParameterList.GetValueOrDefault(BottomRailElemDimList.Last().sName + "_DimStd")); + if (value > 1 && BottomRailElemDimList.Count - 2 >= 0) + { + BottomRailElemDimList.ElementAt(BottomRailElemDimList.Count - 2).SetNameElement("Frame_Rail"); + BottomRailElemDimList.ElementAt(BottomRailElemDimList.Count - 2).SetMinDimension(Window.m_ParameterList.GetValueOrDefault(BottomRailElemDimList.ElementAt(BottomRailElemDimList.Count - 2).sName + "_DimMin")); + BottomRailElemDimList.ElementAt(BottomRailElemDimList.Count - 2).SetMaxDimension(Window.m_ParameterList.GetValueOrDefault(BottomRailElemDimList.ElementAt(BottomRailElemDimList.Count - 2).sName + "_DimMax")); + BottomRailElemDimList.ElementAt(BottomRailElemDimList.Count - 2).SetDimension(BottomRailElemDimList.ElementAt(BottomRailElemDimList.Count - 2).dDimension); + } } else if (value < m_nBottomRailQty) { - // Elimino un element - BottomRailElemDimList.RemoveAt(BottomRailElemDimList.Count - 1); + // Elimino gli element + for(int i = BottomRailElemDimList.Count-1; i == value; i--) + BottomRailElemDimList.RemoveAt(i); + if (value >= 1) + { + BottomRailElemDimList.Last().SetNameElement("Frame_Fill_Rail"); + BottomRailElemDimList.Last().SetMinDimension(Window.m_ParameterList.GetValueOrDefault(BottomRailElemDimList.Last().sName + "_DimMin")); + BottomRailElemDimList.Last().SetMaxDimension(Window.m_ParameterList.GetValueOrDefault(BottomRailElemDimList.Last().sName + "_DimMax")); + BottomRailElemDimList.Last().SetDimension(BottomRailElemDimList.Last().dDimension); + } } m_nBottomRailQty = value; if (value > 0) @@ -163,7 +182,7 @@ namespace WebWindowComplex.Models if (m_Shape != (Shapes)value) { Shapes oldShape = m_Shape; - Shapes SelShape = (Shapes)value; + m_Shape = (Shapes)value; // salvo vecchie dimensioni List oldDimensionList = new List(DimensionList); // verifico parametri Dimension @@ -171,15 +190,15 @@ namespace WebWindowComplex.Models //double widthVal = oldDimensionList.Where(x => x.sName.Equals("Width")).Select(x => x.dValue).First(); double widthVal = oldDimensionList.Where(x => x.sName.Equals("Width")).Select(x => x.dDimension).First(); // aggiungo Dimensioni - switch (SelShape) + switch (m_Shape) { case Shapes.RECTANGLE: case Shapes.ARC_FULL: { DimensionList.Add(new FrameDimension(this, 1, "Width", widthVal, true)); DimensionList.Add(new FrameDimension(this, 2, "Height", 1400, true)); - foreach (var dim in DimensionList) - SearchAreaList(this, dim.dDimension, dim.sName); + SearchAreaList(this, AvailWidthArea(), "Width"); + SearchAreaList(this, AvailHeightArea(), "Height"); break; } @@ -188,8 +207,8 @@ namespace WebWindowComplex.Models DimensionList.Add(new FrameDimension(this, 1, "Width", widthVal, true)); DimensionList.Add(new FrameDimension(this, 2, "Left Height", 1800, true)); DimensionList.Add(new FrameDimension(this, 3, "Right Height", 1500, true)); - SearchAreaList(this, widthVal, "Width"); - SearchAreaList(this, 1800, "Left Height"); + SearchAreaList(this, AvailWidthArea(), "Width"); + SearchAreaList(this, AvailHeightArea(), "Left Height"); break; } @@ -198,8 +217,8 @@ namespace WebWindowComplex.Models DimensionList.Add(new FrameDimension(this, 1, "Width", widthVal, true)); DimensionList.Add(new FrameDimension(this, 2, "Left Height", 1500, true)); DimensionList.Add(new FrameDimension(this, 3, "Right Height", 1800, true)); - SearchAreaList(this, widthVal, "Width"); - SearchAreaList(this, 1800, "Right Height"); + SearchAreaList(this, AvailWidthArea(), "Width"); + SearchAreaList(this, AvailHeightArea(), "Right Height"); break; } @@ -209,8 +228,8 @@ namespace WebWindowComplex.Models DimensionList.Add(new FrameDimension(this, 1, "Width", widthVal, true)); DimensionList.Add(new FrameDimension(this, 2, "Height", 1800 - (0.4 * widthVal), true)); DimensionList.Add(new FrameDimension(this, 3, "Full Height", 1800, true)); - SearchAreaList(this, widthVal, "Width"); - SearchAreaList(this, 1800, "Full Height"); + SearchAreaList(this, AvailWidthArea(), "Width"); + SearchAreaList(this, AvailHeightArea(), "Full Height"); break; } @@ -219,8 +238,8 @@ namespace WebWindowComplex.Models DimensionList.Add(new FrameDimension(this, 1, "Width", widthVal, true)); DimensionList.Add(new FrameDimension(this, 2, "Height", 2400 - (0.6 * widthVal), true)); DimensionList.Add(new FrameDimension(this, 3, "Full Height", 2400, true)); - SearchAreaList(this, widthVal, "Width"); - SearchAreaList(this, 2400, "Full Height"); + SearchAreaList(this, AvailWidthArea(), "Width"); + SearchAreaList(this, AvailHeightArea(), "Full Height"); break; } @@ -230,8 +249,8 @@ namespace WebWindowComplex.Models DimensionList.Add(new FrameDimension(this, 2, "Height", 2400 - (0.4 * widthVal), true)); DimensionList.Add(new FrameDimension(this, 3, "Full Height", 2400, true)); DimensionList.Add(new FrameDimension(this, 4, "Radius", 200, true)); - SearchAreaList(this, 2000, "Width"); - SearchAreaList(this, 2400, "Full Height"); + SearchAreaList(this, AvailWidthArea(), "Width"); + SearchAreaList(this, AvailHeightArea(), "Full Height"); break; } @@ -240,8 +259,8 @@ namespace WebWindowComplex.Models DimensionList.Add(new FrameDimension(this, 1, "Width", widthVal, true)); DimensionList.Add(new FrameDimension(this, 2, "Height", 1500, true)); DimensionList.Add(new FrameDimension(this, 3, "Height projection", 0, true)); - SearchAreaList(this, widthVal, "Width"); - SearchAreaList(this, 1500, "Height"); + SearchAreaList(this, AvailWidthArea(), "Width"); + SearchAreaList(this, AvailHeightArea(), "Height"); break; } @@ -258,7 +277,7 @@ namespace WebWindowComplex.Models SearchSash(sashList, this); // aggiungo Joint m_JointList.Clear(); - switch (SelShape) + switch (m_Shape) { case Shapes.RECTANGLE: case Shapes.RIGHTCHAMFER: @@ -334,7 +353,6 @@ namespace WebWindowComplex.Models // break; // } //} - m_Shape = SelShape; } } } @@ -383,29 +401,41 @@ namespace WebWindowComplex.Models m_ThresholdList = m_AllThresholdList; } - public double HeightFrame() + public double AvailHeightArea() { + double dim = 0; switch (SelShapeIndex) { case (int)Shapes.RECTANGLE: case (int)Shapes.TRIANGLE: case (int)Shapes.ARC_FULL: { - return DimensionList.Where(x => x.sName == "Height").First().dDimension; + dim = DimensionList.Where(x => x.sName == "Height").First().dDimension; + break; } case (int)Shapes.RIGHTCHAMFER: { - return DimensionList.Where(x => x.sName == "Left Height").First().dDimension; + dim = DimensionList.Where(x => x.sName == "Left Height").First().dDimension; + break; } case (int)Shapes.LEFTCHAMFER: { - return DimensionList.Where(x => x.sName == "Right Height").First().dDimension; + dim = DimensionList.Where(x => x.sName == "Right Height").First().dDimension; + break; } default: { - return DimensionList.Where(x => x.sName == "Full Height").First().dDimension; + dim = DimensionList.Where(x => x.sName == "Full Height").First().dDimension; + break; } } + double overlap = 0; + if (AreaList.First() is Sash) + overlap = ElementDimensionList.First().dOverlap + + ElementDimensionList.ElementAt(ElementDimensionList.Count() - 2).dOverlap; + return dim - ElementDimensionList.ElementAt(0).dDimension - + ElementDimensionList.Last().dDimension + + overlap; } public override Frame Copy(Area ParentArea) @@ -413,6 +443,33 @@ namespace WebWindowComplex.Models return new Frame(null, ParentWindow); } + /// + /// Metodo per calcolare l'area disponibile + /// + /// + public double AvailWidthArea() + { + if (DimensionList.Count > 0 && DimensionList.FirstOrDefault(x => x.sName.Equals("Width")) != null) + { + double dim = DimensionList.FirstOrDefault(x => x.sName.Equals("Width"))!.dDimension; + double overlap = 0; + if(AreaList.First() is Sash) + overlap = ElementDimensionList.ElementAt(1).dOverlap + + ElementDimensionList.Last().dOverlap; + if (AreaList.First() is Split) + { + Split s = (Split)AreaList.First(); + if(s.SplitHorizList.Count > 0) + overlap = ElementDimensionList.ElementAt(1).dOverlap + + ElementDimensionList.Last().dOverlap; + } + return dim - ElementDimensionList.ElementAt(0).dDimension - + ElementDimensionList.Last().dDimension + + overlap; + } + return -1; + } + #endregion Public Methods #region Internal Methods @@ -642,24 +699,6 @@ namespace WebWindowComplex.Models } } - /// - /// Metodo per calcolare l'area disponibile - /// - /// - internal double AvailArea() - { - if(DimensionList.Count> 0 && DimensionList.FirstOrDefault(x => x.sName.Equals("Width")) != null) - { - // larghezza - elementDim(1) - elementDim(last) + overlapDd + overlapSx - return DimensionList.FirstOrDefault(x => x.sName.Equals("Width"))!.dDimension - - ElementDimensionList.ElementAt(1).dDimension - - ElementDimensionList.Last().dDimension + - ElementDimensionList.ElementAt(1).dOverlap + - ElementDimensionList.Last().dOverlap; - } - return -1; - } - #endregion Internal Methods #region Private Fields diff --git a/WebWindowComplex/Models/FrameDimension.cs b/WebWindowComplex/Models/FrameDimension.cs index da3f8ac..67a4a68 100644 --- a/WebWindowComplex/Models/FrameDimension.cs +++ b/WebWindowComplex/Models/FrameDimension.cs @@ -13,7 +13,7 @@ namespace WebWindowComplex.Models { #region Public Constructors - public FrameDimension(Frame ParentFrame, int nIndex, string sName, double dDimension, bool bIsLen) : base(dDimension, MeasureTypes.ABSOLUTE) + public FrameDimension(Frame ParentFrame, int nIndex, string sName, double dDimension, bool bIsLen) : base(dDimension, MeasureTypes.ABSOLUTE, ParentFrame) { m_ParentFrame = ParentFrame; m_nIndex = nIndex; @@ -123,10 +123,18 @@ namespace WebWindowComplex.Models } } } - if (ParentFrame.AreaList.Count > 0 && sName.Equals("Width")) - ParentFrame.SearchAreaList(ParentFrame, dDimension, "Width"); - else - ParentFrame.SearchAreaList(ParentFrame, dDimension, "Height"); + Frame? f = (Frame)Parent; + double dimAvail = 0; + if (ParentFrame.AreaList.Count > 0 && sName.Equals("Width") && f != null) + { + dimAvail = f.AvailWidthArea(); + ParentFrame.SearchAreaList(ParentFrame, dimAvail, "Width"); + } + else if(f != null) + { + dimAvail = f.AvailHeightArea(); + ParentFrame.SearchAreaList(ParentFrame, dimAvail, "Height"); + } } } } diff --git a/WebWindowComplex/Models/Sash.cs b/WebWindowComplex/Models/Sash.cs index 0695cf6..9daa17b 100644 --- a/WebWindowComplex/Models/Sash.cs +++ b/WebWindowComplex/Models/Sash.cs @@ -267,8 +267,17 @@ namespace WebWindowComplex.Models { if (value > 0 && value <= 3) { - double widthTot = CalculateWidthArea(ParentWindow.AreaList.First(), ParentWindow.AreaList.FirstOrDefault().DimensionList.Where(x => x.sName == "Width").First().dDimension); // TODO: width se anta è in un'area di split - //double widthTot = ((Frame)ParentArea).AvailArea(); + Frame frame = (Frame)ParentWindow.AreaList.First(); + double widthTot = 0; + if (bIsDimensionLight) + { + foreach (var item in m_SashList) + widthTot = widthTot + item.dDimension; + } + else + { + widthTot = CalculateWidthSashGroup(frame, frame.DimensionList.Where(x => x.sName == "Width").First().dDimension, new AreaFound(-1, false)).m_Dimension; + } if (value > m_SashList.Count) { // recupero larghezza ultimo @@ -277,9 +286,20 @@ namespace WebWindowComplex.Models if (m_SashList.Count > 0) { dLastDimension = m_SashList[m_SashList.Count - 1].dDimension; - dNewDimension = dLastDimension / (value + 1 - nSashQty); if (m_SashList[m_SashList.Count - 1].MeasureType.Equals(MeasureTypes.PROPORTIONAL)) dNewDimension = 1; + else if (m_SashList[m_SashList.Count - 1].MeasureType is MeasureTypes.PERCENTAGE) + dNewDimension = dLastDimension / (value + 1 - nSashQty); + else + { + if (bIsDimensionLight) + dNewDimension = (dLastDimension - m_SashList.Last().ElementDimensionList.ElementAt(1).dDimension + - m_SashList.Last().ElementDimensionList.Last().dDimension + + Window.m_ParameterList.GetValueOrDefault("Sash_Active_Overlap"))/2; + else + dNewDimension = dLastDimension / (value + 1 - nSashQty) + + (Window.m_ParameterList.GetValueOrDefault("Sash_Active_Overlap"))/2; + } m_SashList[m_SashList.Count - 1].SetDimension(dNewDimension); } else @@ -301,28 +321,37 @@ namespace WebWindowComplex.Models { double dLastDimension = 0; SashDimension itemDelete = new SashDimension(0, MeasureTypes.NULL, this, 0); - double deleteDim; + double deleteDim = 0; + double splitDelete = 0; for (var SplitIndex = m_SashList.Count - 1; SplitIndex >= value; SplitIndex += -1) { - //dLastDimension += m_SashList[SplitIndex].dDimension; itemDelete = m_SashList[SplitIndex]; + if(itemDelete.SelMeasureType is MeasureTypes.ABSOLUTE) + { + if (bIsDimensionLight) + splitDelete = m_SashList[m_SashList.Count - 2].ElementDimensionList.ElementAt(1).dDimension + + m_SashList.Last().ElementDimensionList.Last().dDimension + - m_SashList.Last().ElementDimensionList.Last().dOverlap; + else + splitDelete = - m_SashList.Last().ElementDimensionList.Last().dOverlap; + } SashList.RemoveAt(SplitIndex); } if (!itemDelete.SelMeasureType.Equals(m_SashList[SashList.Count - 1].SelMeasureType)) { - AreaDimension ad = new AreaDimension(itemDelete.dDimension, itemDelete.SelMeasureType); + AreaDimension ad = new AreaDimension(itemDelete.dDimension, itemDelete.SelMeasureType, itemDelete.Parent); List adList = new List(); foreach (var it in SashList) { - adList.Add(new AreaDimension(it.dDimension, it.SelMeasureType)); + adList.Add(new AreaDimension(it.dDimension, it.SelMeasureType, it.Parent)); } - deleteDim = ad.ConvertDimension(adList, itemDelete.SelMeasureType, m_SashList[SashList.Count - 1].SelMeasureType, widthTot, m_SashList.IndexOf(itemDelete)); + deleteDim = ad.ConvertDimension(adList, itemDelete.SelMeasureType, m_SashList[SashList.Count - 1].SelMeasureType, widthTot, m_SashList.IndexOf(itemDelete), SashList.Last().ElementDimensionList.Last().dOverlap); } else { deleteDim = itemDelete.dDimension; } - dLastDimension = deleteDim + m_SashList[SashList.Count - 1].dDimension; + dLastDimension = deleteDim + m_SashList[SashList.Count - 1].dDimension + splitDelete; SashList[SashList.Count - 1].SetDimension(dLastDimension); if (value == 1) SashList.First().SetHasHandle(true); @@ -451,11 +480,30 @@ namespace WebWindowComplex.Models { // Aggiungo un element BottomRailElemDimList.Add(new ElementDimension(this, BottomRailElemDimList.Count + 1, 78)); + BottomRailElemDimList.Last().SetNameElement("Sash_Fill_Rail"); + BottomRailElemDimList.Last().SetMinDimension(Window.m_ParameterList.GetValueOrDefault(BottomRailElemDimList.Last().sName + "_DimMin")); + BottomRailElemDimList.Last().SetMaxDimension(Window.m_ParameterList.GetValueOrDefault(BottomRailElemDimList.Last().sName + "_DimMax")); + BottomRailElemDimList.Last().SetDimension(Window.m_ParameterList.GetValueOrDefault(BottomRailElemDimList.Last().sName + "_DimStd")); + if (value > 1 && BottomRailElemDimList.Count - 2 >= 0) + { + BottomRailElemDimList.ElementAt(BottomRailElemDimList.Count - 2).SetNameElement("Sash_Rail"); + BottomRailElemDimList.ElementAt(BottomRailElemDimList.Count - 2).SetMinDimension(Window.m_ParameterList.GetValueOrDefault(BottomRailElemDimList.ElementAt(BottomRailElemDimList.Count - 2).sName + "_DimMin")); + BottomRailElemDimList.ElementAt(BottomRailElemDimList.Count - 2).SetMaxDimension(Window.m_ParameterList.GetValueOrDefault(BottomRailElemDimList.ElementAt(BottomRailElemDimList.Count - 2).sName + "_DimMax")); + BottomRailElemDimList.ElementAt(BottomRailElemDimList.Count - 2).SetDimension(BottomRailElemDimList.ElementAt(BottomRailElemDimList.Count - 2).dDimension); + } } else if (value < m_nSashBottomRailQty) { - // Elimino un element - BottomRailElemDimList.RemoveAt(BottomRailElemDimList.Count - 1); + // Elimino gli element + for (int i = BottomRailElemDimList.Count - 1; i == value; i--) + BottomRailElemDimList.RemoveAt(i); + if (value >= 1) + { + BottomRailElemDimList.Last().SetNameElement("Sash_Fill_Rail"); + BottomRailElemDimList.Last().SetMinDimension(Window.m_ParameterList.GetValueOrDefault(BottomRailElemDimList.Last().sName + "_DimMin")); + BottomRailElemDimList.Last().SetMaxDimension(Window.m_ParameterList.GetValueOrDefault(BottomRailElemDimList.Last().sName + "_DimMax")); + BottomRailElemDimList.Last().SetDimension(BottomRailElemDimList.Last().dDimension); + } } m_nSashBottomRailQty = value; if (m_nSashBottomRailQty > 0) @@ -722,6 +770,7 @@ namespace WebWindowComplex.Models { m_IsbDimensionLight = DimensionLight; } + internal static Sash CreateSash(Area Area) { Sash newSash = new Sash(Area, Area.ParentWindow); @@ -835,7 +884,7 @@ namespace WebWindowComplex.Models if (nCounterGroup < GroupId) Area.nCounterGroup = GroupId; string currHwId = hideHw ? CustomHwId : m_SelHardware!.Id; - JsonSash JsonSash = new JsonSash(m_bIsSashVertical, m_SashType, m_bSashBottomRail, m_nSashBottomRailQty, currHwId, GroupId); + JsonSash JsonSash = new JsonSash(m_bIsSashVertical, m_SashType, m_bSashBottomRail, m_nSashBottomRailQty, currHwId, GroupId, bIsDimensionLight); foreach (var SashDimension in SashList) JsonSash.SashList.Add(SashDimension.Serialize()); foreach (var BottomRailDim in BottomRailElemDimList) @@ -1037,6 +1086,135 @@ namespace WebWindowComplex.Models } } + internal AreaFound CalculateWidthSashGroup(Area area, double width, AreaFound res) + { + for (int i = 0; i < area.AreaList.Count; i++) + { + if (area.Equals(this)) + { + res.m_Dimension = width; + res.m_Found = true; + return res; + } + Area item = area.AreaList[i]; + if (area is Split) + { + Split split = (Split)area; + if (split.SplitVertList.Count > 0) + { + double dim = width; + switch (split.SplitVertList.ElementAt(i).SelMeasureType) + { + case MeasureTypes.ABSOLUTE: + { + dim = split.SplitVertList.ElementAt(i).dDimension; + break; + } + case MeasureTypes.PROPORTIONAL: + { + double widthGlass = width; + AreaDimension ad = new AreaDimension(split.SplitVertList.ElementAt(i).dDimension, split.SplitVertList.ElementAt(i).SelMeasureType, split.SplitVertList.ElementAt(i).Parent); + List adList = new List(); + foreach (var it in split.SplitVertList) + { + adList.Add(new AreaDimension(it.dDimension, it.SelMeasureType, it.Parent)); + } + foreach (var elem in split.ElemDimVertList) + { + widthGlass = widthGlass - elem.dDimension; + } + dim = ad.ConvertFromPropVal(adList, MeasureTypes.ABSOLUTE, widthGlass); + break; + } + case MeasureTypes.PERCENTAGE: + { + foreach (var elem in split.ElemDimVertList) + { + dim = dim - elem.dDimension; + } + dim = split.SplitVertList.ElementAt(i).dDimension * dim / 100; + break; + } + } + if (split.ParentArea is Frame && split.AreaList.ElementAt(i).AreaList.First() is Sash) + { + Frame frame = (Frame)split.ParentArea; + string overlapName = string.Join("_", split.ElemDimVertList.First().sName.Split('_').Skip(1)) + "_Top_Overlap"; + if (i == 0) + { + dim = dim + frame.ElementDimensionList.Last().dOverlap + + Window.m_ParameterList.GetValueOrDefault(overlapName); + } + else if (i == split.SplitVertList.Count - 1) + { + dim = dim + frame.ElementDimensionList.ElementAt(1).dOverlap + + Window.m_ParameterList.GetValueOrDefault(overlapName); + } + else + { + dim = dim + Window.m_ParameterList.GetValueOrDefault(overlapName) + + Window.m_ParameterList.GetValueOrDefault(overlapName); + } + } + res = CalculateWidthSashGroup(item, dim, res); + if (res.m_Dimension != -1 && res.m_Found) + return res; + } + else + { + res = CalculateWidthSashGroup(item, width, res); + if (res.m_Dimension != -1 && res.m_Found) + return res; + } + } + else if (area is Sash) + { + Sash sash = (Sash)area; + switch (sash.SashList.ElementAt(i).SelMeasureType) + { + case MeasureTypes.ABSOLUTE: + { + res = CalculateWidthSashGroup(item, sash.SashList.ElementAt(i).dDimension, res); + break; + } + case MeasureTypes.PROPORTIONAL: + { + SashDimension anta = sash.SashList.ElementAt(i); + AreaDimension ad = new AreaDimension(anta.dDimension, anta.SelMeasureType, anta.Parent); + List adList = new List(); + foreach (var it in sash.SashList) + { + adList.Add(new AreaDimension(it.dDimension, it.SelMeasureType, it.Parent)); + } + res = CalculateWidthSashGroup(item, ad.ConvertFromPropVal(adList, MeasureTypes.ABSOLUTE, width), res); + break; + } + case MeasureTypes.PERCENTAGE: + { + res = CalculateWidthSashGroup(item, sash.SashList.ElementAt(i).dDimension * width / 100, res); + break; + } + } + if (res.m_Dimension != -1 && res.m_Found) + return res; + } + else if (area is Frame) + { + Frame f = (Frame)area; + res = CalculateWidthSashGroup(item, f.AvailWidthArea(), res); + if (res.m_Dimension != -1 && res.m_Found) + return res; + } + else + { + res = CalculateWidthSashGroup(item, width, res); + if (res.m_Dimension != -1 && res.m_Found) + return res; + } + } + return res; + } + #endregion Internal Methods #region Private Fields @@ -1060,7 +1238,6 @@ namespace WebWindowComplex.Models private int m_nSashBottomRailQty; - private List m_ElementDimensionList = new List(); private List m_BottomRailElemDimList = new List(); private List m_OrientationSashTypeList = new List { diff --git a/WebWindowComplex/Models/SashDimension.cs b/WebWindowComplex/Models/SashDimension.cs index 8ff5213..ca93f50 100644 --- a/WebWindowComplex/Models/SashDimension.cs +++ b/WebWindowComplex/Models/SashDimension.cs @@ -1,4 +1,5 @@ -using System.Runtime.InteropServices; +using System; +using System.Runtime.InteropServices; using System.Security.Principal; using WebWindowComplex.Json; using static WebWindowComplex.Json.WindowConst; @@ -9,7 +10,7 @@ namespace WebWindowComplex.Models { #region Public Constructors - public SashDimension(double dDimension, MeasureTypes MeasureType, Sash Parent, int nSashId):base(dDimension, MeasureType) + public SashDimension(double dDimension, MeasureTypes MeasureType, Sash Parent, int nSashId):base(dDimension, MeasureType, Parent) { m_dDimension = dDimension; m_nSashId = nSashId; @@ -149,25 +150,25 @@ namespace WebWindowComplex.Models } set { - if(m_Parent.ParentWindow.AreaList.FirstOrDefault() != null) + Frame? frame = m_Parent.ParentWindow.AreaList.FirstOrDefault(); + if (frame != null) { - double widthTot = CalculateWidthSashGroup(m_Parent.ParentWindow.AreaList.FirstOrDefault()!, m_Parent.ParentWindow.AreaList.FirstOrDefault()!.DimensionList.Where(x => x.sName == "Width").First().dDimension); - //double widthTot = ((Frame)m_Parent.ParentArea).AvailArea(); - //if (m_Parent.bIsDimensionLight) - //{ - // for (int i = 0; i < m_Parent.SashList.Count; i++) - // { - // if(i == 0) - // widthTot = widthTot - // - m_Parent.SashList.ElementAt(i).ElementDimensionList.ElementAt(1).dDimension - // - m_Parent.SashList.ElementAt(i).ElementDimensionList.Last().dDimension; - // else - // widthTot = widthTot - // - m_Parent.SashList.ElementAt(i).ElementDimensionList.ElementAt(1).dDimension - // - m_Parent.SashList.ElementAt(i).ElementDimensionList.Last().dDimension - // + m_Parent.SashList.ElementAt(i).ElementDimensionList.ElementAt(1).dOverlap; - // } - //} + double widthTot = (Parent.CalculateWidthSashGroup(frame, frame.AvailWidthArea(), new AreaFound(-1, false))).m_Dimension; + if (m_Parent.bIsDimensionLight) + { + for (int i = 0; i < m_Parent.SashList.Count; i++) + { + if (i == 0) + widthTot = widthTot + - m_Parent.SashList.ElementAt(i).ElementDimensionList.ElementAt(1).dDimension + - m_Parent.SashList.ElementAt(i).ElementDimensionList.Last().dDimension; + else + widthTot = widthTot + - m_Parent.SashList.ElementAt(i).ElementDimensionList.ElementAt(1).dDimension + - m_Parent.SashList.ElementAt(i).ElementDimensionList.Last().dDimension + + m_Parent.SashList.ElementAt(i).ElementDimensionList.Last().dOverlap; + } + } double valMinAbsolute = 100; double valMaxAbsolute = widthTot - valMinAbsolute * (m_Parent.SashList.Count - 1); bool valueAccept = false; @@ -196,11 +197,11 @@ namespace WebWindowComplex.Models { List dimensions = m_Parent.SashList; List absoluteValList = new List(); - AreaDimension ad = new AreaDimension(m_dDimension, SelMeasureType); + AreaDimension ad = new AreaDimension(m_dDimension, SelMeasureType, Parent); List adList = new List(); foreach (var it in m_Parent.SashList) { - adList.Add(new AreaDimension(it.m_dDimension, it.SelMeasureType)); + adList.Add(new AreaDimension(it.m_dDimension, it.SelMeasureType, it.Parent)); } int index = 0; foreach (var item in m_Parent.SashList) @@ -224,9 +225,9 @@ namespace WebWindowComplex.Models { // L'anta modificata non è l'ultima if (nIndex < dimensions.Count - 1) - dimensions[nIndex + 1].SetDimension(dimensions[nIndex + 1].m_dDimension + (m_dDimension - value)); + dimensions[nIndex + 1].SetDimension(Math.Round(dimensions[nIndex + 1].m_dDimension + (m_dDimension - value), 2)); else if (dimensions.Count > 1) - dimensions[nIndex - 1].SetDimension(dimensions[nIndex - 1].m_dDimension + (m_dDimension - value)); + dimensions[nIndex - 1].SetDimension(Math.Round(dimensions[nIndex - 1].m_dDimension + (m_dDimension - value), 2)); else { m_dDimension = 100; @@ -288,35 +289,34 @@ namespace WebWindowComplex.Models break; } } + double overlapCurrSash = 0; + if (!Parent.bIsDimensionLight) + { + int j = nIndex == 0 ? 1 : Parent.SashList.ElementAt(nIndex).ElementDimensionList.Count - 1; + overlapCurrSash = Parent.SashList.ElementAt(nIndex).ElementDimensionList.ElementAt(j).dOverlap / 2; + } + int indexDimChange = 0; + // L'anta modificata non è l'ultima + if (nIndex < absoluteValList.Count - 1) + indexDimChange = nIndex + 1; + // L'anta modificata è l'ultima + else if (dimensions.Count > 1) + indexDimChange = nIndex - 1; + double overlap = 0; + if (!Parent.bIsDimensionLight) + { + int j = indexDimChange == 0 ? 1 : Parent.SashList.ElementAt(nIndex + 1).ElementDimensionList.Count - 1; + overlap = Parent.SashList.ElementAt(indexDimChange).ElementDimensionList.ElementAt(j).dOverlap / 2; + } if (value < m_dDimension) { - // L'anta modificata non è l'ultima - if (nIndex < absoluteValList.Count - 1) - { - absoluteValList[nIndex + 1] = absoluteValList[nIndex + 1] + (absoluteValList[nIndex] - valueInAbsolute); - absoluteValList[nIndex] = valueInAbsolute; - } - // L'anta modificata è l'ultima - else if (dimensions.Count > 1) - { - absoluteValList[nIndex - 1] = absoluteValList[nIndex - 1] + (absoluteValList[nIndex] - valueInAbsolute); - absoluteValList[nIndex] = valueInAbsolute; - } + absoluteValList[indexDimChange] = absoluteValList[indexDimChange] + (absoluteValList[nIndex] - (valueInAbsolute - overlapCurrSash)) + overlap; + absoluteValList[nIndex] = valueInAbsolute; } else { - // L'anta modificata non è l'ultima - if (nIndex < absoluteValList.Count - 1) - { - absoluteValList[nIndex + 1] = absoluteValList[nIndex + 1] - (valueInAbsolute - absoluteValList[nIndex]); - absoluteValList[nIndex] = valueInAbsolute; - } - // L'anta modificata è l'ultima - else if (dimensions.Count > 1) - { - absoluteValList[nIndex - 1] = absoluteValList[nIndex - 1] - (valueInAbsolute - absoluteValList[nIndex]); - absoluteValList[nIndex] = valueInAbsolute; - } + absoluteValList[indexDimChange] = absoluteValList[indexDimChange] - ((valueInAbsolute - overlapCurrSash) - absoluteValList[nIndex]) + overlap; + absoluteValList[nIndex] = valueInAbsolute; } if (MeasureType.Equals(MeasureTypes.PROPORTIONAL)) m_dDimension = value; @@ -403,25 +403,41 @@ namespace WebWindowComplex.Models if(SelMeasureType != (MeasureTypes)value) { MeasureTypes newType = (MeasureTypes)value; - if (m_Parent.ParentWindow.AreaList.FirstOrDefault() != null) + Frame? frame = m_Parent.ParentWindow.AreaList.FirstOrDefault(); + if (frame != null) { - double widthTot = CalculateWidthSashGroup(m_Parent.ParentWindow.AreaList.FirstOrDefault()!, m_Parent.ParentWindow.AreaList.FirstOrDefault()!.DimensionList.Where(x => x.sName == "Width").First().dDimension); - // TODO: availArea per aree che non sono frame - //double widthTot = ((Frame)m_Parent.ParentArea).AvailArea(); - AreaDimension ad = new AreaDimension(m_dDimension, SelMeasureType); + double widthTot = Parent.CalculateWidthSashGroup(frame!, frame!.DimensionList.Where(x => x.sName == "Width").First().dDimension, new AreaFound(-1, false)).m_Dimension; + if (Parent.bIsDimensionLight) + { + for (int i = 0; i < m_Parent.SashList.Count; i++) + { + if (i == 0) + widthTot = widthTot + - m_Parent.SashList.ElementAt(i).ElementDimensionList.ElementAt(1).dDimension + - m_Parent.SashList.ElementAt(i).ElementDimensionList.Last().dDimension; + else + widthTot = widthTot + - m_Parent.SashList.ElementAt(i).ElementDimensionList.ElementAt(1).dDimension + - m_Parent.SashList.ElementAt(i).ElementDimensionList.Last().dDimension + + m_Parent.SashList.ElementAt(i).ElementDimensionList.Last().dOverlap; + } + } + AreaDimension ad = new AreaDimension(m_dDimension, SelMeasureType, Parent); List adList = new List(); foreach (var it in m_Parent.SashList) { - adList.Add(new AreaDimension(it.m_dDimension, it.SelMeasureType)); - //if (it.SelMeasureType is MeasureTypes.ABSOLUTE) - //{ - // if (it.bHasHandle) - // adList.Add(new AreaDimension(it.m_dDimension - (it.ElementDimensionList.ElementAt(1).dOverlap) / 2, it.SelMeasureType)); - // else - // adList.Add(new AreaDimension(it.m_dDimension - (it.ElementDimensionList.Last().dOverlap) / 2, it.SelMeasureType)); - //} + adList.Add(new AreaDimension(it.m_dDimension, it.SelMeasureType, it.Parent)); } - m_dDimension = ad.ConvertDimension(adList, SelMeasureType, newType, widthTot, nSashId-1); + double overlap = 0; + if (!Parent.bIsDimensionLight) + { + int index = m_Parent.SashList.IndexOf(this); + if (index == 0) + overlap = m_Parent.SashList.ElementAt(index).ElementDimensionList.ElementAt(1).dOverlap; + else + overlap = m_Parent.SashList.ElementAt(index).ElementDimensionList.Last().dOverlap; + } + m_dDimension = ad.ConvertDimension(adList, SelMeasureType, newType, widthTot, nSashId - 1, overlap); SelMeasureType = (MeasureTypes)value; } } @@ -464,100 +480,6 @@ namespace WebWindowComplex.Models m_dDimension = Dimension; } - /// - /// Metodo per calcolare larghezza intera sash group - /// - /// area di partenza - /// larghezza di partenza - /// - internal double CalculateWidthSashGroup(Area area, double width) - { - if (width < 1) - return 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.SplitVertList.Count > 0) - { - switch (split.SplitVertList.ElementAt(i).SelMeasureType) - { - case MeasureTypes.ABSOLUTE: - { - risultato = CalculateWidthSashGroup(item, split.SplitVertList.ElementAt(i).dDimension); - break; - } - case MeasureTypes.PROPORTIONAL: - { - AreaDimension ad = new AreaDimension(split.SplitVertList.ElementAt(i).dDimension, split.SplitVertList.ElementAt(i).SelMeasureType); - List adList = new List(); - foreach(var it in split.SplitVertList) - { - adList.Add(new AreaDimension(it.dDimension, it.SelMeasureType)); - } - risultato = CalculateWidthSashGroup(item, ad.ConvertFromPropVal(adList, MeasureTypes.ABSOLUTE, width)); - 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); - } - } - else if (area is Sash) - { - Sash sash = (Sash)area; - switch (sash.SashList.ElementAt(i).SelMeasureType) - { - case MeasureTypes.ABSOLUTE: - { - risultato = CalculateWidthSashGroup(item, sash.SashList.ElementAt(i).dDimension); - break; - } - case MeasureTypes.PROPORTIONAL: - { - //risultato = CalculateWidthSashGroup(item, ConvertFromPropVal(MeasureTypes.ABSOLUTE, width, sash.SashList.ElementAt(i).dDimension)); - AreaDimension ad = new AreaDimension(sash.SashList.ElementAt(i).dDimension, sash.SashList.ElementAt(i).SelMeasureType); - List adList = new List(); - foreach (var it in sash.SashList) - { - adList.Add(new AreaDimension(it.dDimension, it.SelMeasureType)); - } - risultato = CalculateWidthSashGroup(item, ad.ConvertFromPropVal(adList, MeasureTypes.ABSOLUTE, width)); - 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, dDimension, m_nSashId); @@ -593,17 +515,48 @@ namespace WebWindowComplex.Models if (SelMeasureType != (MeasureTypes)value) { MeasureTypes newType = (MeasureTypes)value; - if(m_Parent.ParentWindow.AreaList.FirstOrDefault() != null) + Frame? frame = m_Parent.ParentWindow.AreaList.FirstOrDefault(); + if (frame != null) { - double widthTot = CalculateWidthSashGroup(m_Parent.ParentWindow.AreaList.FirstOrDefault()!, m_Parent.ParentWindow.AreaList.FirstOrDefault()!.DimensionList.Where(x => x.sName == "Width").First().dDimension); - AreaDimension ad = new AreaDimension(dDimension, SelMeasureType); + double widthTot = Parent.CalculateWidthSashGroup(frame, frame.AvailWidthArea(), new AreaFound(-1, false)).m_Dimension; + if (Parent.bIsDimensionLight) + { + for(int i = 0; i < Parent.SashList.Count; i++) + { + if (i == 0) + widthTot = widthTot - Parent.SashList.ElementAt(i).ElementDimensionList.ElementAt(1).dDimension + - Parent.SashList.ElementAt(i).ElementDimensionList.Last().dDimension; + else + widthTot = widthTot - Parent.SashList.ElementAt(i).ElementDimensionList.ElementAt(1).dDimension + - Parent.SashList.ElementAt(i).ElementDimensionList.Last().dDimension + + Parent.SashList.ElementAt(i).ElementDimensionList.Last().dOverlap; + } + } + else + { + for (int i = 0; i < m_Parent.SashList.Count - 1; i++) + { + widthTot = widthTot + m_Parent.SashList.ElementAt(i).ElementDimensionList.ElementAt(1).dOverlap; + } + } + AreaDimension ad = new AreaDimension(dDimension, SelMeasureType, Parent); + //if(SelMeasureType is MeasureTypes.ABSOLUTE) + // ad = new AreaDimension(dDimension - ElementDimensionList.ElementAt(1).dOverlap, SelMeasureType); + //else + // ad = new AreaDimension(dDimension, SelMeasureType); List newDimensions = new List(); foreach(var item in m_Parent.SashList) { - newDimensions.Add(new AreaDimension(item.dDimension, item.SelMeasureType)); + newDimensions.Add(new AreaDimension(item.dDimension, item.SelMeasureType, item.Parent)); } - m_dDimension = ad.ConvertDimension(newDimensions, SelMeasureType, newType, widthTot, indexSash); - if(newType is MeasureTypes.PROPORTIONAL) + int index = m_Parent.SashList.IndexOf(this); + double overlap = 0; + if (index == 0) + overlap = m_Parent.SashList.ElementAt(index).ElementDimensionList.ElementAt(1).dOverlap; + else + overlap = m_Parent.SashList.ElementAt(index).ElementDimensionList.Last().dOverlap; + m_dDimension = ad.ConvertDimension(newDimensions, SelMeasureType, newType, widthTot, indexSash, overlap); + if (newType is MeasureTypes.PROPORTIONAL) { for (int i = 0; i < newDimensions.Count; i++) m_Parent.SashList.ElementAt(i).SetDimension(newDimensions.ElementAt(i).dDimension); diff --git a/WebWindowComplex/Models/Split.cs b/WebWindowComplex/Models/Split.cs index 14acccb..94500a6 100644 --- a/WebWindowComplex/Models/Split.cs +++ b/WebWindowComplex/Models/Split.cs @@ -95,7 +95,7 @@ namespace WebWindowComplex.Models if (m_SplitHorizList.Count > 0) { dLastDimension = m_SplitHorizList[m_SplitHorizList.Count - 1].dDimension; - dNewDimension = dLastDimension / (value + 1 - nSplitQtyHoriz); + dNewDimension = (dLastDimension - m_ElemDimHorizList.Last().dDimension) / (value + 1 - nSplitQtyHoriz); if (m_SplitHorizList[m_SplitHorizList.Count - 1].MeasureType.Equals(MeasureTypes.PROPORTIONAL)) dNewDimension = 1; m_SplitHorizList[m_SplitHorizList.Count - 1].SetDimension(dNewDimension); @@ -133,7 +133,7 @@ namespace WebWindowComplex.Models double dLastDimension = 0; for (var SplitIndex = m_SplitHorizList.Count - 1; SplitIndex >= value + 1; SplitIndex += -1) { - dLastDimension += m_SplitHorizList[SplitIndex].dDimension; + dLastDimension += m_SplitHorizList[SplitIndex].dDimension + m_ElemDimHorizList[SplitIndex - 1].dDimension; m_SplitHorizList.RemoveAt(SplitIndex); } dLastDimension += m_SplitHorizList[m_SplitHorizList.Count - 1].dDimension; @@ -213,9 +213,10 @@ namespace WebWindowComplex.Models } else { - if(ParentWindow.AreaList.FirstOrDefault() != null) + Frame? frame = ParentWindow.AreaList.FirstOrDefault(); + if (frame != null) { - double widthTot = CalculateWidthArea(ParentWindow.AreaList.First(), ParentWindow.AreaList.FirstOrDefault()!.DimensionList.Where(x => x.sName == "Width").First().dDimension); + double widthTot = CalculateWidthArea(frame, frame.DimensionList.Where(x => x.sName == "Width").First().dDimension); // Ricalcolo dimensioni aggiungendo split if (value > m_SplitVertList.Count - 1) { @@ -225,7 +226,7 @@ namespace WebWindowComplex.Models if (m_SplitVertList.Count > 0) { dLastDimension = m_SplitVertList[m_SplitVertList.Count - 1].dDimension; - dNewDimension = dLastDimension / (value + 1 - nSplitQtyVert); + dNewDimension = (dLastDimension - ElemDimVertList.Last().dDimension) / (value + 1 - nSplitQtyVert); if (m_SplitVertList[m_SplitVertList.Count - 1].MeasureType.Equals(MeasureTypes.PROPORTIONAL)) dNewDimension = 1; m_SplitVertList[m_SplitVertList.Count - 1].SetDimension(dNewDimension); @@ -276,7 +277,7 @@ namespace WebWindowComplex.Models double dLastDimension = 0; for (var SplitIndex = m_SplitVertList.Count - 1; SplitIndex >= value + 1; SplitIndex += -1) { - dLastDimension += m_SplitVertList[SplitIndex].dDimension; + dLastDimension += m_SplitVertList[SplitIndex].dDimension + ElemDimVertList[SplitIndex - 1].dDimension; m_SplitVertList.RemoveAt(SplitIndex); } dLastDimension += m_SplitVertList[m_SplitVertList.Count - 1].dDimension; @@ -409,6 +410,7 @@ namespace WebWindowComplex.Models m_SplitHorizList = value; } } + public List ElemDimHorizList { get @@ -432,17 +434,6 @@ namespace WebWindowComplex.Models m_ElemDimVertList = value; } } - public List SplitPositionList - { - get - { - return m_SplitPositionList; - } - set - { - m_SplitPositionList = value; - } - } public List SplitShapeList { @@ -510,7 +501,6 @@ namespace WebWindowComplex.Models Fill newFill = Fill.CreateFill(ParentArea, FillTypes.GLASS); newFill.SetAreaType(AreaTypes.FILL); ParentArea.AreaList.Add(newFill); - //m_ParentWindow.OnUpdatePreview(m_ParentWindow.sSerialized()); } public List searchElemFromSubArea(int subArea) @@ -531,34 +521,6 @@ namespace WebWindowComplex.Models } } - public bool OnlySashChild() - { - foreach (var areaSplitted in AreaList) - { - if (!(areaSplitted.AreaList.FirstOrDefault()?.AreaType is AreaTypes.SASH)) - return false; - } - return true; - } - public bool MinOneSashChild() - { - foreach (var areaSplitted in AreaList) - { - if (areaSplitted.AreaList.FirstOrDefault()?.AreaType is AreaTypes.SASH) - return true; - } - return false; - } - public bool SashChildSxOrDx() - { - foreach (var areaSplitted in AreaList) - { - if (areaSplitted.AreaList.FirstOrDefault()?.AreaType is AreaTypes.SASH) - return true; - } - return false; - } - #endregion Public Methods #region Internal Properties @@ -597,10 +559,20 @@ namespace WebWindowComplex.Models JsonSplit.SplitVertList.Add(SplitVert.Serialize()); foreach (var SplitHoriz in m_SplitHorizList) JsonSplit.SplitHorizList.Add(SplitHoriz.Serialize()); - foreach (var Elem in m_ElemDimHorizList) - JsonSplit.ElementDimHorizList.Add(Elem.Serialize()); - foreach (var Elem in m_ElemDimVertList) - JsonSplit.ElementDimVertList.Add(Elem.Serialize()); + if(m_ElemDimHorizList != null && m_ElemDimHorizList.Count > 0) + { + int subAreaMinHoriz = m_ElemDimHorizList.Min(x => x.nSubArea); + List horizList = m_ElemDimHorizList.Where(x => x.nSubArea == subAreaMinHoriz).ToList(); + foreach (var Elem in horizList) + JsonSplit.ElementDimHorizList.Add(Elem.Serialize()); + } + if (m_ElemDimVertList != null && m_ElemDimVertList.Count > 0) + { + int subAreaMinVert = m_ElemDimVertList.Min(x => x.nSubArea); + List vertList = m_ElemDimVertList.Where(x => x.nSubArea == subAreaMinVert).ToList(); + foreach (var Elem in vertList.ToList()) + JsonSplit.ElementDimVertList.Add(Elem.Serialize()); + } foreach (var Area in AreaList) JsonSplit.AreaList.Add(Area.Serialize(hideHw)); return JsonSplit; @@ -636,12 +608,13 @@ namespace WebWindowComplex.Models } else { + // Un Elemento per ogni dimensione principale e per ogni sotto dimensione if (bSplitStartVert) { - for(int subArea = 0; subArea <= QtyVert; subArea++) + for (int subArea = 0; subArea <= QtyVert; subArea++) { for (int i = 0; i < QtyHoriz; i++) - ElemDimHorizList.Add(new SplitElementDimension(this, i + 1, 78, subArea+1)); + ElemDimHorizList.Add(new SplitElementDimension(this, i + 1, 78, subArea + 1)); } } else @@ -682,6 +655,7 @@ namespace WebWindowComplex.Models } else { + // Un Elemento per ogni dimensione principale e per ogni sotto dimensione if (bSplitStartVert) { for (int i = 0; i < QtyVert; i++) @@ -689,12 +663,12 @@ namespace WebWindowComplex.Models } else { - for(int subArea = 0; subArea <= QtyHoriz; subArea++) + for (int subArea = 0; subArea <= QtyHoriz; subArea++) { for (int i = 0; i < QtyVert; i++) - ElemDimVertList.Add(new SplitElementDimension(this, i+1, 78, subArea + 1)); + ElemDimVertList.Add(new SplitElementDimension(this, i + 1, 78, subArea + 1)); } - } + } } } @@ -737,14 +711,12 @@ namespace WebWindowComplex.Models #region Private Fields - //private bool m_bIsPercentage = true; private bool m_bSplitStartVert = true; private SplitShapes m_SelSplitShape; private List m_SplitHorizList = new List(); private List m_ElemDimHorizList = new List(); private List m_ElemDimVertList = new List(); - private List m_SplitPositionList = new List(); private List m_SplitShapeList = new List { @@ -756,8 +728,6 @@ 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 15e1c5a..4b0c2b8 100644 --- a/WebWindowComplex/Models/SplitDimension.cs +++ b/WebWindowComplex/Models/SplitDimension.cs @@ -13,7 +13,7 @@ namespace WebWindowComplex.Models { #region Public Constructors - public SplitDimension(double dDimension, MeasureTypes MeasureType, bool bIsRelative, Split Parent, bool IsVertList):base(dDimension, MeasureType) + public SplitDimension(double dDimension, MeasureTypes MeasureType, bool bIsRelative, Split Parent, bool IsVertList):base(dDimension, MeasureType, Parent) { m_dDimension = dDimension; m_bIsRelative = bIsRelative; @@ -61,7 +61,7 @@ namespace WebWindowComplex.Models { dimensions = m_Parent.SplitHorizList; //dimensionTot = (CalculateHeightSplitGroup(m_Parent, HeightTot(), new AreaFound(-1, false))).m_Dimension; - dimensionTot = (CalculateHeightSplitGroup(frame, frame.HeightFrame(), new AreaFound(-1, false))).m_Dimension; + dimensionTot = (CalculateHeightSplitGroup(frame, frame.AvailHeightArea(), new AreaFound(-1, false))).m_Dimension; } double valMinAbsolute = 100; double valMaxAbsolute = dimensionTot - valMinAbsolute * (dimensions.Count - 1); @@ -90,11 +90,11 @@ namespace WebWindowComplex.Models if (valueAccept) { List absoluteValList = new List(); - AreaDimension ad = new AreaDimension(dDimension, SelMeasureType); + AreaDimension ad = new AreaDimension(dDimension, SelMeasureType, Parent); List adList = new List(); foreach (var it in dimensions) { - adList.Add(new AreaDimension(it.dDimension, it.SelMeasureType)); + adList.Add(new AreaDimension(it.dDimension, it.SelMeasureType, it.Parent)); } foreach (var item in dimensions) { @@ -260,20 +260,29 @@ namespace WebWindowComplex.Models if (bIsVertListDim) { splitList = m_Parent.SplitVertList; - tot = CalculateWidthSplitGroup(frame, frame.DimensionList.Where(x => x.sName == "Width").First().dDimension, new AreaFound(-1, false)).m_Dimension; + //tot = CalculateWidthSplitGroup(frame, frame.DimensionList.Where(x => x.sName == "Width").First().dDimension, new AreaFound(-1, false)).m_Dimension; + tot = CalculateWidthSplitGroup(frame, frame.AvailWidthArea(), new AreaFound(-1, false)).m_Dimension; + foreach (var item in m_Parent.ElemDimVertList) + { + tot = tot - item.dDimension; + } } else { splitList = m_Parent.SplitHorizList; - tot = (CalculateHeightSplitGroup(frame, frame.HeightFrame(), new AreaFound(-1, false))).m_Dimension; + tot = (CalculateHeightSplitGroup(frame, frame.AvailHeightArea(), new AreaFound(-1, false))).m_Dimension; + foreach (var item in m_Parent.ElemDimHorizList) + { + tot = tot - item.dDimension; + } } - AreaDimension ad = new AreaDimension(dDimension, SelMeasureType); + AreaDimension ad = new AreaDimension(dDimension, SelMeasureType, Parent); List adList = new List(); foreach (var it in splitList) { - adList.Add(new AreaDimension(it.dDimension, it.SelMeasureType)); + adList.Add(new AreaDimension(it.dDimension, it.SelMeasureType, it.Parent)); } - m_dDimension = ad.ConvertDimension(adList, m_SelMeasureType, newType, tot, splitList.IndexOf(this)); + m_dDimension = ad.ConvertDimension(adList, m_SelMeasureType, newType, tot, splitList.IndexOf(this), 0); m_SelMeasureType = (MeasureTypes)value; } } @@ -329,11 +338,11 @@ namespace WebWindowComplex.Models } case MeasureTypes.PROPORTIONAL: { - AreaDimension ad = new AreaDimension(split.SplitVertList.ElementAt(index).dDimension, split.SplitVertList.ElementAt(index).SelMeasureType); + AreaDimension ad = new AreaDimension(split.SplitVertList.ElementAt(index).dDimension, split.SplitVertList.ElementAt(index).SelMeasureType, split.SplitVertList.ElementAt(index).Parent); List adList = new List(); foreach (var it in split.SplitVertList) { - adList.Add(new AreaDimension(it.dDimension, it.SelMeasureType)); + adList.Add(new AreaDimension(it.dDimension, it.SelMeasureType, it.Parent)); } res = CalculateWidthSplitGroup(item, ad.ConvertFromPropVal(adList, MeasureTypes.ABSOLUTE, width), res); break; @@ -361,23 +370,60 @@ namespace WebWindowComplex.Models { case MeasureTypes.ABSOLUTE: { - res = CalculateWidthSplitGroup(item, sash.SashList.ElementAt(i).dDimension, res); + double dim = sash.SashList.ElementAt(i).dDimension; + if (!sash.bIsDimensionLight) + dim = dim - + sash.SashList.ElementAt(i).ElementDimensionList.ElementAt(1).dDimension - + sash.SashList.ElementAt(i).ElementDimensionList.Last().dDimension; + res = CalculateWidthSplitGroup(item, dim, res); break; } case MeasureTypes.PROPORTIONAL: { - AreaDimension ad = new AreaDimension(sash.SashList.ElementAt(i).dDimension, sash.SashList.ElementAt(i).SelMeasureType); + AreaDimension ad = new AreaDimension(sash.SashList.ElementAt(i).dDimension, sash.SashList.ElementAt(i).SelMeasureType, sash.SashList.ElementAt(i).Parent); List adList = new List(); foreach (var it in sash.SashList) { - adList.Add(new AreaDimension(it.dDimension, it.SelMeasureType)); + adList.Add(new AreaDimension(it.dDimension, it.SelMeasureType, it.Parent)); } - res = CalculateWidthSplitGroup(item, ad.ConvertFromPropVal(adList, MeasureTypes.ABSOLUTE, width), res); + double widthTot = width; + int index = adList.IndexOf(ad) == 0 ? 1 : adList.Count - 1; ; + double dim = 0; + if (sash.bIsDimensionLight) + { + for (int anta = 0; anta < sash.SashList.Count; anta++) + { + if (anta == 0) + widthTot = widthTot - sash.SashList.ElementAt(anta).ElementDimensionList.ElementAt(1).dDimension + - sash.SashList.ElementAt(anta).ElementDimensionList.Last().dDimension; + else + widthTot = widthTot - sash.SashList.ElementAt(anta).ElementDimensionList.ElementAt(1).dDimension + - sash.SashList.ElementAt(anta).ElementDimensionList.Last().dDimension + + sash.SashList.ElementAt(anta).ElementDimensionList.Last().dOverlap; + } + dim = ad.ConvertFromPropVal(adList, MeasureTypes.ABSOLUTE, widthTot); + } + else + { + dim = ad.ConvertFromPropVal(adList, MeasureTypes.ABSOLUTE, widthTot) + + sash.SashList.ElementAt(i).ElementDimensionList.ElementAt(index).dOverlap / 2; + dim = dim - + sash.SashList.ElementAt(i).ElementDimensionList.ElementAt(1).dDimension - + sash.SashList.ElementAt(i).ElementDimensionList.Last().dDimension; + } + res = CalculateWidthSplitGroup(item, dim, res); break; } case MeasureTypes.PERCENTAGE: { - res = CalculateWidthSplitGroup(item, sash.SashList.ElementAt(i).dDimension * width / 100, res); + double overlapElem = 0; + int indElem = i == 0 ? 1 : sash.SashList.ElementAt(i).ElementDimensionList.Count - 1; + if (!sash.bIsDimensionLight) + overlapElem = sash.SashList.ElementAt(i).ElementDimensionList.ElementAt(indElem).dOverlap / 2; + double dim = sash.SashList.ElementAt(i).dDimension * width / 100 + overlapElem - + sash.SashList.ElementAt(i).ElementDimensionList.ElementAt(1).dDimension - + sash.SashList.ElementAt(i).ElementDimensionList.Last().dDimension; + res = CalculateWidthSplitGroup(item, dim, res); break; } } @@ -417,6 +463,7 @@ namespace WebWindowComplex.Models Split split = (Split)area; if (split.SplitHorizList.Count > 0) { + double dim = height; int index = i; if (split.SelSplitShape is SplitShapes.GRID) index = i % split.SplitHorizList.Count; @@ -424,29 +471,58 @@ namespace WebWindowComplex.Models { case MeasureTypes.ABSOLUTE: { - double heightItemGroup = split.SplitHorizList.ElementAt(index).dDimension; - res = CalculateHeightSplitGroup(item, heightItemGroup, res); + dim = split.SplitHorizList.ElementAt(index).dDimension; + //res = CalculateHeightSplitGroup(item, heightItemGroup, res); break; } case MeasureTypes.PROPORTIONAL: { - AreaDimension ad = new AreaDimension(split.SplitHorizList.ElementAt(index).dDimension, split.SplitHorizList.ElementAt(index).SelMeasureType); + double heigthGlass = 0; + AreaDimension ad = new AreaDimension(split.SplitHorizList.ElementAt(index).dDimension, split.SplitHorizList.ElementAt(index).SelMeasureType, split.SplitHorizList.ElementAt(index).Parent); List adList = new List(); foreach (var it in split.SplitHorizList) { - adList.Add(new AreaDimension(it.dDimension, it.SelMeasureType)); + adList.Add(new AreaDimension(it.dDimension, it.SelMeasureType, it.Parent)); } - double heightItemGroup = ad.ConvertFromPropVal(adList, MeasureTypes.ABSOLUTE, height); - res = CalculateHeightSplitGroup(item, heightItemGroup, res); + foreach (var elem in split.ElemDimHorizList) + { + heigthGlass = heigthGlass - elem.dDimension; + } + dim = ad.ConvertFromPropVal(adList, MeasureTypes.ABSOLUTE, heigthGlass); + //res = CalculateHeightSplitGroup(item, heightItemGroup, res); break; } case MeasureTypes.PERCENTAGE: { - double heightItemGroup = split.SplitHorizList.ElementAt(index).dDimension * height / 100; - res = CalculateHeightSplitGroup(item, heightItemGroup, res); + foreach(var elem in split.ElemDimHorizList) + dim = dim - elem.dDimension; + dim = split.SplitHorizList.ElementAt(index).dDimension * dim / 100; + //res = CalculateHeightSplitGroup(item, heightItemGroup, res); break; } } + if (split.ParentArea is Frame && split.AreaList.ElementAt(i).AreaList.First() is Sash) + { + Frame frame = (Frame)split.ParentArea; + string pos = i == 0 ? "_Top_Overlap" : "_Bottom_Overlap"; + string overlapName = string.Join("_", split.ElemDimHorizList.First().sName.Split('_').Skip(1)); + if (i == 0) + { + dim = dim + frame.ElementDimensionList.First().dOverlap + + Window.m_ParameterList.GetValueOrDefault(overlapName + "_Bottom_Overlap"); + } + else if (i == split.SplitHorizList.Count - 1) + { + dim = dim + frame.ElementDimensionList.ElementAt(frame.ElementDimensionList.Count - 2).dOverlap + + Window.m_ParameterList.GetValueOrDefault(overlapName + "_Top_Overlap"); + } + else + { + dim = dim + Window.m_ParameterList.GetValueOrDefault(overlapName + "_Top_Overlap") + + Window.m_ParameterList.GetValueOrDefault(overlapName + "_Bottom_Overlap"); + } + } + res = CalculateHeightSplitGroup(item, dim, res); if (res.m_Dimension != -1 && res.m_Found) return res; } @@ -457,6 +533,15 @@ namespace WebWindowComplex.Models return res; } } + else if (area is Sash) + { + Sash s = (Sash)area; + height = height - s.SashList.First().ElementDimensionList.First().dDimension + - s.SashList.First().ElementDimensionList.ElementAt(s.SashList.First().ElementDimensionList.Count - 2).dDimension; + res = CalculateHeightSplitGroup(item, height, res); + if (res.m_Dimension != -1 && res.m_Found) + return res; + } else { res = CalculateHeightSplitGroup(item, height, res); @@ -499,32 +584,50 @@ namespace WebWindowComplex.Models double dimSplitGroup = 0; if (bIsVertListDim) { - dimSplitGroup = (CalculateWidthSplitGroup(frame, frame.DimensionList.Where(x => x.sName == "Width").First().dDimension, new AreaFound(-1, false))).m_Dimension; - AreaDimension ad = new AreaDimension(dDimension, SelMeasureType); + dimSplitGroup = (CalculateWidthSplitGroup(frame, frame.AvailWidthArea(), new AreaFound(-1, false))).m_Dimension; + foreach (var item in m_Parent.ElemDimVertList) + { + dimSplitGroup = dimSplitGroup - item.dDimension; + } + AreaDimension ad = new AreaDimension(dDimension, SelMeasureType, Parent); List newDimensions = new List(); foreach (var item in m_Parent.SplitVertList) { - newDimensions.Add(new AreaDimension(item.dDimension, item.SelMeasureType)); + newDimensions.Add(new AreaDimension(item.dDimension, item.SelMeasureType, item.Parent)); } - m_dDimension = ad.ConvertDimension(newDimensions, m_SelMeasureType, newType, dimSplitGroup, m_Parent.SplitVertList.IndexOf(this)); + m_dDimension = ad.ConvertDimension(newDimensions, m_SelMeasureType, newType, dimSplitGroup, m_Parent.SplitVertList.IndexOf(this), 0); if (newType is MeasureTypes.PROPORTIONAL) { for (int i = 0; i < m_Parent.SplitVertList.Count; i++) { m_Parent.SplitVertList.ElementAt(i).SetDimension(newDimensions.ElementAt(i).dDimension); } - } } + } + } else { //tot = (CalculateHeightSplitGroup(m_Parent, HeightTot(), new AreaFound(-1, false))).m_Dimension; - dimSplitGroup = (CalculateHeightSplitGroup(frame, frame.HeightFrame(), new AreaFound(-1, false))).m_Dimension; - AreaDimension ad = new AreaDimension(dDimension, SelMeasureType); + dimSplitGroup = (CalculateHeightSplitGroup(frame, frame.AvailHeightArea(), new AreaFound(-1, false))).m_Dimension; + List elemList = new List(); + if (Parent.bSplitStartVert || Parent.nSplitQtyVert == 0) + { + for (int i = 0; i < m_Parent.ElemDimHorizList.Count; i++) + { + if( i == i + m_Parent.ElemDimVertList.Count * i) + elemList.Add(m_Parent.ElemDimHorizList.ElementAtOrDefault(i)); + } + } + foreach (var item in elemList) + { + dimSplitGroup = dimSplitGroup - item.dDimension; + } + AreaDimension ad = new AreaDimension(dDimension, SelMeasureType, Parent); List newDimensions = new List(); foreach (var item in m_Parent.SplitHorizList) { - newDimensions.Add(new AreaDimension(item.dDimension, item.SelMeasureType)); + newDimensions.Add(new AreaDimension(item.dDimension, item.SelMeasureType, item.Parent)); } - m_dDimension = ad.ConvertDimension(newDimensions, m_SelMeasureType, newType, dimSplitGroup, m_Parent.SplitHorizList.IndexOf(this)); + m_dDimension = ad.ConvertDimension(newDimensions, m_SelMeasureType, newType, dimSplitGroup, m_Parent.SplitHorizList.IndexOf(this), 0); if(newType is MeasureTypes.PROPORTIONAL) { for(int i = 0; i < m_Parent.SplitHorizList.Count; i++) diff --git a/WebWindowComplex/TableComp.razor b/WebWindowComplex/TableComp.razor index 6b9fbe7..dc146dc 100644 --- a/WebWindowComplex/TableComp.razor +++ b/WebWindowComplex/TableComp.razor @@ -77,8 +77,11 @@ @if (currStep == CompileStep.Tree) { + maxCol="m_maxCol" + RowCollapsedDict="RowCollapsed" + ChildDict="Child" + EC_NextStep="NextStepArgs" + EC_Collapsed="CollapsedRowTree"> } else if (currStep == CompileStep.Frame) diff --git a/WebWindowComplex/TableComp.razor.cs b/WebWindowComplex/TableComp.razor.cs index 0fb1fe4..ee45d3a 100644 --- a/WebWindowComplex/TableComp.razor.cs +++ b/WebWindowComplex/TableComp.razor.cs @@ -1,6 +1,7 @@ using Egw.Window.Data; using Microsoft.AspNetCore.Components; using Newtonsoft.Json; +using NLog; using System.Threading.Tasks; using WebWindowComplex.Compo; using WebWindowComplex.DTO; @@ -389,10 +390,11 @@ namespace WebWindowComplex /// Richiesta chiusura SENZA salvataggio (= restore prev) /// /// - protected async Task DoClose() + protected Task DoClose() { editLock = false; - await EC_OnClose.InvokeAsync(false); + Log.Info("Richietsa Chiusura"); + return EC_OnClose.InvokeAsync(false); } /// @@ -415,6 +417,7 @@ namespace WebWindowComplex // verifico variazione JWD if (!prevJwd.Equals(CurrJwd) || doForce || prevReq != (int)DataReq.ReqSvg) { + Log.Info("Richietsa svg"); prevJwd = CurrJwd; prevReq = (int)DataReq.ReqSvg; Dictionary Args = new Dictionary(); @@ -443,6 +446,7 @@ namespace WebWindowComplex // verifico variazione JWD if (!prevJwd.Equals(CurrJwd) || isFirst || prevReq != (int)DataReq.ReqHwOpt) { + Log.Info("Richietsa Hardware option"); prevJwd = CurrJwd; prevReq = (int)DataReq.ReqHwOpt; Dictionary Args = new Dictionary(); @@ -474,6 +478,7 @@ namespace WebWindowComplex if (!prevJwd.Equals(CurrJwd) || prevReq != (int)DataReq.ReqShape) //if (!prevLiveData.CurrJwd.Equals(CurrJwd)) { + Log.Info("Richietsa shape"); prevJwd = CurrJwd; prevReq = (int)DataReq.ReqShape; Dictionary Args = new Dictionary(); @@ -503,6 +508,7 @@ namespace WebWindowComplex // verifico variazione JWD if (!prevJwd.Equals(CurrJwd) || prevReq != (int)DataReq.ReqElement) { + Log.Info("Richietsa Profili Elementi"); prevJwd = CurrJwd; prevReq = (int)DataReq.ReqElement; Dictionary Args = new Dictionary(); @@ -519,8 +525,10 @@ namespace WebWindowComplex /// /// Metodo di reset /// - protected async Task DoReset() + protected Task DoReset() { + Log.Info("Richietsa reset"); + return Task.CompletedTask; // Da fare } @@ -528,11 +536,12 @@ namespace WebWindowComplex /// Richiesta chiusura con salvataggio /// /// - protected async Task DoSave() + protected Task DoSave() { editLock = false; + Log.Info("Richietsa Salvataggio"); //manca salvataggio JWD - await EC_OnClose.InvokeAsync(true); + return EC_OnClose.InvokeAsync(true); } protected override void OnAfterRender(bool firstRender) @@ -578,7 +587,8 @@ namespace WebWindowComplex CurrJwd = LiveData.CurrJwd, DictOptionsXml = LiveData.DictOptionsXml, DictShape = LiveData.DictShape, - SvgPreview = LiveData.SvgPreview + SvgPreview = LiveData.SvgPreview, + ProfElementList = LiveData.ProfElementList }; // Aggiornati parametri di ingresso selezionati UpdateSelParameter(); @@ -601,6 +611,7 @@ namespace WebWindowComplex catch (Exception ex) { listErrLink.Add("Window", $"Deserializing Error:{Environment.NewLine}{ex}"); + Log.Error($"Errore nel deserializzare jwd: {ex.Message}"); // uso un oggetto "basico" per non fermarmi await BuildFrameDefault(); } @@ -628,6 +639,8 @@ namespace WebWindowComplex firstDisplay = false; // preview SVG senza HW await DoPreviewSvg(true, true); + if(LiveData.ProfElementList.Count == 0) + await UpdateElement(FrameWindow); } List reqList = SashList.Select(x => x.GroupId).ToList(); if (reqList.Count > 0) @@ -661,7 +674,7 @@ namespace WebWindowComplex } } - private async Task BuildFrameDefault() + private Task BuildFrameDefault() { // Costruisco window e setto i parametri Window window = new Window(); @@ -702,7 +715,7 @@ namespace WebWindowComplex string jwd = JsonConvert.SerializeObject(jsonWindow); JsonWindow WindowFromJson = JsonConvert.DeserializeObject(jwd, new PolymorphicJsonConverter()) ?? new JsonWindow("", "", "", ""); setCurrWindow(WindowFromJson); - await DoPreviewSvg(true); + return DoPreviewSvg(true); } /// @@ -833,6 +846,21 @@ namespace WebWindowComplex m_ItemTableList = new List(); CreateWindowsList((m_CurrWindow!).AreaList.First(), false); CreateElementTable(m_CurrWindow.AreaList.First(), 1, 1, 1, 1); + foreach (var item in ItemTableList) + { + if (item.NumChild > 4) + { + if (!RowCollapsed.ContainsKey(item.Row)) + { + RowCollapsed.Add(item.Row, false); + Child.Add(item.Row, item.NumChild); + } + } + else if(RowCollapsed.ContainsKey(item.Row)) + { + RowCollapsed.Remove(item.Row); + } + } } /// @@ -910,6 +938,11 @@ namespace WebWindowComplex private List m_FillList = new List(); private List m_SplittedList = new List(); + private Dictionary RowCollapsed { get; set; } = new Dictionary(); + private Dictionary Child { get; set; } = new Dictionary(); + + private static Logger Log = LogManager.GetCurrentClassLogger(); + #endregion Private Fields #region Private Properties @@ -954,29 +987,35 @@ namespace WebWindowComplex if (ListPayload.Hardware == null || ListPayload.Hardware.Count == 0) { listErrPre.Add("Hardware", "Missing Hardware List!"); + Log.Warn("Missing Hardware List"); } else { if (ListPayload.FamilyHardware == null || ListPayload.FamilyHardware.Count == 0) { listErrPre.Add("FamilyHardware", "Missing Family HW List!"); + Log.Warn(" Missing Family HW List"); } } if (ListPayload.Glass == null || ListPayload.Glass.Count == 0) { listErrPre.Add("Glass", "Missing Glass List!"); + Log.Warn(" Missing Glass List"); } if (ListPayload.Material == null || ListPayload.Material.Count == 0) { listErrPre.Add("Material", "Missing Material List!"); + Log.Warn(" Missing Material List"); } if (ListPayload.ColorMaterial == null || ListPayload.ColorMaterial.Count == 0) { listErrPre.Add("ColorMaterial", "Missing ColorMaterial List!"); + Log.Warn("Missing ColorMaterial List"); } if (ListPayload.ProfileList == null || ListPayload.ProfileList.Count == 0) { listErrPre.Add("Profile", "Missing Profile data!"); + Log.Warn("Missing Profile data"); } } @@ -1083,13 +1122,29 @@ namespace WebWindowComplex NextStep(newStep, Index); } + /// + /// Metodo per aggiornare il valore collassato degli elementi della gerarchia + /// + /// + private void CollapsedRowTree(Dictionary Args) + { + foreach(var item in Args) + { + RowCollapsed[item.Key] = Args[item.Key] ? true : false; + if (m_ItemTableList.FirstOrDefault(x => x.Row == item.Key) != null) + { + Child[item.Key] = m_ItemTableList.FirstOrDefault(x => x.Row == item.Key).NumChild; + } + } + } + /// /// Richiesta reset dizionario Shape con action /// /// - private async Task ReqResetDict(DataUpdateRes args) + private Task ReqResetDict(DataUpdateRes args) { - await EC_ActionReq.InvokeAsync(args.req); + return EC_ActionReq.InvokeAsync(args.req); } /// @@ -1153,7 +1208,7 @@ namespace WebWindowComplex /// /// Lista dei profili /// Id Area che si sta cercando - /// Id dell'anta (se -1 non usare) + /// Id dell'anta o dello split (se -1 non usare) /// private void UpdateProfileElement(List profileNameList, int GroupIdSearch, int EntityIdSearch) { @@ -1209,7 +1264,7 @@ namespace WebWindowComplex SpElemList.ElementAt(i).SetMinDimension(Window.m_ParameterList.GetValueOrDefault(SpElemList.ElementAt(i).sName + "_DimMin")); SpElemList.ElementAt(i).SetMaxDimension(Window.m_ParameterList.GetValueOrDefault(SpElemList.ElementAt(i).sName + "_DimMax")); string overlapName = string.Join("_", SpElemList.ElementAt(i).sName.Split('_').Skip(1)); - SpElemList.ElementAt(i).SetOverlapElement(Window.m_ParameterList.GetValueOrDefault(SpElemList.ElementAt(i).sName + "_Overlap")); + SpElemList.ElementAt(i).SetOverlapElement(Window.m_ParameterList.GetValueOrDefault(overlapName + "_Overlap")); } break; } @@ -1284,10 +1339,10 @@ namespace WebWindowComplex /// /// tipo di fill richiesto /// - protected async Task ChangeAllFill(FillTypes reqFillType) + protected Task ChangeAllFill(FillTypes reqFillType) { updateAllFill(FrameWindow, reqFillType); - await DoPreviewSvg(); + return DoPreviewSvg(); } /// @@ -1335,6 +1390,8 @@ namespace WebWindowComplex { Frame newFrame = args.currFrame; bool forceSvgNoHw = args.svgNoHw; + if (args.groupIdDelete != -1) + RowCollapsed.Remove(args.groupIdDelete); if (newFrame != null) { // cerco il record @@ -1547,6 +1604,7 @@ namespace WebWindowComplex // richiedo update shape List reqList = SashList.Select(x => x.GroupId).ToList(); await DoPreviewSvg(); + await UpdateElement(FrameWindow); await DoReqShape(reqList); } @@ -1597,7 +1655,6 @@ namespace WebWindowComplex return "btn btn-secondary btn-sm"; } - /// /// Metodo per ottenere lista groupId /// @@ -1614,6 +1671,7 @@ namespace WebWindowComplex } } } + #endregion Private Methods } } \ No newline at end of file diff --git a/WebWindowComplex/WebWindowComplex.csproj b/WebWindowComplex/WebWindowComplex.csproj index 6c7bead..76d5b81 100644 --- a/WebWindowComplex/WebWindowComplex.csproj +++ b/WebWindowComplex/WebWindowComplex.csproj @@ -6,7 +6,7 @@ net8.0 enable enable - 3.1.2.417 + 3.1.2.1710 Annamaria Sassi Egalware Componente gestione Configurazioni avanzate Window per LUX @@ -18,11 +18,16 @@ + + runtime; build; native; contentfiles; analyzers; buildtransitive + all + + @@ -55,6 +60,97 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/WebWindowConfigurator/WebWindowConfigurator.csproj b/WebWindowConfigurator/WebWindowConfigurator.csproj index fec646c..6b35485 100644 --- a/WebWindowConfigurator/WebWindowConfigurator.csproj +++ b/WebWindowConfigurator/WebWindowConfigurator.csproj @@ -6,7 +6,7 @@ net8.0 enable enable - 3.1.2.417 + 3.1.2.1710 Annamaria Sassi Egalware Componente gestione JWD per LUX @@ -78,6 +78,63 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/WebWindowTest/Test.razor.cs b/WebWindowTest/Test.razor.cs index 1e5be91..10e1484 100644 --- a/WebWindowTest/Test.razor.cs +++ b/WebWindowTest/Test.razor.cs @@ -481,8 +481,9 @@ namespace WebWindowTest /// /// Metodo di reset /// - protected async Task DoReset() + protected Task DoReset() { + return Task.CompletedTask; // Da fare }