diff --git a/README.md b/README.md index e68c0b7..2dd019f 100644 --- a/README.md +++ b/README.md @@ -1,93 +1,124 @@ # WebWindowConfigurator +Componente per configurare un serramento partendo da un JWD. + +Durante la configurazione ad ogni cambiamento viene aggiornata l'immagine del serramento. + +## Requisiti + +I requisiti per utilizzare il componente sono: + - JWD da modificare + - Lista delle famiglie hardware + - Lista hardware + - Lista dei materiali + - Lista dei colori dei materiali + - Lista dei vetri ammessi + - Lista dei profili gestiti + +## Funzionalità componente + +Il componente permette i seguenti comportamenti principali: + + - Aggiungere un gruppo di ante al telaio, + - Aggiungere uno split al telaio o a un anta, + - Copiare il contenuto di un'anta in un'altra anta, + - Eliminare un gruppo di ante, + - Eliminare uno split + +## JWD + +Il JWD descrive la struttura e le caratteristiche di un serramento. + +Un serramento è composto da un determinato tipo di elementi: + - Telaio (obbligatorio) + - Divisione (facoltativa) + - Gruppo ante (facoltativo) + - Riempimento (obbligatorio almeno un riempimento) + +All'intero serramento sono associate le seguenti caratteristiche: + - Profilo; + - Materiale; + - Vetro; + - Colore serramento. + +### Telaio (Frame) + +Al frame sono associate le seguenti caratteristiche: + - Forma; + - Dimensioni; + - Soglia; + - Giunti; + - Quantità bottom Rail. + +#### Forme Telaio + +Le forme ammesse per il telaio sono le seguenti: + - Arc + - Circle + - Custom + - FullArc + - Rectangle + - SemiArc + - SemiFullArc + - Trapezoid + +### Divisione (Split) + +Uno split genera sempre almeno due sottoaree contenenti ognuna un riempimento (Fill) di tipo vetro. +Se ci sono solo due sottoaree generate da uno split, si possono scambiare tra di loro. + +Uno split può essere: + - Orizzontale, definisco il numero di split orizzontali e l'altezza delle nuove aree orizzontali formate; + - Verticale, definisco il numero di split verticali e la larghezza delle nuove aree verticali formate; + - A griglia, definisco il numero di split orizzontali e verticali e l'altezza delle aree orizzontali e la larghezza delle aree verticali. + +### Gruppo di ante (Sash group) + +Al gruppo di ante sono associate le seguenti caratteristiche: + - Numero di ante; + - Orientamento; + - Quantità bottom rail; + - Giunti; + - Codice hardware. + +#### Singola anta + +La singola anta ha associate le seguenti caratteristiche: + - Tipologia di apertura; + - Dimensione; + - Se ha la maniglia. + +#### Hardware + +Per calcolare la lista di hardware ammessi data una famiglia di hardware servono i seguenti dati: + - Forma del gruppo di ante (tramite richiesta al programma di calcolo); + - Apertura dell'anta con la maniglia; + - Numero di ante; + - Posizione anta battente (nel caso di tre o più ante, bisogna sapere se l'anta con la maniglia è incernierata al telaio o a un'altra anta). + +La richiesta della forma del gruppo di ante viene trasmessa se si cambiano i seguenti parametri: + - Forma del telaio; + - Dimensioni del telaio; + - Aggiunta di uno split; + - ELiminazione di uno split. + +La lista degli hardware viene aggiornata se si cambiano i seguenti parametri: + - Forma del gruppo di ante; + - Numero ante nello stesso gruppo di ante; + - Se si sposta l'anta e cambia il tipo di apertura e/o la posizione dell'anta battente. + +### Riempimento (Fill) + +Descrive il tipo di riempimento: vetro o pannello. -## Getting started - -To make it easy for you to get started with GitLab, here's a list of recommended next steps. - -Already a pro? Just edit this README.md and make it your own. Want to make it easy? [Use the template at the bottom](#editing-this-readme)! - -## Add your files - -- [ ] [Create](https://docs.gitlab.com/ee/user/project/repository/web_editor.html#create-a-file) or [upload](https://docs.gitlab.com/ee/user/project/repository/web_editor.html#upload-a-file) files -- [ ] [Add files using the command line](https://docs.gitlab.com/topics/git/add_files/#add-files-to-a-git-repository) or push an existing Git repository with the following command: - -``` -cd existing_repo -git remote add origin https://gitlab.steamware.net/etis/webwindowconfigurator.git -git branch -M main -git push -uf origin main -``` - -## Integrate with your tools - -- [ ] [Set up project integrations](https://gitlab.steamware.net/etis/webwindowconfigurator/-/settings/integrations) - -## Collaborate with your team - -- [ ] [Invite team members and collaborators](https://docs.gitlab.com/ee/user/project/members/) -- [ ] [Create a new merge request](https://docs.gitlab.com/ee/user/project/merge_requests/creating_merge_requests.html) -- [ ] [Automatically close issues from merge requests](https://docs.gitlab.com/ee/user/project/issues/managing_issues.html#closing-issues-automatically) -- [ ] [Enable merge request approvals](https://docs.gitlab.com/ee/user/project/merge_requests/approvals/) -- [ ] [Set auto-merge](https://docs.gitlab.com/user/project/merge_requests/auto_merge/) - -## Test and Deploy - -Use the built-in continuous integration in GitLab. - -- [ ] [Get started with GitLab CI/CD](https://docs.gitlab.com/ee/ci/quick_start/) -- [ ] [Analyze your code for known vulnerabilities with Static Application Security Testing (SAST)](https://docs.gitlab.com/ee/user/application_security/sast/) -- [ ] [Deploy to Kubernetes, Amazon EC2, or Amazon ECS using Auto Deploy](https://docs.gitlab.com/ee/topics/autodevops/requirements.html) -- [ ] [Use pull-based deployments for improved Kubernetes management](https://docs.gitlab.com/ee/user/clusters/agent/) -- [ ] [Set up protected environments](https://docs.gitlab.com/ee/ci/environments/protected_environments.html) - -*** - -# Editing this README - -When you're ready to make this README your own, just edit this file and use the handy template below (or feel free to structure it however you want - this is just a starting point!). Thanks to [makeareadme.com](https://www.makeareadme.com/) for this template. - -## Suggestions for a good README - -Every project is different, so consider which of these sections apply to yours. The sections used in the template are suggestions for most open source projects. Also keep in mind that while a README can be too long and detailed, too long is better than too short. If you think your README is too long, consider utilizing another form of documentation rather than cutting out information. - -## Name -Choose a self-explaining name for your project. - -## Description -Let people know what your project can do specifically. Provide context and add a link to any reference visitors might be unfamiliar with. A list of Features or a Background subsection can also be added here. If there are alternatives to your project, this is a good place to list differentiating factors. - -## Badges -On some READMEs, you may see small images that convey metadata, such as whether or not all the tests are passing for the project. You can use Shields to add some to your README. Many services also have instructions for adding a badge. - -## Visuals -Depending on what you are making, it can be a good idea to include screenshots or even a video (you'll frequently see GIFs rather than actual videos). Tools like ttygif can help, but check out Asciinema for a more sophisticated method. - -## Installation -Within a particular ecosystem, there may be a common way of installing things, such as using Yarn, NuGet, or Homebrew. However, consider the possibility that whoever is reading your README is a novice and would like more guidance. Listing specific steps helps remove ambiguity and gets people to using your project as quickly as possible. If it only runs in a specific context like a particular programming language version or operating system or has dependencies that have to be installed manually, also add a Requirements subsection. - -## Usage -Use examples liberally, and show the expected output if you can. It's helpful to have inline the smallest example of usage that you can demonstrate, while providing links to more sophisticated examples if they are too long to reasonably include in the README. - -## Support -Tell people where they can go to for help. It can be any combination of an issue tracker, a chat room, an email address, etc. ## Roadmap -If you have ideas for releases in the future, it is a good idea to list them in the README. -## Contributing -State if you are open to contributions and what your requirements are for accepting them. - -For people who want to make changes to your project, it's helpful to have some documentation on how to get started. Perhaps there is a script that they should run or some environment variables that they need to set. Make these steps explicit. These instructions could also be useful to your future self. - -You can also document commands to lint the code or run tests. These steps help to ensure high code quality and reduce the likelihood that the changes inadvertently break something. Having instructions for running tests is especially helpful if it requires external setup, such as starting a Selenium server for testing in a browser. - -## Authors and acknowledgment -Show your appreciation to those who have contributed to the project. +Mancano: + - [ ] Gestione e inserimento opzioni hardware in CardSashGroup ; + - [ ] Filtrare hardware utilizzando anche la posizione dell'anta battente. ## License For open source projects, say how it is licensed. -## Project status -If you have run out of energy or time for your project, put a note at the top of the README saying that development has slowed down or stopped completely. Someone may choose to fork your project or volunteer to step in as a maintainer or owner, allowing your project to keep going. You can also make an explicit request for maintainers. diff --git a/README.pdf b/README.pdf new file mode 100644 index 0000000..e72c279 Binary files /dev/null and b/README.pdf differ diff --git a/Test.UI/Components/Pages/Aedifica.razor.cs b/Test.UI/Components/Pages/Aedifica.razor.cs index 6acc280..263b519 100644 --- a/Test.UI/Components/Pages/Aedifica.razor.cs +++ b/Test.UI/Components/Pages/Aedifica.razor.cs @@ -27,7 +27,7 @@ namespace Test.UI.Components.Pages public void Dispose() { - DLService.CalcDonePipe.EA_NewMessage -= CalcDonePipe_EA_NewMessage; + DLService.PipeSvg.EA_NewMessage -= PipeSvg_EA_NewMessage; } protected MarkupString JsonSer @@ -40,7 +40,7 @@ namespace Test.UI.Components.Pages protected override async Task OnInitializedAsync() { ConfInit(); - DLService.CalcDonePipe.EA_NewMessage += CalcDonePipe_EA_NewMessage; + DLService.PipeSvg.EA_NewMessage += PipeSvg_EA_NewMessage; //await ReloadData(); await Task.Delay(1); } @@ -67,7 +67,7 @@ namespace Test.UI.Components.Pages } } - private async void CalcDonePipe_EA_NewMessage(object? sender, EventArgs e) + private async void PipeSvg_EA_NewMessage(object? sender, EventArgs e) { // aggiorno visualizzazione PubSubEventArgs currArgs = (PubSubEventArgs)e; diff --git a/Test.UI/Components/Pages/EditJWD.razor.cs b/Test.UI/Components/Pages/EditJWD.razor.cs index 5b21eb7..44beea9 100644 --- a/Test.UI/Components/Pages/EditJWD.razor.cs +++ b/Test.UI/Components/Pages/EditJWD.razor.cs @@ -28,40 +28,11 @@ namespace Test.UI.Components.Pages #region Public Methods - /// - /// Comparatore euqlity obj dizionario - /// - /// - /// - /// - /// - /// - public bool DictionariesEqual(Dictionary dict1, Dictionary dict2) - { - // Handle null cases - if (dict1 == null || dict2 == null) - return dict1 == dict2; - - // Quick size check - if (dict1.Count != dict2.Count) - return false; - - // Compare each key-value pair - foreach (var kvp in dict1) - { - if (!dict2.TryGetValue(kvp.Key, out TValue value)) - return false; // Key missing in dict2 - - if (!EqualityComparer.Default.Equals(kvp.Value, value)) - return false; // Value mismatch - } - - return true; - } - public void Dispose() { - DLService.CalcDonePipe.EA_NewMessage -= CalcDonePipe_EA_NewMessage; + DLService.PipeSvg.EA_NewMessage -= PipeSvg_EA_NewMessage; + DLService.PipeShape.EA_NewMessage -= PipeShape_EA_NewMessage; + DLService.PipeHwOpt.EA_NewMessage -= PipeHwOption_EA_NewMessage; } #endregion Public Methods @@ -73,6 +44,8 @@ namespace Test.UI.Components.Pages /// protected LivePayload CurrData = new LivePayload(); + protected Dictionary currGroupShape = new Dictionary(); + protected Dictionary currHwOption = new Dictionary(); protected string currJwd = "..."; protected Dictionary m_CurrArgs = new Dictionary(); protected string prevJwd = ""; @@ -149,10 +122,20 @@ namespace Test.UI.Components.Pages #region Protected Methods + protected override void OnAfterRender(bool firstRender) + { + if (firstRender) + { + // JS interop or data fetches go here + isInteractive = true; + } + } + protected override async Task OnInitializedAsync() { ConfInit(); - InitialJwd = File.ReadAllText("Data\\AntaSingola.jwd"); + //InitialJwd = File.ReadAllText("Data\\FinestraDueAnteSeparate.jwd"); + InitialJwd = File.ReadAllText("Data\\AntaDoppia.jwd"); currJwd = InitialJwd; // rileggo altri dati await ReloadData(); @@ -162,8 +145,6 @@ namespace Test.UI.Components.Pages ColorMaterial = AvailColorMaterialList, FamilyHardware = AvailFamilyHardwareList, Glass = AvailGlassList, - //FamilyHardware = new List(), - //Material = new List(), Hardware = AvailHardwareList, Material = AvailMaterialList, Profile = AvailProfileList, @@ -172,9 +153,13 @@ namespace Test.UI.Components.Pages CurrData = new LivePayload() { CurrJwd = InitialJwd, - SvgPreview = currSvg + SvgPreview = currSvg, + DictShape = currGroupShape, + DictOptionsXml = currHwOption }; - DLService.CalcDonePipe.EA_NewMessage += CalcDonePipe_EA_NewMessage; + DLService.PipeSvg.EA_NewMessage += PipeSvg_EA_NewMessage; + DLService.PipeShape.EA_NewMessage += PipeShape_EA_NewMessage; + DLService.PipeHwOpt.EA_NewMessage += PipeHwOption_EA_NewMessage; } #endregion Protected Methods @@ -182,48 +167,53 @@ namespace Test.UI.Components.Pages #region Private Fields private string apiUrl = ""; + private string calcTag = ""; + private string CalcUid = "CurrWindow"; + private string cFileHardware = "Hardware/Setup.json"; + private string cFileTemplate = "Data/Setup.json"; + private string colorMassUpdate; + private TemplateSelectDTO? currSel = null; + private string currSvg = ""; private string familyHWMassUpdate; - private string GenericBasePath = ""; - private string glassMassUpdate; - private Hardware hardwareMassUpdate; - private string imgBasePath = ""; - private string materialMassUpdate; - private string outClose = ""; - private string outSave = ""; - private string profileMassUpdate; - private string subChannel = ""; + private string GenericBasePath = ""; + + private string glassMassUpdate; + + private Hardware hardwareMassUpdate; + + private string hwOptionChannel = ""; + private string imgBasePath = ""; + + /// + /// Semaforo x definire se sia già in modalità ionterattiva o di prerendering + /// + private bool isInteractive = false; + + private string materialMassUpdate; + + private string outClose = ""; + + private string outSave = ""; + + private string profileMassUpdate; + + private string shapeChannel = ""; + private string svgChannel = ""; private string windowUid = "CurrWindow"; #endregion Private Fields #region Private Methods - private async void CalcDonePipe_EA_NewMessage(object? sender, EventArgs e) - { - // aggiorno visualizzazione - PubSubEventArgs currArgs = (PubSubEventArgs)e; - // conversione on-the-fly SVG da mostrare - if (!string.IsNullOrEmpty(currArgs.newMessage)) - { - if (currArgs.msgUid.Equals($"{subChannel}:{windowUid}")) - { - currSvg = currArgs.newMessage; - CurrData.SvgPreview = currArgs.newMessage; - } - await InvokeAsync(StateHasChanged); - } - await Task.Delay(1); - } - /// /// Effettua chiusura oggetto con eventuale save /// @@ -240,30 +230,118 @@ namespace Test.UI.Components.Pages imgBasePath = Config.GetValue("ServerConf:ImageBaseUrl") ?? ""; GenericBasePath = Config.GetValue("ServerConf:GenericBaseUrl") ?? ""; calcTag = Config.GetValue("ServerConf:CalcTag") ?? ""; - subChannel = Config.GetValue("ServerConf:SvgChannel") ?? ""; + svgChannel = Config.GetValue("ServerConf:SvgChannel") ?? ""; + shapeChannel = Config.GetValue("ServerConf:ShapeChannel") ?? ""; + hwOptionChannel = Config.GetValue("ServerConf:HwOptChannel") ?? ""; } + /// + /// Esecuzione richiesta + /// + /// + /// private async Task ExecRequest(Dictionary CurrArgs) { - outClose = ""; - outSave = ""; - // verifico se contiene JWD, lo aggiorno - if (CurrArgs.ContainsKey("Jwd")) + // Proseguo solo se sono in interattivo (NO prerender pagina) + if (isInteractive) { - currJwd = CurrArgs["Jwd"]; - CurrData.CurrJwd = currJwd; + outClose = ""; + outSave = ""; + // verifico se contiene JWD, lo aggiorno + if (CurrArgs.ContainsKey("Jwd")) + { + currJwd = CurrArgs["Jwd"]; + CurrData.CurrJwd = currJwd; + } + // se il SSE variato --> invio + if (!currJwd.Equals(prevJwd) || !EgwCoreLib.Lux.Core.DictUtils.DictAreEqual(m_CurrArgs, CurrArgs)) + { + m_CurrArgs = CurrArgs; + prevJwd = currJwd; + CalcRequestDTO calcRequestDTO = new CalcRequestDTO(); + calcRequestDTO.EnvType = EgwMultiEngineManager.Data.Constants.EXECENVIRONMENTS.WINDOW; + calcRequestDTO.DictExec = m_CurrArgs; + // chiamo la chiamata POST alla API, che manda la richiesta via REDIS + await ICService.CallRestPost($"{apiUrl}/{GenericBasePath}", $"{calcTag}/{CalcUid}", calcRequestDTO); + } } - // se il SSE variato --> invio - if (!currJwd.Equals(prevJwd) || !DictionariesEqual(m_CurrArgs, CurrArgs)) + } + + private async void PipeHwOption_EA_NewMessage(object? sender, EventArgs e) + { + // aggiorno visualizzazione + PubSubEventArgs currArgs = (PubSubEventArgs)e; + // conversione on-the-fly SVG da mostrare + if (!string.IsNullOrEmpty(currArgs.newMessage)) { - m_CurrArgs = CurrArgs; - prevJwd = currJwd; - CalcRequestDTO calcRequestDTO = new CalcRequestDTO(); - calcRequestDTO.EnvType = EgwMultiEngineManager.Data.Constants.EXECENVIRONMENTS.WINDOW; - calcRequestDTO.DictExec = m_CurrArgs; - // chiamo la chiamata POST alla API, che manda la richiesta via REDIS - await ICService.CallRestPost($"{apiUrl}/{GenericBasePath}", $"{calcTag}/{CalcUid}", calcRequestDTO); + if (currArgs.msgUid.StartsWith($"{hwOptionChannel}:{windowUid}")) + { + /*-------------------------------------- + * FixMe Todo levare !!! + * - try/catch deserializzazione + * - se fallisse metto le stesse opzioni a ttuti i GroupId + **--------------------------------------*/ + Dictionary rawDict = new Dictionary(); + try + { + // deserializzo il dizionario delle risposte... + rawDict = JsonConvert.DeserializeObject>(currArgs.newMessage) ?? new Dictionary(); + } + catch + { } + if (rawDict.Count == 0) + { + //se il dizionario delle shape esiste uso quello... + if (CurrData.DictShape.Count > 0) + { + foreach (var item in CurrData.DictShape) + { + rawDict.Add(item.Key, currArgs.newMessage); + } + } + } + currHwOption = rawDict ?? new Dictionary(); + CurrData.DictOptionsXml = currHwOption; + } + await InvokeAsync(StateHasChanged); } + await Task.Delay(1); + } + + private async void PipeShape_EA_NewMessage(object? sender, EventArgs e) + { + // aggiorno visualizzazione + PubSubEventArgs currArgs = (PubSubEventArgs)e; + // conversione on-the-fly SVG da mostrare + if (!string.IsNullOrEmpty(currArgs.newMessage) && currArgs.newMessage.Length > 2) + { + if (currArgs.msgUid.StartsWith($"{shapeChannel}:{windowUid}")) + { + // deserializzo il dizionario delle risposte... + var rawDict = JsonConvert.DeserializeObject>(currArgs.newMessage); + currGroupShape = rawDict ?? new Dictionary(); + CurrData.DictShape = currGroupShape; + } + await InvokeAsync(StateHasChanged); + } + await Task.Delay(1); + } + + private async void PipeSvg_EA_NewMessage(object? sender, EventArgs e) + { + // aggiorno visualizzazione + PubSubEventArgs currArgs = (PubSubEventArgs)e; + // conversione on-the-fly SVG da mostrare + if (!string.IsNullOrEmpty(currArgs.newMessage)) + { + if (currArgs.msgUid.Equals($"{svgChannel}:{windowUid}")) + { + currSvg = currArgs.newMessage; + CurrData.SvgPreview = currArgs.newMessage; + } + await InvokeAsync(StateHasChanged); + } + await Task.Delay(1); } /// diff --git a/Test.UI/Components/Pages/Gerarchia.razor.cs b/Test.UI/Components/Pages/Gerarchia.razor.cs index 010780f..39bcbad 100644 --- a/Test.UI/Components/Pages/Gerarchia.razor.cs +++ b/Test.UI/Components/Pages/Gerarchia.razor.cs @@ -25,7 +25,7 @@ namespace Test.UI.Components.Pages public void Dispose() { - DLService.CalcDonePipe.EA_NewMessage -= CalcDonePipe_EA_NewMessage; + DLService.PipeSvg.EA_NewMessage -= PipeSvg_EA_NewMessage; } #endregion Public Methods @@ -96,7 +96,7 @@ namespace Test.UI.Components.Pages SelColorMaterial = "Black"; SelMaterial = "Pine"; SelGlass = "4T/16/4T"; - DLService.CalcDonePipe.EA_NewMessage += CalcDonePipe_EA_NewMessage; + DLService.PipeSvg.EA_NewMessage += PipeSvg_EA_NewMessage; await ReloadData(); } @@ -123,7 +123,7 @@ namespace Test.UI.Components.Pages #region Private Methods - private async void CalcDonePipe_EA_NewMessage(object? sender, EventArgs e) + private async void PipeSvg_EA_NewMessage(object? sender, EventArgs e) { // aggiorno visualizzazione PubSubEventArgs currArgs = (PubSubEventArgs)e; diff --git a/Test.UI/Components/Pages/Home.razor.cs b/Test.UI/Components/Pages/Home.razor.cs index b28dd71..e749c4c 100644 --- a/Test.UI/Components/Pages/Home.razor.cs +++ b/Test.UI/Components/Pages/Home.razor.cs @@ -20,7 +20,7 @@ namespace Test.UI.Components.Pages public void Dispose() { - DLService.CalcDonePipe.EA_NewMessage -= CalcDonePipe_EA_NewMessage; + DLService.PipeSvg.EA_NewMessage -= PipeSvg_EA_NewMessage; } #endregion Public Methods @@ -62,7 +62,7 @@ namespace Test.UI.Components.Pages { isLoading = true; ConfInit(); - DLService.CalcDonePipe.EA_NewMessage += CalcDonePipe_EA_NewMessage; + DLService.PipeSvg.EA_NewMessage += PipeSvg_EA_NewMessage; await ReloadData(); } @@ -105,7 +105,7 @@ namespace Test.UI.Components.Pages #region Private Methods - private async void CalcDonePipe_EA_NewMessage(object? sender, EventArgs e) + private async void PipeSvg_EA_NewMessage(object? sender, EventArgs e) { // aggiorno visualizzazione PubSubEventArgs currArgs = (PubSubEventArgs)e; diff --git a/Test.UI/Components/Pages/TestComponentJWD.razor.cs b/Test.UI/Components/Pages/TestComponentJWD.razor.cs index 6e8cd90..38f9c50 100644 --- a/Test.UI/Components/Pages/TestComponentJWD.razor.cs +++ b/Test.UI/Components/Pages/TestComponentJWD.razor.cs @@ -25,7 +25,7 @@ namespace Test.UI.Components.Pages public void Dispose() { - DLService.CalcDonePipe.EA_NewMessage -= CalcDonePipe_EA_NewMessage; + DLService.PipeSvg.EA_NewMessage -= PipeSvg_EA_NewMessage; } #endregion Public Methods @@ -98,7 +98,7 @@ namespace Test.UI.Components.Pages //SelGlass = "4T/16/4T"; InitialJwd = File.ReadAllText("Data\\FinDueAnteBottomFisso.jwd"); currJwd = InitialJwd; - DLService.CalcDonePipe.EA_NewMessage += CalcDonePipe_EA_NewMessage; + DLService.PipeSvg.EA_NewMessage += PipeSvg_EA_NewMessage; await ReloadData(); } @@ -125,7 +125,7 @@ namespace Test.UI.Components.Pages #region Private Methods - private async void CalcDonePipe_EA_NewMessage(object? sender, EventArgs e) + private async void PipeSvg_EA_NewMessage(object? sender, EventArgs e) { // aggiorno visualizzazione PubSubEventArgs currArgs = (PubSubEventArgs)e; diff --git a/Test.UI/Components/Pages/TestComponentTemplate.razor.cs b/Test.UI/Components/Pages/TestComponentTemplate.razor.cs index faeb0d8..efb1b5d 100644 --- a/Test.UI/Components/Pages/TestComponentTemplate.razor.cs +++ b/Test.UI/Components/Pages/TestComponentTemplate.razor.cs @@ -25,7 +25,7 @@ namespace Test.UI.Components.Pages public void Dispose() { - DLService.CalcDonePipe.EA_NewMessage -= CalcDonePipe_EA_NewMessage; + DLService.PipeSvg.EA_NewMessage -= PipeSvg_EA_NewMessage; } #endregion Public Methods @@ -96,7 +96,7 @@ namespace Test.UI.Components.Pages SelColorMaterial = "Black"; SelMaterial = "Pine"; SelGlass = "4T/16/4T"; - DLService.CalcDonePipe.EA_NewMessage += CalcDonePipe_EA_NewMessage; + DLService.PipeSvg.EA_NewMessage += PipeSvg_EA_NewMessage; await ReloadData(); } @@ -123,7 +123,7 @@ namespace Test.UI.Components.Pages #region Private Methods - private async void CalcDonePipe_EA_NewMessage(object? sender, EventArgs e) + private async void PipeSvg_EA_NewMessage(object? sender, EventArgs e) { // aggiorno visualizzazione PubSubEventArgs currArgs = (PubSubEventArgs)e; diff --git a/Test.UI/Data/AntaDoppia.jwd b/Test.UI/Data/AntaDoppia.jwd index daa1816..eeb3733 100644 --- a/Test.UI/Data/AntaDoppia.jwd +++ b/Test.UI/Data/AntaDoppia.jwd @@ -8,82 +8,114 @@ "Shape": "RECTANGLE", "DimensionList": [ { - "nIndex": 1, - "sName": "Width", - "dValue": 1200.0 + "Index": 1, + "Name": "Width", + "Value": 800.0 }, { - "nIndex": 2, - "sName": "Height", - "dValue": 1500.0 + "Index": 2, + "Name": "Height", + "Value": 1200.0 } ], "JointList": [ { - "nIndex": 1, - "JointType": "FULL_V" + "Index": 1, + "JointType": "FULL_H" }, { - "nIndex": 2, - "JointType": "FULL_V" + "Index": 2, + "JointType": "FULL_H" }, { - "nIndex": 3, - "JointType": "FULL_V" + "Index": 3, + "JointType": "FULL_H" }, { - "nIndex": 4, - "JointType": "FULL_V" + "Index": 4, + "JointType": "FULL_H" } ], "BottomRail": false, "BottomRailQty": 0, - "IdGroup": 1, + "GroupId": 1, "AreaList": [ { - "bIsSashVertical": true, + "IsSashVertical": true, "SashList": [ { - "nSashId": 1, - "OpeningType": "TURNONLY_LEFT", - "bHasHandle": false, - "dDimension": 50.0 + "SashId": 1, + "OpeningType": "TILTTURN_LEFT", + "HasHandle": true, + "Dimension": 50.0 }, { - "nSashId": 2, - "OpeningType": "TILTTURN_RIGHT", - "bHasHandle": true, - "dDimension": 50.0 + "SashId": 2, + "OpeningType": "TURNONLY_RIGHT", + "HasHandle": false, + "Dimension": 50.0 } ], "SashType": "NULL", "JointList": [ { - "nIndex": 1, - "JointType": "FULL_V" + "Index": 1, + "JointType": "FULL_H" }, { - "nIndex": 2, - "JointType": "FULL_V" + "Index": 2, + "JointType": "FULL_H" }, { - "nIndex": 3, - "JointType": "FULL_V" + "Index": 3, + "JointType": "FULL_H" }, { - "nIndex": 4, - "JointType": "FULL_V" + "Index": 4, + "JointType": "FULL_H" } ], - "Hardware": "000631", - "IdGroup": 2, + "BottomRail": false, + "BottomRailQty": 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" + } + ], + "GroupId": 2, "AreaList": [ { - "IdGroup": 3, + "GroupId": 4, "AreaList": [ { - "IdGroup": 4, "FillType": "GLASS", + "GroupId": 3, "AreaList": [], "AreaType": "FILL" } @@ -91,11 +123,11 @@ "AreaType": "SPLITTED" }, { - "IdGroup": 5, + "GroupId": 5, "AreaList": [ { "FillType": "GLASS", - "IdGroup": 6, + "GroupId": 6, "AreaList": [], "AreaType": "FILL" } diff --git a/Test.UI/Data/AntaSingola.jwd b/Test.UI/Data/AntaSingola.jwd index 60f3330..4ccc9d1 100644 --- a/Test.UI/Data/AntaSingola.jwd +++ b/Test.UI/Data/AntaSingola.jwd @@ -8,73 +8,103 @@ "Shape": "RECTANGLE", "DimensionList": [ { - "nIndex": 1, - "sName": "Width", - "dValue": 800.0 + "Index": 1, + "Name": "Width", + "Value": 800.0 }, { - "nIndex": 2, - "sName": "Height", - "dValue": 1200.0 + "Index": 2, + "Name": "Height", + "Value": 1200.0 } ], "JointList": [ { - "nIndex": 1, + "Index": 1, "JointType": "FULL_H" }, { - "nIndex": 2, + "Index": 2, "JointType": "FULL_H" }, { - "nIndex": 3, + "Index": 3, "JointType": "FULL_H" }, { - "nIndex": 4, + "Index": 4, "JointType": "FULL_H" } ], "BottomRail": false, "BottomRailQty": 0, - "IdGroup": 1, + "GroupId": 1, "AreaList": [ { - "bIsSashVertical": true, + "IsSashVertical": true, "SashList": [ { - "nSashId": 1, + "SashId": 1, "OpeningType": "TILTTURN_LEFT", - "bHasHandle": true, - "dDimension": 100.0 + "HasHandle": true, + "Dimension": 100.0 } ], "SashType": "NULL", "JointList": [ { - "nIndex": 1, + "Index": 1, "JointType": "FULL_H" }, { - "nIndex": 2, + "Index": 2, "JointType": "FULL_H" }, { - "nIndex": 3, + "Index": 3, "JointType": "FULL_H" }, { - "nIndex": 4, + "Index": 4, "JointType": "FULL_H" } ], "Hardware": "000635", - "IdGroup": 2, + "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" + } + ], + "GroupId": 2, "AreaList": [ { "FillType": "GLASS", - "IdGroup": 3, + "GroupId": 3, "AreaList": [], "AreaType": "FILL" } diff --git a/Test.UI/Data/FinDueAnteBottomFisso.jwd b/Test.UI/Data/FinDueAnteBottomFisso.jwd index f36e5e4..c1d8530 100644 --- a/Test.UI/Data/FinDueAnteBottomFisso.jwd +++ b/Test.UI/Data/FinDueAnteBottomFisso.jwd @@ -8,37 +8,37 @@ "Shape": "RECTANGLE", "DimensionList": [ { - "nIndex": 1, - "sName": "Width", - "dValue": 1500.0 + "Index": 1, + "Name": "Width", + "Value": 1500.0 }, { - "nIndex": 2, - "sName": "Height", - "dValue": 2100.0 + "Index": 2, + "Name": "Height", + "Value": 2100.0 } ], "JointList": [ { - "nIndex": 1, + "Index": 1, "JointType": "FULL_H" }, { - "nIndex": 2, + "Index": 2, "JointType": "FULL_H" }, { - "nIndex": 3, + "Index": 3, "JointType": "FULL_H" }, { - "nIndex": 4, + "Index": 4, "JointType": "FULL_H" } ], "BottomRail": false, "BottomRailQty": 0, - "IdGroup": 1, + "GroupId": 1, "AreaList": [ { "SplitShape": "HORIZONTAL", @@ -46,22 +46,22 @@ "SplitVertList": [], "SplitHorizList": [ { - "bIsRelative": true, - "dDimension": 40.0 + "IsRelative": true, + "Dimension": 40.0 }, { - "bIsRelative": true, - "dDimension": 60.0 + "IsRelative": true, + "Dimension": 60.0 } ], - "IdGroup": 2, + "GroupId": 2, "AreaList": [ { - "IdGroup": 3, + "GroupId": 3, "AreaList": [ { "FillType": "GLASS", - "IdGroup": 4, + "GroupId": 4, "AreaList": [], "AreaType": "FILL" } @@ -69,52 +69,82 @@ "AreaType": "SPLITTED" }, { - "IdGroup": 5, + "GroupId": 5, "AreaList": [ { - "bIsSashVertical": true, + "IsSashVertical": true, "SashList": [ { - "nSashId": 1, + "SashId": 1, "OpeningType": "TURNONLY_LEFT", - "bHasHandle": false, - "dDimension": 50.0 + "HasHandle": false, + "Dimension": 50.0 }, { - "nSashId": 2, + "SashId": 2, "OpeningType": "TILTTURN_RIGHT", - "bHasHandle": true, - "dDimension": 50.0 + "HasHandle": true, + "Dimension": 50.0 } ], "SashType": "NULL", "JointList": [ { - "nIndex": 1, + "Index": 1, "JointType": "FULL_H" }, { - "nIndex": 2, + "Index": 2, "JointType": "FULL_H" }, { - "nIndex": 3, + "Index": 3, "JointType": "FULL_H" }, { - "nIndex": 4, + "Index": 4, "JointType": "FULL_H" } ], "Hardware": "000631", - "IdGroup": 6, + "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" + } + ], + "GroupId": 6, "AreaList": [ { - "IdGroup": 7, + "GroupId": 7, "AreaList": [ { "FillType": "GLASS", - "IdGroup": 8, + "GroupId": 8, "AreaList": [], "AreaType": "FILL" } @@ -122,11 +152,11 @@ "AreaType": "SPLITTED" }, { - "IdGroup": 9, + "GroupId": 9, "AreaList": [ { "FillType": "GLASS", - "IdGroup": 10, + "GroupId": 10, "AreaList": [], "AreaType": "FILL" } diff --git a/Test.UI/Data/FinestraDueAnteSeparate.jwd b/Test.UI/Data/FinestraDueAnteSeparate.jwd index 5bedcb0..e4392b0 100644 --- a/Test.UI/Data/FinestraDueAnteSeparate.jwd +++ b/Test.UI/Data/FinestraDueAnteSeparate.jwd @@ -8,99 +8,129 @@ "Shape": "DOUBLECHAMFER", "DimensionList": [ { - "nIndex": 1, - "sName": "Width", - "dValue": 1500.0 + "Index": 1, + "Name": "Width", + "Value": 1500.0 }, { - "nIndex": 2, - "sName": "Height", - "dValue": 1500.0 + "Index": 2, + "Name": "Height", + "Value": 1500.0 }, { - "nIndex": 3, - "sName": "Full Height", - "dValue": 1800.0 + "Index": 3, + "Name": "Full Height", + "Value": 1800.0 } ], "JointList": [ { - "nIndex": 1, + "Index": 1, "JointType": "FULL_H" }, { - "nIndex": 2, + "Index": 2, "JointType": "FULL_H" }, { - "nIndex": 3, + "Index": 3, "JointType": "FULL_H" }, { - "nIndex": 4, + "Index": 4, "JointType": "FULL_H" } ], "BottomRail": false, "BottomRailQty": 0, - "IdGroup": 1, + "GroupId": 1, "AreaList": [ { "SplitShape": "VERTICAL", "SplitStartVert": true, "SplitVertList": [ { - "bIsRelative": true, - "dDimension": 50.0 + "IsRelative": true, + "Dimension": 50.0 }, { - "bIsRelative": true, - "dDimension": 50.0 + "IsRelative": true, + "Dimension": 50.0 } ], "SplitHorizList": [], - "IdGroup": 2, + "GroupId": 2, "AreaList": [ { - "IdGroup": 3, + "GroupId": 3, "AreaList": [ { - "bIsSashVertical": true, + "IsSashVertical": true, "SashList": [ { - "nSashId": 1, + "SashId": 1, "OpeningType": "TILTTURN_LEFT", - "bHasHandle": true, - "dDimension": 100.0 + "HasHandle": true, + "Dimension": 100.0 } ], "SashType": "NULL", "JointList": [ { - "nIndex": 1, + "Index": 1, "JointType": "FULL_H" }, { - "nIndex": 2, + "Index": 2, "JointType": "FULL_H" }, { - "nIndex": 3, + "Index": 3, "JointType": "FULL_H" }, { - "nIndex": 4, + "Index": 4, "JointType": "FULL_H" } ], "BottomRail": false, "BottomRailQty": 0, "Hardware": "000000", - "IdGroup": 4, + "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" + } + ], + "GroupId": 4, "AreaList": [ { "FillType": "GLASS", - "IdGroup": 5, + "GroupId": 5, "AreaList": [], "AreaType": "FILL" } @@ -111,45 +141,75 @@ "AreaType": "SPLITTED" }, { - "IdGroup": 6, + "GroupId": 6, "AreaList": [ { - "bIsSashVertical": true, + "IsSashVertical": true, "SashList": [ { - "nSashId": 1, + "SashId": 1, "OpeningType": "TILTTURN_RIGHT", - "bHasHandle": true, - "dDimension": 100.0 + "HasHandle": true, + "Dimension": 100.0 } ], "SashType": "NULL", "JointList": [ { - "nIndex": 1, + "Index": 1, "JointType": "FULL_H" }, { - "nIndex": 2, + "Index": 2, "JointType": "FULL_H" }, { - "nIndex": 3, + "Index": 3, "JointType": "FULL_H" }, { - "nIndex": 4, + "Index": 4, "JointType": "FULL_H" } ], "BottomRail": false, "BottomRailQty": 0, "Hardware": "000000", - "IdGroup": 7, + "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" + } + ], + "GroupId": 7, "AreaList": [ { "FillType": "GLASS", - "IdGroup": 8, + "GroupId": 8, "AreaList": [], "AreaType": "FILL" } diff --git a/Test.UI/Data/FinestraSplitGrid.jwd b/Test.UI/Data/FinestraSplitGrid.jwd index ba61d49..2782718 100644 --- a/Test.UI/Data/FinestraSplitGrid.jwd +++ b/Test.UI/Data/FinestraSplitGrid.jwd @@ -8,73 +8,73 @@ "Shape": "RECTANGLE", "DimensionList": [ { - "nIndex": 1, - "sName": "Width", - "dValue": 1500.0 + "Index": 1, + "Name": "Width", + "Value": 1500.0 }, { - "nIndex": 2, - "sName": "Height", - "dValue": 1800.0 + "Index": 2, + "Name": "Height", + "Value": 1800.0 } ], "JointList": [ { - "nIndex": 1, + "Index": 1, "JointType": "FULL_H" }, { - "nIndex": 2, + "Index": 2, "JointType": "FULL_H" }, { - "nIndex": 3, + "Index": 3, "JointType": "FULL_H" }, { - "nIndex": 4, + "Index": 4, "JointType": "FULL_H" } ], "BottomRail": false, "BottomRailQty": 0, - "IdGroup": 1, + "GroupId": 1, "AreaList": [ { "SplitShape": "GRID", "SplitStartVert": false, "SplitVertList": [ { - "bIsRelative": true, - "dDimension": 50.0 + "IsRelative": true, + "Dimension": 50.0 }, { - "bIsRelative": true, - "dDimension": 50.0 + "IsRelative": true, + "Dimension": 50.0 } ], "SplitHorizList": [ { - "bIsRelative": true, - "dDimension": 30.0 + "IsRelative": true, + "Dimension": 30.0 }, { - "bIsRelative": true, - "dDimension": 40.0 + "IsRelative": true, + "Dimension": 40.0 }, { - "bIsRelative": true, - "dDimension": 30.0 + "IsRelative": true, + "Dimension": 30.0 } ], - "IdGroup": 2, + "GroupId": 2, "AreaList": [ { - "IdGroup": 3, + "GroupId": 3, "AreaList": [ { "FillType": "GLASS", - "IdGroup": 4, + "GroupId": 4, "AreaList": [], "AreaType": "FILL" } @@ -82,11 +82,11 @@ "AreaType": "SPLITTED" }, { - "IdGroup": 5, + "GroupId": 5, "AreaList": [ { "FillType": "GLASS", - "IdGroup": 6, + "GroupId": 6, "AreaList": [], "AreaType": "FILL" } @@ -94,11 +94,11 @@ "AreaType": "SPLITTED" }, { - "IdGroup": 7, + "GroupId": 7, "AreaList": [ { "FillType": "GLASS", - "IdGroup": 8, + "GroupId": 8, "AreaList": [], "AreaType": "FILL" } @@ -106,11 +106,11 @@ "AreaType": "SPLITTED" }, { - "IdGroup": 9, + "GroupId": 9, "AreaList": [ { "FillType": "GLASS", - "IdGroup": 10, + "GroupId": 10, "AreaList": [], "AreaType": "FILL" } @@ -118,11 +118,11 @@ "AreaType": "SPLITTED" }, { - "IdGroup": 11, + "GroupId": 11, "AreaList": [ { "FillType": "GLASS", - "IdGroup": 12, + "GroupId": 12, "AreaList": [], "AreaType": "FILL" } @@ -130,11 +130,11 @@ "AreaType": "SPLITTED" }, { - "IdGroup": 13, + "GroupId": 13, "AreaList": [ { "FillType": "GLASS", - "IdGroup": 14, + "GroupId": 14, "AreaList": [], "AreaType": "FILL" } diff --git a/Test.UI/Data/FinestraSplitVert.jwd b/Test.UI/Data/FinestraSplitVert.jwd index 2651f19..d3feecc 100644 --- a/Test.UI/Data/FinestraSplitVert.jwd +++ b/Test.UI/Data/FinestraSplitVert.jwd @@ -8,60 +8,60 @@ "Shape": "RECTANGLE", "DimensionList": [ { - "nIndex": 1, - "sName": "Width", - "dValue": 1500.0 + "Index": 1, + "Name": "Width", + "Value": 1500.0 }, { - "nIndex": 2, - "sName": "Height", - "dValue": 1800.0 + "Index": 2, + "Name": "Height", + "Value": 1800.0 } ], "JointList": [ { - "nIndex": 1, + "Index": 1, "JointType": "FULL_H" }, { - "nIndex": 2, + "Index": 2, "JointType": "FULL_H" }, { - "nIndex": 3, + "Index": 3, "JointType": "FULL_H" }, { - "nIndex": 4, + "Index": 4, "JointType": "FULL_H" } ], "BottomRail": false, "BottomRailQty": 0, - "IdGroup": 1, + "GroupId": 1, "AreaList": [ { "SplitShape": "VERTICAL", "SplitStartVert": true, "SplitVertList": [ { - "bIsRelative": true, - "dDimension": 50.0 + "IsRelative": true, + "Dimension": 50.0 }, { - "bIsRelative": true, - "dDimension": 50.0 + "IsRelative": true, + "Dimension": 50.0 } ], "SplitHorizList": [], - "IdGroup": 2, + "GroupId": 2, "AreaList": [ { - "IdGroup": 3, + "GroupId": 3, "AreaList": [ { "FillType": "GLASS", - "IdGroup": 4, + "GroupId": 4, "AreaList": [], "AreaType": "FILL" } @@ -69,11 +69,11 @@ "AreaType": "SPLITTED" }, { - "IdGroup": 5, + "GroupId": 5, "AreaList": [ { "FillType": "GLASS", - "IdGroup": 6, + "GroupId": 6, "AreaList": [], "AreaType": "FILL" } diff --git a/Test.UI/Hardware/Setup.json b/Test.UI/Hardware/Setup.json index 25b20a0..69b182c 100644 --- a/Test.UI/Hardware/Setup.json +++ b/Test.UI/Hardware/Setup.json @@ -4,7 +4,7 @@ "familyName": "ArTech", "description": "ArTech_Aria12", "openingType": "TiltTurn", - "shape": "Rectangular", + "shape": "Rectangle", "sashQty": 3, "sashPosition": 1 }, @@ -13,7 +13,7 @@ "familyName": "ArTechPlana", "description": "ArTechPlana_Aria4", "openingType": "TurnOnly", - "shape": "Rectangular", + "shape": "Rectangle", "sashQty": 2, "sashPosition": 1 }, @@ -31,7 +31,7 @@ "familyName": "ArTechPlana", "description": "ArTechPlana_Aria4", "openingType": "TurnOnly", - "shape": "Rectangular", + "shape": "Rectangle", "sashQty": 1, "sashPosition": 1 }, @@ -58,7 +58,7 @@ "familyName": "ArTechPlana", "description": "ArTechPlana_Aria4", "openingType": "TiltTurn", - "shape": "Rectangular", + "shape": "Rectangle", "sashQty": 3, "sashPosition": 1 }, @@ -67,7 +67,7 @@ "familyName": "ArTech", "description": "ArTech_Aria12", "openingType": "TurnOnly", - "shape": "Rectangular", + "shape": "Rectangle", "sashQty": 2, "sashPosition": 1 }, @@ -94,7 +94,7 @@ "familyName": "ArTechPlana", "description": "ArTechPlana_Aria4", "openingType": "TiltTurn", - "shape": "Rectangular", + "shape": "Rectangle", "sashQty": 1, "sashPosition": 1 }, @@ -112,7 +112,7 @@ "familyName": "ArTech", "description": "ArTech_Aria4", "openingType": "TiltTurn", - "shape": "Rectangular", + "shape": "Rectangle", "sashQty": 2, "sashPosition": 1 }, @@ -130,7 +130,7 @@ "familyName": "ArTech", "description": "ArTech_Aria4_Centrale", "openingType": "TurnOnly", - "shape": "Rectangular", + "shape": "Rectangle", "sashQty": 3, "sashPosition": 2 }, @@ -139,7 +139,7 @@ "familyName": "ArTech", "description": "ArTech_Aria12", "openingType": "TiltTurn", - "shape": "Trapezoidal", + "shape": "Trapezoid", "sashQty": 2, "sashPosition": 1 }, @@ -148,7 +148,7 @@ "familyName": "ArTech", "description": "ArTech_Aria4_CerniereScomparsa", "openingType": "TiltTurn", - "shape": "Rectangular", + "shape": "Rectangle", "sashQty": 3, "sashPosition": 1 }, @@ -157,7 +157,7 @@ "familyName": "ArTech", "description": "ArTech_Aria12", "openingType": "TiltTurn", - "shape": "Rectangular", + "shape": "Rectangle", "sashQty": 1, "sashPosition": 1 }, @@ -166,7 +166,7 @@ "familyName": "ArTechPlana", "description": "ArTechPlana_Aria12", "openingType": "TurnOnly", - "shape": "Rectangular", + "shape": "Rectangle", "sashQty": 2, "sashPosition": 1 }, @@ -175,7 +175,7 @@ "familyName": "ArTech", "description": "ArTech_Aria12", "openingType": "TurnOnly", - "shape": "Rectangular", + "shape": "Rectangle", "sashQty": 4, "sashPosition": 2 }, @@ -193,7 +193,7 @@ "familyName": "ArTechPlana", "description": "ArTechPlana_Aria12_Centrale", "openingType": "TurnOnly", - "shape": "Rectangular", + "shape": "Rectangle", "sashQty": 3, "sashPosition": 2 }, @@ -220,7 +220,7 @@ "familyName": "ArTechPlana", "description": "ArTechPlana_Aria12", "openingType": "TiltTurn", - "shape": "Rectangular", + "shape": "Rectangle", "sashQty": 1, "sashPosition": 1 }, @@ -229,7 +229,7 @@ "familyName": "ArTechPlana", "description": "ArTechPlana_Aria4", "openingType": "TurnOnly", - "shape": "Rectangular", + "shape": "Rectangle", "sashQty": 4, "sashPosition": 2 }, @@ -238,7 +238,7 @@ "familyName": "ArTech", "description": "ArTech_Aria12", "openingType": "TiltTurn", - "shape": "Rectangular", + "shape": "Rectangle", "sashQty": 2, "sashPosition": 1 }, @@ -247,7 +247,7 @@ "familyName": "ArTechPlana", "description": "ArTechPlana_Aria4_Centrale", "openingType": "TurnOnly", - "shape": "Rectangular", + "shape": "Rectangle", "sashQty": 3, "sashPosition": 2 }, @@ -256,7 +256,7 @@ "familyName": "ArTech", "description": "ArTech_Aria4", "openingType": "TiltTurn", - "shape": "Rectangular", + "shape": "Rectangle", "sashQty": 3, "sashPosition": 1 }, @@ -265,7 +265,7 @@ "familyName": "ArTech", "description": "ArTech_Aria12_Centrale", "openingType": "TurnOnly", - "shape": "Rectangular", + "shape": "Rectangle", "sashQty": 3, "sashPosition": 2 }, @@ -292,7 +292,7 @@ "familyName": "ArTechPlana", "description": "ArTechPlana_Aria12", "openingType": "TiltTurn", - "shape": "Rectangular", + "shape": "Rectangle", "sashQty": 2, "sashPosition": 1 }, @@ -301,7 +301,7 @@ "familyName": "ArTechPlana", "description": "ArTechPlana_Aria12", "openingType": "TurnOnly", - "shape": "Rectangular", + "shape": "Rectangle", "sashQty": 1, "sashPosition": 1 }, @@ -337,7 +337,7 @@ "familyName": "ArTech", "description": "ArTech_Aria4", "openingType": "TurnOnly", - "shape": "Rectangular", + "shape": "Rectangle", "sashQty": 4, "sashPosition": 2 }, @@ -346,7 +346,7 @@ "familyName": "ArTech", "description": "ArTech_Aria4", "openingType": "TiltTurn", - "shape": "Rectangular", + "shape": "Rectangle", "sashQty": 1, "sashPosition": 1 }, @@ -373,7 +373,7 @@ "familyName": "ArTech", "description": "ArTech_Aria12_Laterale", "openingType": "TurnOnly", - "shape": "Rectangular", + "shape": "Rectangle", "sashQty": 3, "sashPosition": 1 }, @@ -382,7 +382,7 @@ "familyName": "ArTech", "description": "ArTech_Aria4", "openingType": "TiltTurn", - "shape": "Trapezoidal", + "shape": "Trapezoid", "sashQty": 2, "sashPosition": 1 }, @@ -391,7 +391,7 @@ "familyName": "ArTechPlana", "description": "ArTechPlana_Aria4_Laterale", "openingType": "TurnOnly", - "shape": "Rectangular", + "shape": "Rectangle", "sashQty": 3, "sashPosition": 1 }, @@ -400,7 +400,7 @@ "familyName": "ArTech", "description": "ArTech_Aria12_CernieraScomparsa", "openingType": "TiltTurn", - "shape": "Rectangular", + "shape": "Rectangle", "sashQty": 3, "sashPosition": 1 }, @@ -436,7 +436,7 @@ "familyName": "ArTech", "description": "ArTech_Aria4_Laterale", "openingType": "TurnOnly", - "shape": "Rectangular", + "shape": "Rectangle", "sashQty": 3, "sashPosition": 1 }, @@ -454,7 +454,7 @@ "familyName": "ArTech", "description": "ArTech_Aria4", "openingType": "TurnOnly", - "shape": "Rectangular", + "shape": "Rectangle", "sashQty": 2, "sashPosition": 1 }, @@ -463,7 +463,7 @@ "familyName": "ArTech", "description": "ArTech_Aria4", "openingType": "TurnOnly", - "shape": "Rectangular", + "shape": "Rectangle", "sashQty": 1, "sashPosition": 1 }, @@ -499,7 +499,7 @@ "familyName": "ArTechPlana", "description": "ArTechPlana_Aria12_Laterale", "openingType": "TurnOnly", - "shape": "Rectangular", + "shape": "Rectangle", "sashQty": 3, "sashPosition": 1 }, @@ -508,7 +508,7 @@ "familyName": "ArTechPlana", "description": "ArTechPlana_Aria12", "openingType": "TurnOnly", - "shape": "Rectangular", + "shape": "Rectangle", "sashQty": 4, "sashPosition": 2 }, @@ -535,7 +535,7 @@ "familyName": "ArTechPlana", "description": "ArTechPlana_Aria4", "openingType": "TiltTurn", - "shape": "Rectangular", + "shape": "Rectangle", "sashQty": 2, "sashPosition": 1 }, @@ -553,7 +553,7 @@ "familyName": "ArTechPlana", "description": "ArTechPlana_Aria12", "openingType": "TiltTurn", - "shape": "Rectangular", + "shape": "Rectangle", "sashQty": 3, "sashPosition": 1 }, @@ -562,7 +562,7 @@ "familyName": "ArTech", "description": "ArTech_Aria12", "openingType": "TurnOnly", - "shape": "Rectangular", + "shape": "Rectangle", "sashQty": 1, "sashPosition": 1 }, @@ -580,7 +580,7 @@ "familyName": "ArTech", "description": "ArTech_Aria12", "openingType": "TiltTurn", - "shape": "Trapezoidal", + "shape": "Trapezoid", "sashQty": 1, "sashPosition": 1 }, @@ -607,7 +607,7 @@ "familyName": "ArTech", "description": "ArTech_Aria4", "openingType": "TiltTurn", - "shape": "Trapezoidal", + "shape": "Trapezoid", "sashQty": 1, "sashPosition": 1 } diff --git a/Test.UI/Test.UI.csproj b/Test.UI/Test.UI.csproj index 7368494..f4e6014 100644 --- a/Test.UI/Test.UI.csproj +++ b/Test.UI/Test.UI.csproj @@ -34,8 +34,8 @@ - - + + diff --git a/Test.UI/appsettings.json b/Test.UI/appsettings.json index a54d3bc..b1e6c3b 100644 --- a/Test.UI/appsettings.json +++ b/Test.UI/appsettings.json @@ -10,16 +10,21 @@ "Redis": "redis.ufficio:26379, serviceName=devel, DefaultDatabase=6, keepAlive=180, connectTimeout=15000, syncTimeout=15000, asyncTimeout=15000, abortConnect=false, ssl=false, allowAdmin=true" }, "ServerConf": { + "BomChannel": "Egw:bom", + "HwListChannel": "Egw:hw:list", + "HwOptChannel": "Egw:hw:opt", + "ProfListChannel": "Egw:prof:list", "PubChannel": "EgwEngineInput", + "ShapeChannel": "Egw:shape:curr", "SubChannel": "EgwEngineOutput", "SvgChannel": "Egw:svg:img", - "BomChannel": "Egw:bom", + "UpdateChannel": "Egw:update", "Prog.ApiUrl": "https://office.egalware.com/lux/srv/api", "ImageBaseUrl": "window", "GenericBaseUrl": "generic", - "ImageLiveTag": "svg", - "ImageFileTag": "svgfile", "ImageCalcTag": "svg-preview", + "ImageFileTag": "svgfile", + "ImageLiveTag": "svg", "CalcTag": "calc" } } diff --git a/WebWindowComplex/Compo/AreaFrame.razor b/WebWindowComplex/Compo/AreaFrame.razor index 749d861..19908a6 100644 --- a/WebWindowComplex/Compo/AreaFrame.razor +++ b/WebWindowComplex/Compo/AreaFrame.razor @@ -8,7 +8,7 @@ @if (CurrSashList.Count == 0 && CurrSplitList.Count == 0) {
- +
} diff --git a/WebWindowComplex/Compo/AreaHwOption.razor b/WebWindowComplex/Compo/AreaHwOption.razor new file mode 100644 index 0000000..ab8235d --- /dev/null +++ b/WebWindowComplex/Compo/AreaHwOption.razor @@ -0,0 +1,33 @@ +@using static WebWindowComplex.Json.WindowConst + +
+
+
Hardware option
+
+
+ +
+
+
+ @if (!hwOptCollapsed) + { + @foreach (var currOpt in CurrSash.HwOptionList) + { + switch (currOpt.Type) + { + case HwOptionTypes.COMBO: + { + AGBOptionCombo currOptCombo = (AGBOptionCombo)currOpt; + + break; + } + case HwOptionTypes.TEXT: + { + AGBOptionText currOptText = (AGBOptionText)currOpt; + + break; + } + } + } + } +
\ No newline at end of file diff --git a/WebWindowComplex/Compo/AreaHwOption.razor.cs b/WebWindowComplex/Compo/AreaHwOption.razor.cs new file mode 100644 index 0000000..8262460 --- /dev/null +++ b/WebWindowComplex/Compo/AreaHwOption.razor.cs @@ -0,0 +1,67 @@ +using Microsoft.AspNetCore.Components; +using System.Runtime.CompilerServices; +using System.Threading.Tasks; +using WebWindowComplex.Models; +using static WebWindowComplex.Json.WindowConst; + +namespace WebWindowComplex.Compo +{ + public partial class AreaHwOption + { + /// + /// Sash corrente rispetto alla lista Sash + /// + [Parameter] + public Sash CurrSash { get; set; } = null!; + + /// + /// Evento per aggiornare gli hardware option di tipo combo + /// + [Parameter] + public EventCallback EC_UpdateHwOptCombo { get; set; } + + /// + /// Evento per aggiornare gli hardware option di tipo text + /// + [Parameter] + public EventCallback EC_UpdateHwOptText { get; set; } + + /// + /// Evento per chiamare la prima volta la lista delle opzioni + /// + [Parameter] + public EventCallback EC_FirstHwOptionList { get; set; } + + private bool hwOptCollapsed = true; + + private async Task changeCollapsed() + { + hwOptCollapsed = !hwOptCollapsed; + if(CurrSash.HwOptionList.Count == 0) + { + await EC_FirstHwOptionList.InvokeAsync(CurrSash.GroupId); + } + } + + /// + /// Report aggiornamento Option Combo + /// + /// + /// + private async Task RaiseOptCombo(AGBOptionCombo updRec) + { + await EC_UpdateHwOptCombo.InvokeAsync(updRec); + } + + /// + /// Report aggiornamento Option Text + /// + /// + /// + private async Task RaiseOptText(AGBOptionText updRec) + { + await EC_UpdateHwOptText.InvokeAsync(updRec); + } + + } +} \ No newline at end of file diff --git a/WebWindowComplex/Compo/AreaSash.razor b/WebWindowComplex/Compo/AreaSash.razor index e053a2d..ed32baf 100644 --- a/WebWindowComplex/Compo/AreaSash.razor +++ b/WebWindowComplex/Compo/AreaSash.razor @@ -3,9 +3,13 @@
Sash @(CurrSashGroup.SashList.Count == 1 ? "" : (IndexSash + 1))
- - + @foreach (var openingType in CurrSashDim.OpeningTypeList) + { + + } + @* @@ -16,7 +20,7 @@ - + *@
@@ -26,10 +30,10 @@
- +
- +
@if (!(CurrAnta.AreaList[0] is Split)) @@ -37,7 +41,7 @@
- +
diff --git a/WebWindowComplex/Compo/AreaSplit.razor b/WebWindowComplex/Compo/AreaSplit.razor index dcd0424..4b2664d 100644 --- a/WebWindowComplex/Compo/AreaSplit.razor +++ b/WebWindowComplex/Compo/AreaSplit.razor @@ -6,7 +6,7 @@
- +
diff --git a/WebWindowComplex/Compo/AreaSplit.razor.cs b/WebWindowComplex/Compo/AreaSplit.razor.cs index c7c87b4..61e8cac 100644 --- a/WebWindowComplex/Compo/AreaSplit.razor.cs +++ b/WebWindowComplex/Compo/AreaSplit.razor.cs @@ -32,6 +32,12 @@ namespace WebWindowComplex.Compo [Parameter] public EventCallback EC_CopySash { get; set; } + /// + /// Evento per aggiungere Sash + /// + [Parameter] + public EventCallback EC_AddSash { get; set; } + #endregion Public Properties #region Private Methods @@ -50,6 +56,18 @@ namespace WebWindowComplex.Compo await EC_CopySash.InvokeAsync(Args); } + /// + /// Sollevo evento richiesta copia sash + /// + /// + private async Task RaiseAddSash(Splitted item) + { + var Args = new DataAreaSplitted + { + splitted = item + }; + await EC_AddSash.InvokeAsync(Args); + } #endregion Private Methods } @@ -62,4 +80,12 @@ namespace WebWindowComplex.Compo public Splitted splitted { get; set; } public int index { get; set; } } + + /// + /// Classe per raggruppare oggetti che servono per aggiungere Sash + /// + public class DataAreaSplitted + { + public Splitted splitted { get; set; } + } } \ No newline at end of file diff --git a/WebWindowComplex/Compo/CardFill.razor b/WebWindowComplex/Compo/CardFill.razor index f09bdec..5d40cd8 100644 --- a/WebWindowComplex/Compo/CardFill.razor +++ b/WebWindowComplex/Compo/CardFill.razor @@ -47,7 +47,12 @@ { @if (currSplitted.AreaList.First().Equals(CurrItem)) { - + + } } diff --git a/WebWindowComplex/Compo/CardFill.razor.cs b/WebWindowComplex/Compo/CardFill.razor.cs index 36e4f4f..1ec78ca 100644 --- a/WebWindowComplex/Compo/CardFill.razor.cs +++ b/WebWindowComplex/Compo/CardFill.razor.cs @@ -38,6 +38,12 @@ namespace WebWindowComplex.Compo [Parameter] public EventCallback EC_CopySash { get; set; } + /// + /// Evento per aggiungere sash + /// + [Parameter] + public EventCallback EC_AddSash { get; set; } + /// /// Evento per tornare nella pagine Tree /// @@ -97,6 +103,16 @@ namespace WebWindowComplex.Compo await EC_CopySash.InvokeAsync(Args); } + /// + /// Sollevo evento per aggiungere sash + /// + /// + /// + protected async Task AddSash(DataAreaSplitted Args) + { + await EC_AddSash.InvokeAsync(Args); + } + #endregion Protected Methods #region Private Methods diff --git a/WebWindowComplex/Compo/CardFrame.razor b/WebWindowComplex/Compo/CardFrame.razor index d14199e..61f1efe 100644 --- a/WebWindowComplex/Compo/CardFrame.razor +++ b/WebWindowComplex/Compo/CardFrame.razor @@ -15,16 +15,20 @@
- - + @foreach (var i in FrameWindow.ShapeList) + { + + } + @* - + *@
@@ -45,8 +49,8 @@
Threshold
- - @@ -62,17 +66,17 @@
- +
- +
- +
@@ -84,14 +88,14 @@
- @if (SashList.Count == 0) + @if (SashList.Count == 0) {
Bottom rail
- Quantity + Quantity
@@ -103,6 +107,10 @@ @if (!(FrameWindow.AreaList[0] is Split) || (SashList.Count == 0 && SplitList.Count == 0)) { - + + } - \ No newline at end of file diff --git a/WebWindowComplex/Compo/CardFrame.razor.cs b/WebWindowComplex/Compo/CardFrame.razor.cs index 1f33a46..efacc89 100644 --- a/WebWindowComplex/Compo/CardFrame.razor.cs +++ b/WebWindowComplex/Compo/CardFrame.razor.cs @@ -32,11 +32,17 @@ namespace WebWindowComplex.Compo public EventCallback EC_ReqClose { get; set; } /// - /// Evento per cambiare tutti i Joints + /// Evento per aggiornare info frame (es cambaire tutti i Joints) /// [Parameter] public EventCallback EC_UpdateFrame { get; set; } + /// + /// Evento per richiesta calcolo Shape + /// + [Parameter] + public EventCallback EC_UpdateShape { get; set; } + /// /// Frame corrente /// @@ -65,6 +71,7 @@ namespace WebWindowComplex.Compo /// private async Task AddSash() { + //await EC_UpdateShape.InvokeAsync(FrameWindow); await EC_AddSash.InvokeAsync(true); } @@ -111,10 +118,26 @@ namespace WebWindowComplex.Compo if (updRec != null) { currRec = updRec; + await EC_UpdateShape.InvokeAsync(FrameWindow); await EC_UpdateFrame.InvokeAsync(FrameWindow); } } + protected int SelShapeIndex + { + get => FrameWindow.SelShapeIndex; + set + { + if (FrameWindow.SelShapeIndex != value) + { + //foreach(var s in SashList) + // s.SelHardwareFromId = "000000"; + FrameWindow.SelShapeIndex = value; + _ = EC_UpdateShape.InvokeAsync(FrameWindow); + } + } + } + /// /// Report aggiornamento joint /// diff --git a/WebWindowComplex/Compo/CardSashGroup.razor b/WebWindowComplex/Compo/CardSashGroup.razor index 82a0e57..8ced13c 100644 --- a/WebWindowComplex/Compo/CardSashGroup.razor +++ b/WebWindowComplex/Compo/CardSashGroup.razor @@ -1,4 +1,4 @@ -@using static WebWindowComplex.LayoutConst +@using static WebWindowComplex.Json.WindowConst
@@ -20,7 +20,7 @@
- Qty sash + Qty sash
@@ -28,8 +28,8 @@
- - @@ -37,13 +37,63 @@
- Qty bottom rail + Qty bottom rail

+
+
+
+
Hardware
+
+
+
+ + +
+ @if (string.IsNullOrEmpty(CurrItem.SashShape)) + { +
+ + +
+ } + else + { +
+ + +
+ + + } +
@@ -70,45 +120,6 @@ }
-
-
-
-
Hardware
-
-
-
- - -
-
- - -
-
@@ -118,7 +129,12 @@
@for (int i = 0; i < CurrItem.SashList.Count; i++) { - + + }
diff --git a/WebWindowComplex/Compo/CardSashGroup.razor.cs b/WebWindowComplex/Compo/CardSashGroup.razor.cs index 3c045ee..833bab4 100644 --- a/WebWindowComplex/Compo/CardSashGroup.razor.cs +++ b/WebWindowComplex/Compo/CardSashGroup.razor.cs @@ -1,5 +1,6 @@ using Microsoft.AspNetCore.Components; using WebWindowComplex.Models; +using static WebWindowComplex.Json.WindowConst; namespace WebWindowComplex.Compo { @@ -61,18 +62,26 @@ namespace WebWindowComplex.Compo [Parameter] public EventCallback EC_UpdateSashHardware { get; set; } + /// + /// Evento per richiedere la prima volta le opzioni hardware + /// + [Parameter] + public EventCallback EC_CallFirstHwOpt { get; set; } + /// /// Lista di sash /// [Parameter] public List SashList { get; set; } = null!; + public AGBOption CurrAGBOpt; + #endregion Public Properties #region Protected Properties /// - /// + /// Selezione hardware /// protected string SelHwType { @@ -162,6 +171,50 @@ namespace WebWindowComplex.Compo } } + /// + /// Report aggiornamento Option Combo + /// + /// + /// + private async Task UpdateOptCombo(AGBOptionCombo updRec) + { + // cerco il record + var currRec = CurrItem.HwOptionList.FirstOrDefault(x => x.sName == updRec.sName && x.sDescription == updRec.sDescription); + // lo aggiorno + if (updRec != null) + { + currRec = updRec; + await EC_UpdateSashHardware.InvokeAsync(CurrItem); + } + } + + /// + /// Report aggiornamento Option Text + /// + /// + /// + private async Task UpdateOptText(AGBOptionText updRec) + { + // cerco il record + var currRec = CurrItem.HwOptionList.FirstOrDefault(x => x.sName == updRec.sName && x.sDescription == updRec.sDescription); + // lo aggiorno + if (updRec != null) + { + currRec = updRec; + await EC_UpdateSashHardware.InvokeAsync(CurrItem); + } + } + + /// + /// Prima chiamata hw option list + /// + /// + /// + private async Task FirstHwOptionList(int groupId) + { + await EC_CallFirstHwOpt.InvokeAsync(groupId); + } + #endregion Private Methods } } \ No newline at end of file diff --git a/WebWindowComplex/Compo/CardSplit.razor b/WebWindowComplex/Compo/CardSplit.razor index f2fa5e4..bead55d 100644 --- a/WebWindowComplex/Compo/CardSplit.razor +++ b/WebWindowComplex/Compo/CardSplit.razor @@ -32,12 +32,16 @@
- - + @foreach (var shapeType in CurrItem.SplitShapeList) + { + + } + @* - + *@
@@ -47,7 +51,7 @@ {
- QtyVert + QtyVert
@@ -56,7 +60,7 @@ {
- QtyHoriz + QtyHoriz
@@ -69,7 +73,7 @@ @foreach (var dim in CurrItem.SplitVertList) {
- Width + Width %
@@ -79,7 +83,7 @@ @foreach (var dim in CurrItem.SplitHorizList) {
- Height + Height %
@@ -92,7 +96,7 @@ {
- Height + Height %
@@ -105,7 +109,7 @@ {
- Width + Width %
@@ -119,10 +123,10 @@
- +
- +
diff --git a/WebWindowComplex/Compo/CardTree.razor b/WebWindowComplex/Compo/CardTree.razor index 214df6d..9e7c659 100644 --- a/WebWindowComplex/Compo/CardTree.razor +++ b/WebWindowComplex/Compo/CardTree.razor @@ -9,29 +9,34 @@ { 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) : ""); } - + } else diff --git a/WebWindowComplex/Compo/EditDimensions.razor b/WebWindowComplex/Compo/EditDimensions.razor index 9ac6cfe..76255e9 100644 --- a/WebWindowComplex/Compo/EditDimensions.razor +++ b/WebWindowComplex/Compo/EditDimensions.razor @@ -1,6 +1,6 @@ 
- @CurrRec.sName + @CurrRec.sName mm
diff --git a/WebWindowComplex/Compo/EditJoint.razor b/WebWindowComplex/Compo/EditJoint.razor index 1ffcd67..95e89fd 100644 --- a/WebWindowComplex/Compo/EditJoint.razor +++ b/WebWindowComplex/Compo/EditJoint.razor @@ -1,7 +1,7 @@ @using static WebWindowComplex.LayoutConst
- - diff --git a/WebWindowComplex/Compo/EditOptionCombo.razor b/WebWindowComplex/Compo/EditOptionCombo.razor new file mode 100644 index 0000000..e02c3a3 --- /dev/null +++ b/WebWindowComplex/Compo/EditOptionCombo.razor @@ -0,0 +1,9 @@ +
+ + +
\ No newline at end of file diff --git a/WebWindowComplex/Compo/EditOptionCombo.razor.cs b/WebWindowComplex/Compo/EditOptionCombo.razor.cs new file mode 100644 index 0000000..13b0c35 --- /dev/null +++ b/WebWindowComplex/Compo/EditOptionCombo.razor.cs @@ -0,0 +1,36 @@ +using Microsoft.AspNetCore.Components; +using WebWindowComplex.Models; + +namespace WebWindowComplex.Compo +{ + public partial class EditOptionCombo + { + #region Public Properties + + [Parameter] + public AGBOptionCombo CurrOpt { get; set; } = null!; + + [Parameter] + public EventCallback EC_Update { get; set; } + + #endregion Public Properties + + #region Private Properties + + private string CurrValue + { + get => CurrOpt.sValue.sValue; + set + { + if (CurrOpt.sValue.sValue != value) + { + CurrOpt.sValue = CurrOpt.ValueList.FirstOrDefault(x => x.sValue == value); + _ = EC_Update.InvokeAsync(CurrOpt); + } + } + } + + #endregion Private Properties + + } +} \ No newline at end of file diff --git a/WebWindowComplex/Compo/EditOptionText.razor b/WebWindowComplex/Compo/EditOptionText.razor new file mode 100644 index 0000000..a26b8f6 --- /dev/null +++ b/WebWindowComplex/Compo/EditOptionText.razor @@ -0,0 +1,9 @@ +
+ + +
\ No newline at end of file diff --git a/WebWindowComplex/Compo/EditOptionText.razor.cs b/WebWindowComplex/Compo/EditOptionText.razor.cs new file mode 100644 index 0000000..55b5d12 --- /dev/null +++ b/WebWindowComplex/Compo/EditOptionText.razor.cs @@ -0,0 +1,36 @@ +using Microsoft.AspNetCore.Components; +using WebWindowComplex.Models; + +namespace WebWindowComplex.Compo +{ + public partial class EditOptionText + { + #region Public Properties + + [Parameter] + public AGBOptionText CurrOpt { get; set; } = null!; + + [Parameter] + public EventCallback EC_Update { get; set; } + + #endregion Public Properties + + #region Private Properties + + private string CurrValue + { + get => CurrOpt.sValue; + set + { + if (CurrOpt.sValue != value) + { + CurrOpt.sValue = CurrOpt.ValueList.FirstOrDefault(x => x == value); + _ = EC_Update.InvokeAsync(CurrOpt); + } + } + } + + #endregion Private Properties + + } +} \ No newline at end of file diff --git a/WebWindowComplex/Compo/General.razor b/WebWindowComplex/Compo/General.razor index 8088a81..ae75860 100644 --- a/WebWindowComplex/Compo/General.razor +++ b/WebWindowComplex/Compo/General.razor @@ -14,8 +14,8 @@
- - @foreach (var item in ListPayload.Material) { @@ -23,8 +23,8 @@
- - @foreach (string profile in ListPayload.Profile) { @@ -41,8 +41,8 @@
- - @foreach (string glass in ListPayload.Glass) { @@ -50,8 +50,8 @@
- - @@ -65,8 +65,8 @@
- - @foreach (string colorMaterial in ListPayload.ColorMaterial) { @@ -74,8 +74,8 @@
- - diff --git a/WebWindowComplex/DTO/LivePayload.cs b/WebWindowComplex/DTO/LivePayload.cs index db8e240..2a35b0f 100644 --- a/WebWindowComplex/DTO/LivePayload.cs +++ b/WebWindowComplex/DTO/LivePayload.cs @@ -1,4 +1,5 @@ -using System; +using EgwCoreLib.Utils; +using System; using System.Collections.Generic; using System.Linq; using System.Text; @@ -24,14 +25,14 @@ namespace WebWindowComplex.DTO public string SvgPreview { get; set; } = string.Empty; /// - /// Shape da verifica JWD + /// Dizionario Shape da verifica JWD /// - public string Shape { get; set; } = string.Empty; + public Dictionary DictShape { get; set; } = new Dictionary(); /// - /// XML opzioni HW da verifica JWD + /// Dizionario XML opzioni HW da verifica JWD x GroupId /// - public string OptionsXml { get; set; } = string.Empty; + public Dictionary DictOptionsXml { get; set; } = new Dictionary(); #endregion Public Properties @@ -51,9 +52,9 @@ namespace WebWindowComplex.DTO return false; if (SvgPreview != item.SvgPreview) return false; - if (Shape != item.Shape) + if (!DictUtils.DictAreEqual(DictOptionsXml, item.DictOptionsXml)) return false; - if (OptionsXml != item.OptionsXml) + if (!DictUtils.DictAreEqual(DictShape, item.DictShape)) return false; return true; diff --git a/WebWindowComplex/DictUtils.cs b/WebWindowComplex/DictUtils.cs new file mode 100644 index 0000000..de75e4e --- /dev/null +++ b/WebWindowComplex/DictUtils.cs @@ -0,0 +1,42 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace WebWindowComplex +{ + public class DictUtils + { + /// + /// Comparatore equality obj dizionario + /// + /// + /// + /// + /// + /// + public static bool DictAreEqual(Dictionary dict1, Dictionary dict2) + { + // Handle null cases + if (dict1 == null || dict2 == null) + return dict1 == dict2; + + // Quick size check + if (dict1.Count != dict2.Count) + return false; + + // Compare each key-value pair + foreach (var kvp in dict1) + { + if (!dict2.TryGetValue(kvp.Key, out TValue value)) + return false; // Key missing in dict2 + + if (!EqualityComparer.Default.Equals(kvp.Value, value)) + return false; // Value mismatch + } + + return true; + } + } +} diff --git a/WebWindowComplex/Json/JsonUtility.cs b/WebWindowComplex/Json/JsonUtility.cs index c60fe9b..960ead1 100644 --- a/WebWindowComplex/Json/JsonUtility.cs +++ b/WebWindowComplex/Json/JsonUtility.cs @@ -106,17 +106,17 @@ namespace WebWindowComplex.Json public class JsonArea { - private int m_nIdGroup; + private int m_nGroupId; [JsonProperty] - public int IdGroup + public int GroupId { get { - return m_nIdGroup; + return m_nGroupId; } set { - m_nIdGroup = value; + m_nGroupId = value; } } @@ -233,25 +233,25 @@ namespace WebWindowComplex.Json { } - public JsonFrame(Shapes Shape, bool BottomRail, int BottomRailQty, int nIdGroup) : base(AreaTypes.FRAME) + public JsonFrame(Shapes Shape, bool BottomRail, int BottomRailQty, int GroupId) : base(AreaTypes.FRAME) { m_Shape = Shape; m_bBottomRail = BottomRail; m_nBottomRailQty = BottomRailQty; - IdGroup = nIdGroup; + base.GroupId = GroupId; } internal override Area Deserialize(Area ParentArea, Window ParentWindow) { Frame newFrame = new Frame(null, ParentWindow); - newFrame.SetIdGroup(IdGroup); + newFrame.SetGroupId(GroupId); newFrame.SetAreaType(AreaTypes.FRAME); newFrame.SetSelShape(m_Shape); newFrame.SetBottomRail(m_bBottomRail); newFrame.SetBottomRailQty(m_nBottomRailQty); //Frame.AppliedDone(); for (var DimensionIndex = 0; DimensionIndex <= m_DimensionList.Count - 1; DimensionIndex++) - newFrame.DimensionList[DimensionIndex].dValue = m_DimensionList[DimensionIndex].dValue; + newFrame.DimensionList[DimensionIndex].dValue = m_DimensionList[DimensionIndex].Value; for (var JointIndex = 0; JointIndex <= m_JointList.Count - 1; JointIndex++) newFrame.JointList[JointIndex].SetSelJointType(m_JointList[JointIndex].JointType); foreach (var Area in AreaList) @@ -270,7 +270,7 @@ namespace WebWindowComplex.Json { private bool m_bIsSashVertical; [JsonProperty] - public bool bIsSashVertical + public bool IsSashVertical { get { @@ -367,24 +367,38 @@ namespace WebWindowComplex.Json } } + private List m_HwOptionList = new List(); + [JsonProperty] + public List HwOptionList + { + get + { + return m_HwOptionList; + } + set + { + m_HwOptionList = value; + } + } + public JsonSash() : base(AreaTypes.SASH) { } - public JsonSash(bool bIsSashVertical, SashTypes SashType, bool SashBottomRail, int SashBottomRailQty, string Hardware, int nIdGroup) : base(AreaTypes.SASH) + public JsonSash(bool IsSashVertical, SashTypes SashType, bool SashBottomRail, int SashBottomRailQty, string Hardware, int GroupId) : base(AreaTypes.SASH) { - m_bIsSashVertical = bIsSashVertical; + m_bIsSashVertical = IsSashVertical; m_SashType = SashType; m_bBottomRail = SashBottomRail; m_nBottomRailQty = SashBottomRailQty; m_Hardware = Hardware; - IdGroup = nIdGroup; + base.GroupId = GroupId; } internal override Area Deserialize(Area ParentArea, Window ParentWindow) { Sash newSash = new Sash(ParentArea, ParentWindow); - newSash.SetIdGroup(IdGroup); + newSash.SetGroupId(GroupId); newSash.SetAreaType(AreaTypes.SASH); newSash.SetSashQty(m_SashList.Count); newSash.SetIsSashVertical(m_bIsSashVertical); @@ -393,14 +407,18 @@ namespace WebWindowComplex.Json for (var SashIndex = 0; SashIndex <= m_SashList.Count - 1; SashIndex++) { newSash.SashList[SashIndex].SetOpeningType(m_SashList[SashIndex].OpeningType); - newSash.SashList[SashIndex].SetHasHandle(m_SashList[SashIndex].bHasHandle); - newSash.SashList[SashIndex].SetDimension(m_SashList[SashIndex].dDimension); + newSash.SashList[SashIndex].SetHasHandle(m_SashList[SashIndex].HasHandle); + newSash.SashList[SashIndex].SetDimension(m_SashList[SashIndex].Dimension); } foreach (var Joint in m_JointList) newSash.JointList.Add(Joint.Deserialize((Area)ParentArea)); newSash.SetSelFamilyHardwareFromIndex(Hardware); - newSash.RefreshHardwareList(); + newSash.ReqRefreshShape(); newSash.SetSelHardwareFromId(Hardware); + foreach (var HwOption in m_HwOptionList) + newSash.SelHwOptionList.Add(HwOption.Name, HwOption.Value); + //foreach (var HwOption in m_HwOptionList) + // newSash.HwOptionList.Add(HwOption.Deserialize()); foreach (var Area in AreaList) { var AreaDeserealized = Area.Deserialize(newSash, ParentWindow); @@ -476,16 +494,16 @@ namespace WebWindowComplex.Json { } - public JsonSplit(SplitShapes SplitShape, int nIdGroup) : base(AreaTypes.SPLIT) + public JsonSplit(SplitShapes SplitShape, int GroupId) : base(AreaTypes.SPLIT) { m_SplitShape = SplitShape; - IdGroup = nIdGroup; + base.GroupId = GroupId; } internal override Area Deserialize(Area ParentArea, Window ParentWindow) { Split Split = new Split(ParentArea, ParentWindow); - Split.SetIdGroup(IdGroup); + Split.SetGroupId(GroupId); Split.SetAreaType(AreaTypes.SPLIT); Split.SetSplitShape(m_SplitShape, true); Split.SetSplitStartVert(m_SplitStartVert); @@ -497,8 +515,8 @@ namespace WebWindowComplex.Json Split.SetSplitQtyVert(m_SplitVertList.Count - 1, true); for (var SplitIndex = 0; SplitIndex <= m_SplitVertList.Count - 1; SplitIndex++) { - Split.SplitVertList[SplitIndex].SetIsRelative(m_SplitVertList[SplitIndex].bIsRelative); - Split.SplitVertList[SplitIndex].SetDimension(m_SplitVertList[SplitIndex].dDimension); + Split.SplitVertList[SplitIndex].SetIsRelative(m_SplitVertList[SplitIndex].IsRelative); + Split.SplitVertList[SplitIndex].SetDimension(m_SplitVertList[SplitIndex].Dimension); } } if (m_SplitHorizList.Count == 0) @@ -509,8 +527,8 @@ namespace WebWindowComplex.Json Split.SetSplitQtyHoriz(m_SplitHorizList.Count - 1, true); for (var SplitIndex = 0; SplitIndex <= m_SplitHorizList.Count - 1; SplitIndex++) { - Split.SplitHorizList[SplitIndex].SetIsRelative(m_SplitHorizList[SplitIndex].bIsRelative); - Split.SplitHorizList[SplitIndex].SetDimension(m_SplitHorizList[SplitIndex].dDimension); + Split.SplitHorizList[SplitIndex].SetIsRelative(m_SplitHorizList[SplitIndex].IsRelative); + Split.SplitHorizList[SplitIndex].SetDimension(m_SplitHorizList[SplitIndex].Dimension); } } foreach (var Area in AreaList) @@ -530,15 +548,15 @@ namespace WebWindowComplex.Json public JsonSplitted() : base(AreaTypes.SPLITTED) { } - public JsonSplitted(int nIdGroup) : base(AreaTypes.SPLITTED) + public JsonSplitted(int GroupId) : base(AreaTypes.SPLITTED) { - IdGroup = nIdGroup; + base.GroupId = GroupId; } internal override Area Deserialize(Area ParentArea, Window ParentWindow) { Splitted newSplitted = new Splitted(ParentArea, ParentWindow); - newSplitted.SetIdGroup(IdGroup); + newSplitted.SetGroupId(GroupId); newSplitted.SetAreaType(AreaTypes.SPLITTED); //Split.AppliedDone(); foreach (var Area in AreaList) @@ -575,16 +593,16 @@ namespace WebWindowComplex.Json { } - public JsonFill(FillTypes FillType, int nIdGroup) : base(AreaTypes.FILL) + public JsonFill(FillTypes FillType, int GroupId) : base(AreaTypes.FILL) { m_FillType = FillType; - IdGroup = nIdGroup; + base.GroupId = GroupId; } internal override Area Deserialize(Area ParentArea, Window ParentWindow) { Fill Fill = new Fill(ParentArea, ParentWindow); - Fill.SetIdGroup(IdGroup); + Fill.SetGroupId(GroupId); Fill.SetAreaType(AreaTypes.FILL); Fill.SetFillType(m_FillType); //Fill.AppliedDone(); @@ -604,7 +622,7 @@ namespace WebWindowComplex.Json { private int m_nIndex; [JsonProperty] - public int nIndex + public int Index { get { @@ -627,9 +645,9 @@ namespace WebWindowComplex.Json } } - public JsonJoint(int nIndex, Joints JointType) + public JsonJoint(int Index, Joints JointType) { - m_nIndex = nIndex; + m_nIndex = Index; m_JointType = JointType; } @@ -640,11 +658,55 @@ namespace WebWindowComplex.Json } } + public class JsonHwOption + { + private string m_Name; + [JsonProperty] + public string Name + { + get + { + return m_Name; + } + set + { + m_Name = value; + } + } + + private string m_Value; + [JsonProperty] + public string Value + { + get + { + return m_Value; + } + set + { + m_Value = value; + } + } + + public JsonHwOption(string Name, string Value) + { + m_Name = Name; + m_Value = Value; + } + + //internal AGBOption Deserialize() + //{ + // AGBOption newOption = new AGBOption(m_Name, m_Value); + // return newOption; + //} + + } + public class JsonFrameDimension { private int m_nIndex; [JsonProperty] - public int nIndex + public int Index { get { @@ -654,7 +716,7 @@ namespace WebWindowComplex.Json private string m_sName; [JsonProperty] - public string sName + public string Name { get { @@ -664,7 +726,7 @@ namespace WebWindowComplex.Json private double m_dValue; [JsonProperty] - public double dValue + public double Value { get { @@ -676,11 +738,11 @@ namespace WebWindowComplex.Json } } - public JsonFrameDimension(int nIndex, string sName, double dValue) + public JsonFrameDimension(int Index, string Name, double Value) { - m_nIndex = nIndex; - m_sName = sName; - m_dValue = dValue; + m_nIndex = Index; + m_sName = Name; + m_dValue = Value; } } @@ -688,7 +750,7 @@ namespace WebWindowComplex.Json { private int m_nSashId; [JsonProperty] - public int nSashId + public int SashId { get { @@ -709,7 +771,7 @@ namespace WebWindowComplex.Json private bool m_bHasHandle; [JsonProperty] - public bool bHasHandle + public bool HasHandle { get { @@ -723,7 +785,7 @@ namespace WebWindowComplex.Json private double m_dDimension; [JsonProperty] - public double dDimension + public double Dimension { get { @@ -735,12 +797,12 @@ namespace WebWindowComplex.Json } } - public JsonSashDimension(Openings OpeningType, bool bHasHandle, double dDimension, int nSashId) + public JsonSashDimension(Openings OpeningType, bool HasHandle, double Dimension, int SashId) { m_OpeningType = OpeningType; - m_bHasHandle = bHasHandle; - m_dDimension = dDimension; - m_nSashId = nSashId; + m_bHasHandle = HasHandle; + m_dDimension = Dimension; + m_nSashId = SashId; } } @@ -748,7 +810,7 @@ namespace WebWindowComplex.Json { private bool m_bIsRelative = false; [JsonProperty] - public bool bIsRelative + public bool IsRelative { get { @@ -758,7 +820,7 @@ namespace WebWindowComplex.Json private double m_dDimension; [JsonProperty] - public double dDimension + public double Dimension { get { @@ -770,10 +832,10 @@ namespace WebWindowComplex.Json } } - public JsonSplitDimension(bool bIsRelative, double dDimension) + public JsonSplitDimension(bool IsRelative, double Dimension) { - m_bIsRelative = bIsRelative; - m_dDimension = dDimension; + m_bIsRelative = IsRelative; + m_dDimension = Dimension; } } diff --git a/WebWindowComplex/Json/WindowConst.cs b/WebWindowComplex/Json/WindowConst.cs index c9eb397..2eedc6f 100644 --- a/WebWindowComplex/Json/WindowConst.cs +++ b/WebWindowComplex/Json/WindowConst.cs @@ -110,6 +110,13 @@ namespace WebWindowComplex.Json HORIZONTAL = 2 } + public enum HwOptionTypes : int + { + TEXT = 1, + LENGHT = 2, + COMBO = 3 + } + // Specifies the display state of an element. public enum Visibility { diff --git a/WebWindowComplex/Models/ParametriOpzioni.cs b/WebWindowComplex/Models/AGBOption.cs similarity index 66% rename from WebWindowComplex/Models/ParametriOpzioni.cs rename to WebWindowComplex/Models/AGBOption.cs index 5ad6324..f6e3f36 100644 --- a/WebWindowComplex/Models/ParametriOpzioni.cs +++ b/WebWindowComplex/Models/AGBOption.cs @@ -3,34 +3,29 @@ using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; +using WebWindowComplex.Json; using static WebWindowComplex.Json.WindowConst; namespace WebWindowComplex.Models { - public partial class ParametriOpzioni + public partial class AGBOption { #region Public Constructors - public ParametriOpzioni(ParametriOpzioniParametri HdwOptionParam) + /// + /// Costruttore partendo da xml + /// + /// + public AGBOption(ParametriOpzioniParametri HdwOptionParam) { m_sName = HdwOptionParam.NomeParametro; m_sDescription = HdwOptionParam.DescrizioneParametro; - m_OptVisibility = Visibility.VISIBLE; // If(HdwOptionParam.Visible.ToLower = "true", Visibility.Visible, Visibility.Collapsed) + m_OptVisibility = Visibility.VISIBLE; + // If(HdwOptionParam.Visible.ToLower = "true", Visibility.Visible, Visibility.Collapsed) } #endregion Public Constructors - #region Public Enums - - public enum HDWOPTIONTYPES : int - { - TEXT = 1, - LENGHT = 2, - COMBO = 3 - } - - #endregion Public Enums - #region Public Properties public Visibility OptVisibility @@ -57,7 +52,7 @@ namespace WebWindowComplex.Models } } - public HDWOPTIONTYPES Type + public HwOptionTypes Type { get { @@ -67,9 +62,18 @@ namespace WebWindowComplex.Models #endregion Public Properties + #region Internal Methods + + internal virtual JsonHwOption Serialize() + { + return null; + } + + #endregion Internal Methods + #region Protected Fields - protected HDWOPTIONTYPES m_Type; + protected HwOptionTypes m_Type; #endregion Protected Fields diff --git a/WebWindowComplex/Models/AGBOptionCombo.cs b/WebWindowComplex/Models/AGBOptionCombo.cs index 8413114..7d4f5ea 100644 --- a/WebWindowComplex/Models/AGBOptionCombo.cs +++ b/WebWindowComplex/Models/AGBOptionCombo.cs @@ -3,16 +3,18 @@ using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; +using WebWindowComplex.Json; +using static WebWindowComplex.Json.WindowConst; namespace WebWindowComplex.Models { - public class AGBOptionCombo : ParametriOpzioni + public class AGBOptionCombo : AGBOption { #region Public Constructors public AGBOptionCombo(ParametriOpzioniParametri HdwOptionParam) : base(HdwOptionParam) { - m_Type = HDWOPTIONTYPES.COMBO; + m_Type = HwOptionTypes.COMBO; foreach (var Value in HdwOptionParam.Opzioni) m_ValueList.Add(new AGBOptionParameter(Value.Valore, Value.DescrizioneOpzione)); m_sValue = m_ValueList.FirstOrDefault(x => x.sValue == HdwOptionParam.ValoreCorrente) ?? new AGBOptionParameter("", ""); @@ -44,6 +46,16 @@ namespace WebWindowComplex.Models #endregion Public Properties + #region Internal Methods + + internal override JsonHwOption Serialize() + { + JsonHwOption JsonHwOption = new JsonHwOption(sName, m_sValue.sValue); + return JsonHwOption; + } + + #endregion Internal Methods + #region Private Fields private AGBOptionParameter m_sValue; diff --git a/WebWindowComplex/Models/AGBOptionText.cs b/WebWindowComplex/Models/AGBOptionText.cs index 252c814..d325dbb 100644 --- a/WebWindowComplex/Models/AGBOptionText.cs +++ b/WebWindowComplex/Models/AGBOptionText.cs @@ -3,17 +3,56 @@ using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; +using WebWindowComplex.Json; +using static WebWindowComplex.Json.WindowConst; namespace WebWindowComplex.Models { - public class AGBOptionText : ParametriOpzioni + //public class AGBOptionText : AGBOption + //{ + // #region Public Constructors + + // public AGBOptionText(ParametriOpzioniParametri HdwOptionParam) : base(HdwOptionParam) + // { + // m_Type = HdwOptionTypes.TEXT; + // m_sValue = HdwOptionParam.ValoreCorrente; + // } + + // #endregion Public Constructors + + // #region Public Properties + + // public string sValue + // { + // get + // { + // return m_sValue; + // } + // set + // { + // m_sValue = value; + // } + // } + + // #endregion Public Properties + + // #region Private Fields + + // private string m_sValue; + + // #endregion Private Fields + //} + + public class AGBOptionText : AGBOption { #region Public Constructors public AGBOptionText(ParametriOpzioniParametri HdwOptionParam) : base(HdwOptionParam) { - m_Type = HDWOPTIONTYPES.TEXT; - m_sValue = HdwOptionParam.ValoreCorrente; + m_Type = HwOptionTypes.TEXT; + foreach (var Value in HdwOptionParam.Opzioni) + m_ValueList.Add(Value.Valore); + m_sValue = m_ValueList.FirstOrDefault(x => x == HdwOptionParam.ValoreCorrente) ?? ""; } #endregion Public Constructors @@ -32,12 +71,32 @@ namespace WebWindowComplex.Models } } + public List ValueList + { + get + { + return m_ValueList; + } + } + #endregion Public Properties + #region Internal Methods + + internal override JsonHwOption Serialize() + { + JsonHwOption JsonHwOption = new JsonHwOption(sName, m_sValue); + return JsonHwOption; + } + + #endregion Internal Methods + #region Private Fields private string m_sValue; + private List m_ValueList = new List(); #endregion Private Fields } + } \ No newline at end of file diff --git a/WebWindowComplex/Models/Area.cs b/WebWindowComplex/Models/Area.cs index 8cac943..5292492 100644 --- a/WebWindowComplex/Models/Area.cs +++ b/WebWindowComplex/Models/Area.cs @@ -47,16 +47,16 @@ namespace WebWindowComplex.Models } } - public int IdGroup + public int GroupId { get { - return m_IdGroup; + return m_GroupId; } set { - m_IdGroup = value; + m_GroupId = value; } } @@ -98,65 +98,91 @@ namespace WebWindowComplex.Models m_CounterGroup++; } - public bool AddFirstSash() + public void AddFirstSash() { - bool answ = false; // Salvo il parent Area ParentArea = AreaList[0].ParentArea; // Creo area sash di default Sash SashArea = Sash.CreateSash(ParentArea); - // ricerco tra ttuti gli hw disponibili... - string sShape = FindSashShape(); - var listHwValid = Sash - .m_HardwareCompleteList - .Where(x => x.Shape == sShape && x.SashQty == 1) - .FirstOrDefault(); - if (listHwValid != null) - { - // seleziono la famiglia del primo hw trovato... - SashArea.SelFamilyHardware = listHwValid.FamilyName; - SashArea.RefreshHardwareList(); - if (SashArea.HardwareList.Count == 0) - { - SashArea.Remove(); - answ = true; - } - else - { - SashArea.SetSelHardwareFromId(SashArea.HardwareList.First().Id); - // Salvo gli oggetti già presenti e li cancello da AreaList - List ContentArea = new List(); - ContentArea.Add(AreaList[0]); - AreaList.Remove(AreaList[0]); - // Aggiungo area - AreaList.Add(SashArea); - if (SashArea.nSashQty == 1) - { - // Inserisco il riempimento precedente - AreaList[0].AreaList.Add(ContentArea[0]); - AreaList[0].AreaList[0].SetParentArea(AreaList[0]); - } - else - { - // All'area Sash aggiunto uno Splitted per ogni anta - for (int i = 1; i < SashArea.nSashQty; i++) - { - AreaList[0].AreaList.Add(Splitted.CreateSplitted(SashArea)); - } - Fill fill2 = (Fill)ContentArea[0]; - for (int i = 1; i < SashArea.nSashQty; i++) - { - AreaList[0].AreaList[1].AreaList.Add(Fill.CreateFill(AreaList[0].AreaList[1], fill2.FillType)); - } - } - ParentWindow.OnUpdatePreview(ParentWindow.sSerialized()); - } - } - return answ; + // Inserisco famiglia hardware vuota + SashArea.SetSelFamilyHardware(""); + // Inserisco hardware di default + SashArea.SetSelHardwareFromId("000000"); + // Salvo gli oggetti già presenti e li cancello da AreaList + List ContentArea = new List(); + ContentArea.Add(AreaList[0]); + AreaList.Remove(AreaList[0]); + // Aggiungo area + AreaList.Add(SashArea); + // Inserisco il riempimento precedente + AreaList[0].AreaList.Add(ContentArea[0]); + AreaList[0].AreaList[0].SetParentArea(AreaList[0]); + // Richiesta SVG con hardware di default + ParentWindow.OnUpdatePreview(ParentWindow.sSerialized()); } - public void AddSplit(Area ParentArea) + // public void AddFirstSash() + // { + // // Salvo il parent + // Area ParentArea = AreaList[0].ParentArea; + // // Creo area sash di default + // Sash SashArea = Sash.CreateSash(ParentArea); + // // ricerco tra tutti gli hw disponibili... + // string sShape = FindSashShape(); + // var listHwValid = Sash + // .m_HardwareCompleteList + // .Where(x => x.Shape == sShape && x.SashQty == 1) + // .FirstOrDefault(); + // if (listHwValid != null) + // { + // // seleziono la famiglia del primo hw trovato... + // SashArea.SetSelFamilyHardware(listHwValid.FamilyName); + //#if false + // SashArea.ReqRefreshShape(); + //#endif + // SashArea.RefreshHardwareList(); + // if (SashArea.HardwareList.Count == 0) + // { + // //answ = true; + // SashArea.SetSelHardwareFromId("000000"); + // } + // else + // { + // SashArea.SetSelHardwareFromId(SashArea.HardwareList.First().Id); + // } + // // Salvo gli oggetti già presenti e li cancello da AreaList + // List ContentArea = new List(); + // ContentArea.Add(AreaList[0]); + // AreaList.Remove(AreaList[0]); + // // Aggiungo area + // AreaList.Add(SashArea); + // if (SashArea.nSashQty == 1) + // { + // // Inserisco il riempimento precedente + // AreaList[0].AreaList.Add(ContentArea[0]); + // AreaList[0].AreaList[0].SetParentArea(AreaList[0]); + // } + // else + // { + // // All'area Sash aggiunto uno Splitted per ogni anta + // for (int i = 1; i < SashArea.nSashQty; i++) + // { + // AreaList[0].AreaList.Add(Splitted.CreateSplitted(SashArea)); + // } + // Fill fill2 = (Fill)ContentArea[0]; + // for (int i = 1; i < SashArea.nSashQty; i++) + // { + // AreaList[0].AreaList[1].AreaList.Add(Fill.CreateFill(AreaList[0].AreaList[1], fill2.FillType)); + // } + // } + // ParentWindow.OnUpdatePreview(ParentWindow.sSerialized()); + // } + // } + + public void AddSplit() { + // Salvo il parent + Area ParentArea = AreaList[0].ParentArea; List ContentArea = new List(); // Salvo gli oggetti già presenti e li cancello da AreaList ContentArea.Add(AreaList[0]); @@ -194,9 +220,9 @@ namespace WebWindowComplex.Models public abstract Area Copy(Area ParentArea); - public void SetIdGroup(int nIdGroup) + public void SetGroupId(int nGroupId) { - m_IdGroup = nIdGroup; + m_GroupId = nGroupId; } public void SwapAree() @@ -214,7 +240,7 @@ namespace WebWindowComplex.Models #region Internal Methods - internal abstract JsonArea Serialize(); + internal abstract JsonArea Serialize(bool hideHw); internal void SetAreaType(AreaTypes AreaType) { @@ -243,22 +269,11 @@ namespace WebWindowComplex.Models private List m_AreaList = new List(); private AreaTypes m_AreaType; - private int m_IdGroup; + private int m_GroupId; private Area m_ParentArea; #endregion Private Fields - #region Private Methods - /// - /// MockUp chiamata a c++ x scelta forma sash per Hw - /// - /// - private string FindSashShape() - { - return "Rectangular"; - } - - #endregion Private Methods } } \ No newline at end of file diff --git a/WebWindowComplex/Models/Fill.cs b/WebWindowComplex/Models/Fill.cs index 5fe8ee1..27cb798 100644 --- a/WebWindowComplex/Models/Fill.cs +++ b/WebWindowComplex/Models/Fill.cs @@ -64,7 +64,7 @@ namespace WebWindowComplex.Models { Fill newFill = new Fill(newParentArea, m_ParentWindow); AddCounterGroup(); - newFill.SetIdGroup(nCounterGroup); + newFill.SetGroupId(nCounterGroup); newFill.SetFillType(SelFillType); newFill.SetAreaType(AreaType); return newFill; @@ -78,26 +78,30 @@ namespace WebWindowComplex.Models { Fill Fill = new Fill(AreaParent, AreaParent.ParentWindow); AddCounterGroup(); - Fill.SetIdGroup(nCounterGroup); + Fill.SetGroupId(nCounterGroup); Fill.SetAreaType(AreaTypes.FILL); Fill.SetFillType(FillType); return Fill; } - internal override JsonArea Serialize() + internal override JsonArea Serialize(bool hideHw) { - if (nCounterGroup < IdGroup) - Area.nCounterGroup = IdGroup; - JsonFill JsonFill = new JsonFill(FillType, IdGroup); + if (nCounterGroup < GroupId) + Area.nCounterGroup = GroupId; + JsonFill JsonFill = new JsonFill(FillType, GroupId); foreach (var Area in AreaList) - JsonFill.AreaList.Add(Area.Serialize()); + JsonFill.AreaList.Add(Area.Serialize(hideHw)); return JsonFill; } + internal void SetSelFillType(FillTypes value) + { + m_SelFillType = value; + //m_ParentWindow.OnUpdatePreview(m_ParentWindow.sSerialized()); + } internal void SetFillType(FillTypes value) { m_SelFillType = value; - m_ParentWindow.OnUpdatePreview(m_ParentWindow.sSerialized()); } #endregion Internal Methods diff --git a/WebWindowComplex/Models/Frame.cs b/WebWindowComplex/Models/Frame.cs index c83b55c..4ef5eb4 100644 --- a/WebWindowComplex/Models/Frame.cs +++ b/WebWindowComplex/Models/Frame.cs @@ -79,11 +79,13 @@ namespace WebWindowComplex.Models { get { - return IdNameStruct.IndFromId((int)m_Shape, m_ShapeList); + //return IdNameStruct.IndFromId((int)m_Shape, m_ShapeList); + return (int)m_Shape; } set { - Shapes SelShape = (Shapes)IdNameStruct.IdFromInd(value, m_ShapeList); + //Shapes SelShape = (Shapes)IdNameStruct.IdFromInd(value, m_ShapeList); + Shapes SelShape = (Shapes)value; if (m_Shape != SelShape) { // salvo vecchie dimensioni @@ -194,7 +196,7 @@ namespace WebWindowComplex.Models } m_Shape = SelShape; } - m_ParentWindow.OnUpdatePreview(m_ParentWindow.sSerialized()); + //m_ParentWindow.OnUpdatePreview(m_ParentWindow.sSerialized()); } } @@ -237,18 +239,18 @@ namespace WebWindowComplex.Models return NewFrame; } - internal override JsonArea Serialize() + internal override JsonArea Serialize(bool hideHw) { Area.nCounterGroup = 0; - if (nCounterGroup < IdGroup) - Area.nCounterGroup = IdGroup; - JsonFrame JsonFrame = new JsonFrame(m_Shape, m_bBottomRail, m_nBottomRailQty, IdGroup); + if (nCounterGroup < GroupId) + Area.nCounterGroup = GroupId; + JsonFrame JsonFrame = new JsonFrame(m_Shape, m_bBottomRail, m_nBottomRailQty, GroupId); foreach (var Dimension in DimensionList) JsonFrame.DimensionList.Add(Dimension.Serialize()); foreach (var Joint in JointList) JsonFrame.JointList.Add(Joint.Serialize()); foreach (var Area in AreaList) - JsonFrame.AreaList.Add(Area.Serialize()); + JsonFrame.AreaList.Add(Area.Serialize(hideHw)); return JsonFrame; } diff --git a/WebWindowComplex/Models/OnReqHwOptEventArgs.cs b/WebWindowComplex/Models/OnReqHwOptEventArgs.cs new file mode 100644 index 0000000..234cb3d --- /dev/null +++ b/WebWindowComplex/Models/OnReqHwOptEventArgs.cs @@ -0,0 +1,28 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace WebWindowComplex.Models +{ + public class OnReqHwOptEventArgs : EventArgs + { + #region Public Fields + + public string sJwd; + public int nGroupId; + + #endregion Public Fields + + #region Public Constructors + + public OnReqHwOptEventArgs(string sJwd, int nGroupId) + { + this.sJwd = sJwd; + this.nGroupId = nGroupId; + } + + #endregion Public Constructors + } +} \ No newline at end of file diff --git a/WebWindowComplex/Models/OnReqShapeEventArgs.cs b/WebWindowComplex/Models/OnReqShapeEventArgs.cs new file mode 100644 index 0000000..a90de9a --- /dev/null +++ b/WebWindowComplex/Models/OnReqShapeEventArgs.cs @@ -0,0 +1,28 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace WebWindowComplex.Models +{ + public class OnReqShapeEventArgs : EventArgs + { + #region Public Fields + + public string sJwd; + public int groupId; + + #endregion Public Fields + + #region Public Constructors + + public OnReqShapeEventArgs(string sJwd, int nGroupId) + { + this.sJwd = sJwd; + this.groupId = nGroupId; + } + + #endregion Public Constructors + } +} \ No newline at end of file diff --git a/WebWindowComplex/Models/Sash.cs b/WebWindowComplex/Models/Sash.cs index 67c8924..85ce272 100644 --- a/WebWindowComplex/Models/Sash.cs +++ b/WebWindowComplex/Models/Sash.cs @@ -1,9 +1,12 @@ using Egw.Window.Data; +using Newtonsoft.Json; using System; using System.Collections.Generic; +using System.Data.SqlTypes; using System.Linq; using System.Text; using System.Threading.Tasks; +using System.Xml.Serialization; using WebWindowComplex.Json; using static WebWindowComplex.Json.WindowConst; @@ -29,6 +32,13 @@ namespace WebWindowComplex.Models #endregion Public Constructors + #region Public Events + + //public event EventHandler OnReqShape = delegate { }; + //public event EventHandler OnReqHwOption = delegate { }; + + #endregion Public Events + #region Public Properties public bool bIsMeasureGlass @@ -71,7 +81,7 @@ namespace WebWindowComplex.Models } } - public List HwdOptionList + public List HwOptionList { get { @@ -79,6 +89,14 @@ namespace WebWindowComplex.Models } } + public Dictionary SelHwOptionList + { + get + { + return m_SelHwdOptionList; + } + } + public List JointList { get @@ -99,7 +117,7 @@ namespace WebWindowComplex.Models } set { - if (value >= 0 && value <= 4) + if (value >= 0 && value <= 3) { if (value > m_SashList.Count) { @@ -211,6 +229,7 @@ namespace WebWindowComplex.Models } } } + //m_ParentWindow.OnUpdatePreview(m_ParentWindow.sSerialized(true)); RefreshHardwareList(); RefreshHardwareOptionList(); SetFirstHardware(); @@ -303,10 +322,7 @@ namespace WebWindowComplex.Models } set { - m_SelFamilyHardware = value; - RefreshHardwareList(); - RefreshHardwareOptionList(); - SetFirstHardware(); + SetSelFamilyHardware(value); m_ParentWindow.OnUpdatePreview(m_ParentWindow.sSerialized()); } } @@ -320,75 +336,7 @@ namespace WebWindowComplex.Models set { m_SelHardware = value; - // if (m_SelHardware != null && m_SelHardware.sId != "000000") - // { - // string sHwdOptPath = ""; - // var gf = EgtLuaCreateGlobTable("WDG"); - // var tft = EgtLuaSetGlobIntVar("WDG.AREAID", m_nAreaId); - // var tfy = EgtLuaSetGlobStringVar("WDG.HDWFAVOURITE", value.sId); - // SashDimension HandleSash = m_SashList.FirstOrDefault(x => x.bHasHandle); - // string sHandle = "Dx"; - // switch (GetOpeningSide(HandleSash.OpeningType)) - // { - // case object _ when OpeningSides.LEFT: - // { - // sHandle = "Sx"; - // break; - // } - - // case object _ when OpeningSides.RIGHT: - // { - // sHandle = "Dx"; - // break; - // } - // } - // var tfd = EgtLuaSetGlobStringVar("WDG.HDWHANDLE", sHandle); - // var tlt = EgtLuaCallFunction("WinCreate_GetHardwareOptionPath"); - // var tltf = EgtLuaGetGlobStringVar("WDG.HWDOPTPATH", sHwdOptPath); - // if (!string.IsNullOrWhiteSpace(sHwdOptPath)) - // { - // XmlSerializer serializer = new XmlSerializer(typeof(ParametriOpzioni)); - // ParametriOpzioni HwdOptions = null/* TODO Change to default(_) if this is not a reference type */; - // string sHdwOptPath = Path.ChangeExtension(sHwdOptPath, ".opt"); - // bool bHdwOptFound = false; - // for (var WaitIndex = 0; WaitIndex <= 100; WaitIndex++) - // { - // if (File.Exists(sHdwOptPath)) - // { - // bHdwOptFound = true; - // break; - // } - // System.Threading.Thread.Sleep(100); - // } - // if (bHdwOptFound) - // { - // string sHwdOptText = ""; - // try - // { - // sHwdOptText = File.ReadAllText(sHdwOptPath); - // } - // catch (Exception ex) - // { - // EgtOutLog("Hardware file opt not found or read!"); - // } - // if (!string.IsNullOrWhiteSpace(sHwdOptText)) - // { - // using (TextReader reader = new StringReader(sHwdOptText)) - // { - // HwdOptions = serializer.Deserialize(reader); - // } - // if (!IsNothing(HwdOptions)) - // { - // m_HwdOptionList.Clear(); - // foreach (var HdwOption in HwdOptions.Items) - // m_HwdOptionList.Add(new AGBOption(HdwOption)); - // NotifyPropertyChanged(nameof(HwdOptionList)); - // } - // } - // } - // var ud = EgtLuaResetGlobVar("WDG"); - // } - // } + ReqRefreshHwOption(); } } @@ -400,8 +348,9 @@ namespace WebWindowComplex.Models } set { - m_SelHardware = m_HardwareList.FirstOrDefault(x => !string.IsNullOrEmpty(value) && x.Id.Equals(value)) ?? new Hardware("", "", "", Enums.OpeningTypes.Null, "", 0, 0); - ParentWindow.OnUpdatePreview(ParentWindow.sSerialized()); + m_SelHardware = m_HardwareList.FirstOrDefault(x => !string.IsNullOrEmpty(value) && x.Id.Equals(value)) ?? new Hardware(CustomHwId, "", "", Enums.OpeningTypes.Null, "", 0, 0); + //ReqRefreshHwOption(); + //ParentWindow.OnUpdatePreview(ParentWindow.sSerialized()); } } @@ -438,6 +387,12 @@ namespace WebWindowComplex.Models } } + public string SashShape + { + get => m_CurrShape; + set => m_CurrShape = value; + } + #endregion Public Properties #region Public Methods @@ -446,17 +401,17 @@ namespace WebWindowComplex.Models { Sash newSash = new Sash(newParentArea, m_ParentWindow); AddCounterGroup(); - newSash.SetIdGroup(nCounterGroup); + newSash.SetGroupId(nCounterGroup); newSash.SetAreaType(AreaType); // Imposta la quantità di ante e definisce SashDimension di ogni anta ai valori di default newSash.SetSashQty(nSashQty); newSash.SetIsSashVertical(bIsSashVertical); newSash.SetOrientationSashType(OrientationSashType); newSash.SetSashBottomRailQty(SashBottomRailQty); - newSash.SetSelFamilyHardwareFromIndex(SelHardware.Id); - newSash.RefreshHardwareList(); + newSash.SetSelFamilyHardwareFromIndex(m_SelHardware.Id); + newSash.ReqRefreshShape(); newSash.RefreshHardwareOptionList(); - newSash.SetSelHardware(SelHardware); + newSash.SetSelHardware(m_SelHardware); for (int i = 0; i < SashList.Count; i++) { //Cancello SashDimension di default e aggiungo la copia @@ -477,17 +432,19 @@ namespace WebWindowComplex.Models return newSash; } + /// + /// Update valori ammissibili x HW list + /// public void RefreshHardwareList() { if (m_HardwareCompleteList != null && m_HardwareCompleteList.Count > 0) { m_HardwareList.Clear(); - string sSashShape = FindSashShape(); Enums.OpeningTypes sOpeningType = ConvertOpeningType(); var iComp = StringComparison.InvariantCultureIgnoreCase; var rawList = m_HardwareCompleteList .Where(x => x.Id == "000000" || - (!string.IsNullOrEmpty(m_SelFamilyHardware) && x.FamilyName.Equals(m_SelFamilyHardware, iComp) && x.SashQty == nSashQty && x.Shape.Equals(sSashShape, iComp) && x.OpeningType == sOpeningType) + (!string.IsNullOrEmpty(m_SelFamilyHardware) && x.FamilyName.Equals(m_SelFamilyHardware, iComp) && x.SashQty == nSashQty && x.Shape.Equals(m_CurrShape, iComp) && x.OpeningType == sOpeningType) ) .ToList(); if (rawList != null && rawList.Count > 0) @@ -510,6 +467,66 @@ namespace WebWindowComplex.Models m_ParentWindow.OnUpdatePreview(m_ParentWindow.sSerialized()); } + /// + /// Richiesta calcolo shape corrente + /// + public void ReqRefreshShape() + { + if (m_HardwareCompleteList != null && m_HardwareCompleteList.Count > 0) + { + m_HardwareList.Clear(); + // reset shape corrente + m_CurrShape = ""; + + // chiamata evento calcolo shape: gruppo da calcolare + m_ParentWindow.OnReqShapePreview(m_ParentWindow.sSerialized(), GroupId); + } + } + + /// + /// Richiesta calcolo hardware option list + /// + public void ReqRefreshHwOption() + { + HwOptionList.Clear(); + // chiamata evento calcolo opzioni hardware + m_ParentWindow.OnReqHwOptionPreview(m_ParentWindow.sSerialized(), GroupId ); + } + + public void SetSelFamilyHardware(string sFamilyHw) + { + m_SelFamilyHardware = sFamilyHw; + // se ho la shape aggiorno elenco HW + if (!string.IsNullOrEmpty(m_CurrShape)) + { + RefreshHardwareList(); + } + RefreshHardwareOptionList(); + SetFirstHardware(); + } + + /// + /// Aggiornamento HW List conseguente a ricezione nuova Shape + /// + /// + public void UpdateShape(string newShape) + { + m_CurrShape = newShape; + // la famiglia hw è vuota seleziono il primo hardware valido e utilizzo la sua famiglia + if(string.IsNullOrEmpty(m_SelFamilyHardware) || m_SelFamilyHardware == "") + { + var listHwValid = Sash + .m_HardwareCompleteList + .Where(x => x.Shape == m_CurrShape && x.SashQty == nSashQty && x.OpeningType == ConvertOpeningType()) + .FirstOrDefault(); + SetSelFamilyHardware(listHwValid.FamilyName); + } + RefreshHardwareList(); + // se il vecchio hw selezionato non va più bene viene selezionato il primo della lista + if(!HardwareList.Contains(m_SelHardware) || m_SelHardware.Shape != m_CurrShape) + SetFirstHardware(); + } + #endregion Public Methods #region Internal Methods @@ -518,7 +535,7 @@ namespace WebWindowComplex.Models { Sash newSash = new Sash(Area, Area.ParentWindow); AddCounterGroup(); - newSash.SetIdGroup(nCounterGroup); + newSash.SetGroupId(nCounterGroup); newSash.SetAreaType(AreaTypes.SASH); newSash.SetSashQty(1); newSash.SetOrientationSashType(OrientationSash.VERTICAL); @@ -527,8 +544,8 @@ namespace WebWindowComplex.Models newSash.JointList.Add(new Joint(newSash, JointIndex + 1, Joints.FULL_H)); newSash.SetSashBottomRail(false); newSash.SetSashBottomRailQty(0); - newSash.SelFamilyHardware = Sash.s_FamilyHardwareList.First(); - newSash.RefreshHardwareList(); + newSash.SetSelFamilyHardware(Sash.s_FamilyHardwareList.First()); + //newSash.ReqRefreshShape(); newSash.RefreshHardwareOptionList(); newSash.SetFirstHardware(); return newSash; @@ -614,22 +631,54 @@ namespace WebWindowComplex.Models } } + //internal void OnReqShapePreview(string sJwd, int groupId) + //{ + // OnReqShapeEventArgs e = new OnReqShapeEventArgs(sJwd, groupId); + // EventHandler handler = OnReqShape; + // if (handler != null) + // { + // handler(this, e); + // } + //} + + //internal void OnReqHwOptionPreview(string sJwd, int groupId) + //{ + // OnReqHwOptEventArgs e = new OnReqHwOptEventArgs(sJwd, groupId); + // EventHandler handler = OnReqHwOption; + // if (handler != null) + // { + // handler(this, e); + // } + //} + internal void RefreshHardwareOptionList() { m_HwdOptionList.Clear(); + //ReqRefreshHwOption(); } - internal override JsonArea Serialize() + internal override JsonArea Serialize(bool hideHw) { - if (nCounterGroup < IdGroup) - Area.nCounterGroup = IdGroup; - JsonSash JsonSash = new JsonSash(m_bIsSashVertical, m_SashType, m_bSashBottomRail, m_nSashBottomRailQty, m_SelHardware.Id, IdGroup); + 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); foreach (var SashDimension in SashList) JsonSash.SashList.Add(SashDimension.Serialize()); foreach (var Joint in JointList) JsonSash.JointList.Add(Joint.Serialize()); + if(HwOptionList.Count > 0) + { + foreach (var HwOption in HwOptionList) + JsonSash.HwOptionList.Add(HwOption.Serialize()); + } + else + { + foreach (var HwOption in SelHwOptionList) + JsonSash.HwOptionList.Add(new JsonHwOption(HwOption.Key, HwOption.Value)); + } foreach (var Area in AreaList) - JsonSash.AreaList.Add(Area.Serialize()); + JsonSash.AreaList.Add(Area.Serialize(hideHw)); return JsonSash; } @@ -638,6 +687,7 @@ namespace WebWindowComplex.Models if (m_HardwareList.Count > 0) { m_SelHardware = m_HardwareList.First(); + //ReqRefreshHwOption(); } } @@ -659,6 +709,60 @@ namespace WebWindowComplex.Models } } + internal void SetHardwareOption(string OptionXml) + { + if (!string.IsNullOrEmpty(OptionXml)) + { + ParametriOpzioni HwOptions = null; + XmlSerializer serializer = new XmlSerializer(typeof(ParametriOpzioni)); + StringReader reader = new StringReader(OptionXml); + HwOptions = (ParametriOpzioni)serializer.Deserialize(reader); + if (HwOptions.Items != null) + { + m_HwdOptionList.Clear(); + foreach (var HwOption in HwOptions.Items) + { + switch (HwOption.Tipo) + { + case "Text": + { + m_HwdOptionList.Add(new AGBOptionText(HwOption)); + break; + } + case "List": + { + m_HwdOptionList.Add(new AGBOptionCombo(HwOption)); + break; + } + } + } + } + } + if (SelHwOptionList.Count > 0) + { + foreach (var selHwOption in SelHwOptionList) + { + var HwOption = HwOptionList.Where(x => x.sName == selHwOption.Key).First(); + switch (HwOption.Type) + { + case HwOptionTypes.COMBO: + { + AGBOptionCombo OptCombo = (AGBOptionCombo)HwOption; + var selValue = OptCombo.ValueList.Where(x => x.sValue == selHwOption.Value).First(); + OptCombo.sValue = selValue; + break; + } + case HwOptionTypes.TEXT: + { + AGBOptionText OptText = (AGBOptionText)HwOption; + OptText.sValue = selHwOption.Value; + break; + } + } + } + } + } + internal void SetOrientationSashType(OrientationSash value) { m_SelOrientationSashType = value; @@ -710,13 +814,14 @@ namespace WebWindowComplex.Models internal string SetSelFamilyHardwareFromIndex(string codHardware) { + string? item = ""; if (string.IsNullOrEmpty(m_SelFamilyHardware)) { - var item = m_HardwareCompleteList + item = m_HardwareCompleteList .Where(x => x.Id == codHardware) .Select(x => x.FamilyName) - .ToList(); - SelFamilyHardware = item.First(); + .FirstOrDefault(); + SetSelFamilyHardware(item ?? ""); } return SelFamilyHardware; } @@ -729,18 +834,23 @@ namespace WebWindowComplex.Models internal void SetSelHardwareFromId(string sId) { if (m_HardwareList.Count == 0) - SelHardware = m_HardwareCompleteList.FirstOrDefault(x => x.Id.Equals(sId)) ?? new Hardware("", "", "", Enums.OpeningTypes.Null, "", 0, 0); + m_SelHardware = m_HardwareCompleteList.FirstOrDefault(x => x.Id.Equals(sId)) ?? new Hardware(CustomHwId, "", "", Enums.OpeningTypes.Null, "", 0, 0); else - SelHardware = m_HardwareList.FirstOrDefault(x => x.Id.Equals(sId)) ?? new Hardware("", "", "", Enums.OpeningTypes.Null, "", 0, 0); + m_SelHardware = m_HardwareList.FirstOrDefault(x => x.Id.Equals(sId)) ?? new Hardware(CustomHwId, "", "", Enums.OpeningTypes.Null, "", 0, 0); if (SelHardware.Id == "") - SelHardware = m_HardwareList.First(); - //SelFamilyHardware = m_SelHardware.FamilyName; + m_SelHardware = m_HardwareList.First(); + //ReqRefreshHwOption(); } #endregion Internal Methods #region Private Fields + /// + /// Codice HW custom x gestione casi non risolvibili di selezione + /// + private const string CustomHwId = "000000"; + private bool m_bIsMeasureGlass; private bool m_bIsPercentage = true; @@ -749,9 +859,11 @@ namespace WebWindowComplex.Models private bool m_bSashBottomRail; + private string m_CurrShape = ""; private List m_HardwareList = new List(); - private List m_HwdOptionList = new List(); + private List m_HwdOptionList = new List(); + private Dictionary m_SelHwdOptionList = new Dictionary(); private List m_JointList = new List(); @@ -793,11 +905,6 @@ namespace WebWindowComplex.Models return answ; } - private string FindSashShape() - { - return "Rectangular"; - } - #endregion Private Methods } } \ No newline at end of file diff --git a/WebWindowComplex/Models/SashDimension.cs b/WebWindowComplex/Models/SashDimension.cs index cde5c8c..c03399f 100644 --- a/WebWindowComplex/Models/SashDimension.cs +++ b/WebWindowComplex/Models/SashDimension.cs @@ -106,7 +106,7 @@ namespace WebWindowComplex.Models set { m_bHasHandle = value; - m_Parent.ParentWindow.OnUpdatePreview(m_Parent.ParentWindow.sSerialized()); + //m_Parent.ParentWindow.OnUpdatePreview(m_Parent.ParentWindow.sSerialized()); } } @@ -229,7 +229,7 @@ namespace WebWindowComplex.Models set { m_SelOpeningType = value; - m_Parent.RefreshHardwareList(); + m_Parent.ReqRefreshShape(); m_Parent.RefreshHardwareOptionList(); m_Parent.SetFirstHardware(); } @@ -239,15 +239,23 @@ namespace WebWindowComplex.Models { get { - return IdNameStruct.IndFromId((int)m_SelOpeningType, m_OpeningTypeList); + //return IdNameStruct.IndFromId((int)m_SelOpeningType, m_OpeningTypeList); + return (int)m_SelOpeningType; } set { - m_SelOpeningType = (Openings)IdNameStruct.IdFromInd(value, m_OpeningTypeList); - m_Parent.RefreshHardwareList(); - m_Parent.RefreshHardwareOptionList(); - m_Parent.SetFirstHardware(); - m_Parent.ParentWindow.OnUpdatePreview(m_Parent.ParentWindow.sSerialized()); + //Openings newOpening = (Openings)IdNameStruct.IdFromInd(value, m_OpeningTypeList); + Openings newOpening = (Openings)value; + if ((newOpening != Openings.TILTTURN_LEFT && newOpening != Openings.TILTTURN_RIGHT) || + (newOpening == Openings.TILTTURN_LEFT && m_bHasHandle) || + (newOpening == Openings.TILTTURN_RIGHT && m_bHasHandle)) + { + m_SelOpeningType = newOpening; + m_Parent.ReqRefreshShape(); + m_Parent.RefreshHardwareOptionList(); + m_Parent.SetFirstHardware(); + m_Parent.ParentWindow.OnUpdatePreview(m_Parent.ParentWindow.sSerialized()); + } } } @@ -302,18 +310,31 @@ namespace WebWindowComplex.Models private List m_OpeningTypeList = new List { - new IdNameStruct((int)Openings.TURNONLY_LEFT, ">"), - new IdNameStruct((int)Openings.TURNONLY_RIGHT, "<"), - new IdNameStruct((int)Openings.TILTTURN_LEFT, ">*"), - new IdNameStruct((int)Openings.TILTTURN_RIGHT, "<*"), - new IdNameStruct((int)Openings.TILTONLY_TOP, "˄"), - new IdNameStruct((int)Openings.TILTONLY_BOTTOM, "˅"), - new IdNameStruct((int)Openings.PIVOT, "◊"), - new IdNameStruct((int)Openings.FIXED, "X"), - new IdNameStruct((int)Openings.COMPLANARSLIDE_LEFT, "-→"), - new IdNameStruct((int)Openings.COMPLANARSLIDE_RIGHT, "←-"), - new IdNameStruct((int)Openings.LIFTSLIDE_LEFT, "┌→"), - new IdNameStruct((int)Openings.LIFTSLIDE_RIGHT, "←┐") + new IdNameStruct((int)Openings.TURNONLY_LEFT, "A bandiera sinistra"), + new IdNameStruct((int)Openings.TURNONLY_RIGHT, "A bandiera destra"), + new IdNameStruct((int)Openings.TILTTURN_LEFT, "Ad anta-ribalta sinistra"), + new IdNameStruct((int)Openings.TILTTURN_RIGHT, "Ad anta-ribalta destra"), + new IdNameStruct((int)Openings.TILTONLY_TOP, "Solo verso alto"), + new IdNameStruct((int)Openings.TILTONLY_BOTTOM, "Solo verso basso"), + new IdNameStruct((int)Openings.PIVOT, "Pivot"), + new IdNameStruct((int)Openings.FIXED, "Fissa"), + new IdNameStruct((int)Openings.COMPLANARSLIDE_LEFT, "Complanare sinistra"), + new IdNameStruct((int)Openings.COMPLANARSLIDE_RIGHT, "Complanare destra"), + new IdNameStruct((int)Openings.LIFTSLIDE_LEFT, "Scorrevole sinistra"), + new IdNameStruct((int)Openings.LIFTSLIDE_RIGHT, "Scorrevole destra") + + //new IdNameStruct((int)Openings.TURNONLY_LEFT, ">"), + //new IdNameStruct((int)Openings.TURNONLY_RIGHT, "<"), + //new IdNameStruct((int)Openings.TILTTURN_LEFT, ">*"), + //new IdNameStruct((int)Openings.TILTTURN_RIGHT, "<*"), + //new IdNameStruct((int)Openings.TILTONLY_TOP, "˄"), + //new IdNameStruct((int)Openings.TILTONLY_BOTTOM, "˅"), + //new IdNameStruct((int)Openings.PIVOT, "◊"), + //new IdNameStruct((int)Openings.FIXED, "X"), + //new IdNameStruct((int)Openings.COMPLANARSLIDE_LEFT, "-→"), + //new IdNameStruct((int)Openings.COMPLANARSLIDE_RIGHT, "←-"), + //new IdNameStruct((int)Openings.LIFTSLIDE_LEFT, "┌→"), + //new IdNameStruct((int)Openings.LIFTSLIDE_RIGHT, "←┐") }; // reference diff --git a/WebWindowComplex/Models/Split.cs b/WebWindowComplex/Models/Split.cs index 8481927..885e9b8 100644 --- a/WebWindowComplex/Models/Split.cs +++ b/WebWindowComplex/Models/Split.cs @@ -222,11 +222,13 @@ namespace WebWindowComplex.Models { get { - return IdNameStruct.IndFromId((int)m_SelSplitShape, m_SplitShapeList); + //return IdNameStruct.IndFromId((int)m_SelSplitShape, m_SplitShapeList); + return (int)m_SelSplitShape; } set { - m_SelSplitShape = (SplitShapes)IdNameStruct.IdFromInd(value, m_SplitShapeList); + //m_SelSplitShape = (SplitShapes)IdNameStruct.IdFromInd(value, m_SplitShapeList); + m_SelSplitShape = (SplitShapes)value; // Cancello elementi nello split e azzero quantità orizzontale e verticale AreaList.Clear(); SetSplitQtyVert(0); @@ -316,7 +318,7 @@ namespace WebWindowComplex.Models { Split newSplit = new Split(newParentArea, ParentWindow); AddCounterGroup(); - newSplit.SetIdGroup(nCounterGroup); + newSplit.SetGroupId(nCounterGroup); newSplit.SetSplitStartVert(bSplitStartVert); newSplit.SetSplitQtyVert(nSplitQtyVert); for (int i = 0; i < SplitVertList.Count; i++) @@ -363,17 +365,17 @@ namespace WebWindowComplex.Models { Split Split = new Split(Area, Area.ParentWindow); AddCounterGroup(); - Split.SetIdGroup(nCounterGroup); + Split.SetGroupId(nCounterGroup); Split.SetAreaType(AreaTypes.SPLIT); Split.SetSplitShape(SplitShape, true); return Split; } - internal override JsonArea Serialize() + internal override JsonArea Serialize(bool hideHw) { - if (nCounterGroup < IdGroup) - Area.nCounterGroup = IdGroup; - JsonSplit JsonSplit = new JsonSplit(m_SelSplitShape, IdGroup); + if (nCounterGroup < GroupId) + Area.nCounterGroup = GroupId; + JsonSplit JsonSplit = new JsonSplit(m_SelSplitShape, GroupId); //foreach (var SplitPosition in m_SplitPositionList) // JsonSplit.SplitPositionList.Add(SplitPosition.Serialize()); JsonSplit.SplitStartVert = bSplitStartVert; @@ -382,7 +384,7 @@ namespace WebWindowComplex.Models foreach (var SplitHoriz in m_SplitHorizList) JsonSplit.SplitHorizList.Add(SplitHoriz.Serialize()); foreach (var Area in AreaList) - JsonSplit.AreaList.Add(Area.Serialize()); + JsonSplit.AreaList.Add(Area.Serialize(hideHw)); return JsonSplit; } @@ -445,7 +447,7 @@ namespace WebWindowComplex.Models internal void SetSplitStartVert(bool SplitStartVert) { - bSplitStartVert = SplitStartVert; + m_bSplitStartVert = SplitStartVert; } #endregion Internal Methods diff --git a/WebWindowComplex/Models/Splitted.cs b/WebWindowComplex/Models/Splitted.cs index 17ba514..02baf89 100644 --- a/WebWindowComplex/Models/Splitted.cs +++ b/WebWindowComplex/Models/Splitted.cs @@ -19,7 +19,7 @@ namespace WebWindowComplex.Models { Splitted newSplitted = new Splitted(newParentArea, ParentWindow); AddCounterGroup(); - newSplitted.SetIdGroup(nCounterGroup); + newSplitted.SetGroupId(nCounterGroup); newSplitted.SetAreaType(AreaType); foreach (var item in AreaList) { @@ -37,18 +37,18 @@ namespace WebWindowComplex.Models { Splitted Splitted = new Splitted(ParentArea, ParentArea.ParentWindow); AddCounterGroup(); - Splitted.SetIdGroup(nCounterGroup); + Splitted.SetGroupId(nCounterGroup); Splitted.SetAreaType(AreaTypes.SPLITTED); return Splitted; } - internal override JsonArea Serialize() + internal override JsonArea Serialize(bool hideHw) { - if (nCounterGroup < IdGroup) - Area.nCounterGroup = IdGroup; - JsonSplitted JsonSplitted = new JsonSplitted(IdGroup); + if (nCounterGroup < GroupId) + Area.nCounterGroup = GroupId; + JsonSplitted JsonSplitted = new JsonSplitted(GroupId); foreach (var Area in AreaList) - JsonSplitted.AreaList.Add(Area.Serialize()); + JsonSplitted.AreaList.Add(Area.Serialize(hideHw)); return JsonSplitted; } diff --git a/WebWindowComplex/Models/Window.cs b/WebWindowComplex/Models/Window.cs index 4b37f20..ab31bdc 100644 --- a/WebWindowComplex/Models/Window.cs +++ b/WebWindowComplex/Models/Window.cs @@ -20,6 +20,8 @@ namespace WebWindowComplex.Models #region Public Events public event EventHandler OnPreview = delegate { }; + public event EventHandler OnReqShape = delegate { }; + public event EventHandler OnReqHwOption = delegate { }; #endregion Public Events @@ -103,17 +105,42 @@ namespace WebWindowComplex.Models } } - internal JsonWindow Serialize() + internal void OnReqShapePreview(string sJwd, int groupId) + { + OnReqShapeEventArgs e = new OnReqShapeEventArgs(sJwd, groupId); + EventHandler handler = OnReqShape; + if (handler != null) + { + handler(this, e); + } + } + + internal void OnReqHwOptionPreview(string sJwd, int groupId) + { + OnReqHwOptEventArgs e = new OnReqHwOptEventArgs(sJwd, groupId); + EventHandler handler = OnReqHwOption; + if (handler != null) + { + handler(this, e); + } + } + + /// + /// Serializzazione dell'oggetto windows + /// + /// Hide hw x preview SVG veloci + /// + internal JsonWindow Serialize(bool hideHw = false) { JsonWindow JsonWindow = new JsonWindow(sProfilePath, sMaterial, sColorMaterial, sGlass); foreach (var Area in AreaList) - JsonWindow.AreaList.Add(Area.Serialize()); + JsonWindow.AreaList.Add(Area.Serialize(hideHw)); return JsonWindow; } - internal string sSerialized() + internal string sSerialized(bool hideHw = false) { - return JsonConvert.SerializeObject(Serialize(), Formatting.Indented); + return JsonConvert.SerializeObject(Serialize(hideHw), Formatting.Indented); } #endregion Internal Methods diff --git a/WebWindowComplex/ParametriOpzioni.cs b/WebWindowComplex/ParametriOpzioni.cs index b055d1e..90c5c39 100644 --- a/WebWindowComplex/ParametriOpzioni.cs +++ b/WebWindowComplex/ParametriOpzioni.cs @@ -11,7 +11,7 @@ namespace WebWindowComplex private ParametriOpzioniParametri[] itemsField; /// - //[System.Xml.Serialization.XmlElementAttribute("Parametri", Form = System.Xml.Schema.XmlSchemaForm.Unqualified)] + [System.Xml.Serialization.XmlElementAttribute("Parametri", Form = System.Xml.Schema.XmlSchemaForm.Unqualified)] public ParametriOpzioniParametri[] Items { get @@ -42,7 +42,7 @@ namespace WebWindowComplex private ParametriOpzioniParametriOpzioni[] opzioniField; /// - //[System.Xml.Serialization.XmlElementAttribute(Form = System.Xml.Schema.XmlSchemaForm.Unqualified)] + [System.Xml.Serialization.XmlElementAttribute(Form = System.Xml.Schema.XmlSchemaForm.Unqualified)] public string NomeParametro { get @@ -56,7 +56,7 @@ namespace WebWindowComplex } /// - //[System.Xml.Serialization.XmlElementAttribute(Form = System.Xml.Schema.XmlSchemaForm.Unqualified)] + [System.Xml.Serialization.XmlElementAttribute(Form = System.Xml.Schema.XmlSchemaForm.Unqualified)] public string DescrizioneParametro { get @@ -70,7 +70,7 @@ namespace WebWindowComplex } /// - //[System.Xml.Serialization.XmlElementAttribute(Form = System.Xml.Schema.XmlSchemaForm.Unqualified)] + [System.Xml.Serialization.XmlElementAttribute(Form = System.Xml.Schema.XmlSchemaForm.Unqualified)] public string ValoreCorrente { get @@ -84,7 +84,7 @@ namespace WebWindowComplex } /// - //[System.Xml.Serialization.XmlElementAttribute(Form = System.Xml.Schema.XmlSchemaForm.Unqualified)] + [System.Xml.Serialization.XmlElementAttribute(Form = System.Xml.Schema.XmlSchemaForm.Unqualified)] public string Tipo { get @@ -98,7 +98,7 @@ namespace WebWindowComplex } /// - //[System.Xml.Serialization.XmlElementAttribute(Form = System.Xml.Schema.XmlSchemaForm.Unqualified)] + [System.Xml.Serialization.XmlElementAttribute(Form = System.Xml.Schema.XmlSchemaForm.Unqualified)] public string Visible { get @@ -112,7 +112,7 @@ namespace WebWindowComplex } /// - //[System.Xml.Serialization.XmlElementAttribute(Form = System.Xml.Schema.XmlSchemaForm.Unqualified)] + [System.Xml.Serialization.XmlElementAttribute(Form = System.Xml.Schema.XmlSchemaForm.Unqualified)] public string RicalcolaSeModificato { get @@ -126,7 +126,7 @@ namespace WebWindowComplex } /// - //[System.Xml.Serialization.XmlElementAttribute("Opzioni", Form = System.Xml.Schema.XmlSchemaForm.Unqualified)] + [System.Xml.Serialization.XmlElementAttribute("Opzioni", Form = System.Xml.Schema.XmlSchemaForm.Unqualified)] public ParametriOpzioniParametriOpzioni[] Opzioni { get @@ -149,7 +149,7 @@ namespace WebWindowComplex private string valoreField; /// - //[System.Xml.Serialization.XmlElementAttribute(Form = System.Xml.Schema.XmlSchemaForm.Unqualified)] + [System.Xml.Serialization.XmlElementAttribute(Form = System.Xml.Schema.XmlSchemaForm.Unqualified)] public string NomeParametro { get @@ -163,7 +163,7 @@ namespace WebWindowComplex } /// - //[System.Xml.Serialization.XmlElementAttribute(Form = System.Xml.Schema.XmlSchemaForm.Unqualified)] + [System.Xml.Serialization.XmlElementAttribute(Form = System.Xml.Schema.XmlSchemaForm.Unqualified)] public string DescrizioneOpzione { get @@ -177,7 +177,7 @@ namespace WebWindowComplex } /// - //[System.Xml.Serialization.XmlElementAttribute(Form = System.Xml.Schema.XmlSchemaForm.Unqualified)] + [System.Xml.Serialization.XmlElementAttribute(Form = System.Xml.Schema.XmlSchemaForm.Unqualified)] public string Valore { get diff --git a/WebWindowComplex/TableComp.razor b/WebWindowComplex/TableComp.razor index 1689d5c..c63c04a 100644 --- a/WebWindowComplex/TableComp.razor +++ b/WebWindowComplex/TableComp.razor @@ -116,7 +116,10 @@ } @if (currStep == CompileStep.Tree) { - + + } else if (currStep == CompileStep.Frame) { @@ -124,7 +127,16 @@ { m_PreviousWindow = m_CurrWindow; } - + + } else if (currStep == CompileStep.Split) { @@ -134,7 +146,15 @@ } else { - + + } } else if (currStep == CompileStep.Sash) @@ -154,6 +174,7 @@ EC_RemoveArea="RemoveArea" EC_UpdateSash="UpdateSash" EC_UpdateSashHardware="UpdateHwOptions" + EC_CallFirstHwOpt="CallFirstHwOpt" EC_ReqClose="ReturnTree"> } @@ -166,12 +187,30 @@ } else { - + + } } else if (currStep == CompileStep.General) { - + + }
@@ -198,11 +237,4 @@ } } } -
- -@if (bError) -{ - -} \ No newline at end of file +
\ No newline at end of file diff --git a/WebWindowComplex/TableComp.razor.cs b/WebWindowComplex/TableComp.razor.cs index 768d747..e244d2c 100644 --- a/WebWindowComplex/TableComp.razor.cs +++ b/WebWindowComplex/TableComp.razor.cs @@ -27,6 +27,12 @@ namespace WebWindowComplex [Parameter] public SelectPayload? CurrSelection { get; set; } = null; + /// + /// Richiesta update da JWD (SVG, calcoli vari...) + /// + [Parameter] + public EventCallback> EC_DoUpdate { get; set; } + /// /// Richiesta chiusura JWD (+ refresh) /// se torna true --> richiesta salvataggio @@ -41,12 +47,6 @@ namespace WebWindowComplex [Parameter] public EventCallback EC_OnSelectedTemplate { get; set; } - /// - /// Richiesta update da JWD (SVG, calcoli vari...) - /// - [Parameter] - public EventCallback> EC_DoUpdate { get; set; } - /// /// Sollevo evento errore validazione con una lista di errori rilevati /// @@ -74,10 +74,37 @@ namespace WebWindowComplex if (m_CurrWindow != null) { m_CurrWindow.OnPreview -= M_CurrWindow_OnPreview; + m_CurrWindow.OnReqHwOption -= M_CurrWindow_OnHwOption; + m_CurrWindow.OnReqShape -= M_CurrWindow_OnShape; m_CurrWindow = null; } } + /// + /// Cerca e aggiorna la sash + /// + /// area corrente che si sta valutando + /// id della sash che si sta cercando + /// nuova sash + /// + public Area SearchSash(Area currentArea, int idSearch, Sash newSash) + { + if (currentArea.GroupId == idSearch && currentArea.AreaType.Equals(AreaTypes.SASH)) + { + currentArea = newSash; + return currentArea; + } + foreach (Area child in currentArea.AreaList) + { + Area found = SearchSash(child, idSearch, newSash); + if (found != null) + { + return found; + } + } + return null; + } + #endregion Public Methods #region Protected Fields @@ -107,8 +134,6 @@ namespace WebWindowComplex get => m_ItemTableList; } - protected string m_SelSVG { get; set; } = ""; - /// /// Componente SVG da mostrare /// @@ -130,10 +155,8 @@ namespace WebWindowComplex protected string SelColorMaterial { get; set; } = ""; protected string SelFamilyHardware { get; set; } = ""; protected string SelGlass { get; set; } = ""; - protected string SelProfile { get; set; } = ""; - protected string SelMaterial { get; set; } = ""!; - + protected string SelProfile { get; set; } = ""; protected TemplateSelectDTO? SelTemplateDTO { get; set; } = null; protected List SplitList @@ -164,7 +187,7 @@ namespace WebWindowComplex { if (s.Equals(currSash)) { - // Per ogni anta della Sash setto bHasHandle + // Per ogni anta della Sash setto HasHandle foreach (SashDimension item in s.SashList) { if (item.Equals(sashDim)) @@ -178,15 +201,19 @@ namespace WebWindowComplex switch (item.SelOpeningType) { case Openings.TILTTURN_LEFT: - item.SetOpeningType(Openings.TURNONLY_LEFT); - break; - + { + item.SetOpeningType(Openings.TURNONLY_LEFT); + break; + } case Openings.TILTTURN_RIGHT: - item.SetOpeningType(Openings.TURNONLY_RIGHT); - break; - + { + item.SetOpeningType(Openings.TURNONLY_RIGHT); + break; + } default: - break; + { + break; + } } } item.bHasHandle = false; @@ -194,6 +221,9 @@ namespace WebWindowComplex } } } + currSash.RefreshHardwareList(); + currSash.SetFirstHardware(); + _ = DoPreviewSvg(); } /// @@ -431,23 +461,27 @@ namespace WebWindowComplex /// /// Richiesta update anteprima SVG /// + /// Forza richiesta anche con JWD invariato + /// Nasconde hw (def. false) poiché senza è piu rapido /// - protected async Task DoPreviewSvg() + protected async Task DoPreviewSvg(bool doForce = false, bool hideHw = false) { if (m_CurrWindow != null) { #if DEBUG - var CurrJwd = JsonConvert.SerializeObject(m_CurrWindow.Serialize(), Formatting.Indented); + var CurrJwd = JsonConvert.SerializeObject(m_CurrWindow.Serialize(false), Formatting.Indented); + var CalcJwd = JsonConvert.SerializeObject(m_CurrWindow.Serialize(hideHw), Formatting.Indented); #else - var CurrJwd = JsonConvert.SerializeObject(m_CurrWindow.Serialize()); + var CurrJwd = JsonConvert.SerializeObject(m_CurrWindow.Serialize(false)); + var CalcJwd = JsonConvert.SerializeObject(m_CurrWindow.Serialize(hideHw)); #endif // verifico variazione JWD - if (!prevJwd.Equals(CurrJwd)) + if (!prevJwd.Equals(CurrJwd) || doForce) { prevJwd = CurrJwd; Dictionary Args = new Dictionary(); Args.Add("Mode", $"{(int)Enums.QuestionModes.PREVIEW}"); - Args.Add("Jwd", CurrJwd); + Args.Add("Jwd", CalcJwd); await EC_DoUpdate.InvokeAsync(Args); } } @@ -456,8 +490,9 @@ namespace WebWindowComplex /// /// Richiesta calcolo Options HW da JWD /// + /// Lista degli ID numerici dei gruppi da valutare /// - protected async Task DoReqOptHardware() + protected async Task DoReqOptHardware(List groupIdList, bool isFirst = false) { if (m_CurrWindow != null) { @@ -467,13 +502,15 @@ namespace WebWindowComplex var CurrJwd = JsonConvert.SerializeObject(m_CurrWindow.Serialize()); #endif // verifico variazione JWD - if (!prevJwd.Equals(CurrJwd)) + if (!prevJwd.Equals(CurrJwd) || isFirst) { prevJwd = CurrJwd; Dictionary Args = new Dictionary(); Args.Add("Mode", $"{(int)Enums.QuestionModes.HARDWARE}"); Args.Add("SubMode", $"{(int)Enums.QuestionHwSubModes.HARDWAREOPTIONS}"); Args.Add("Jwd", CurrJwd); + string listGroupId = JsonConvert.SerializeObject(groupIdList); + Args.Add("GroupId", listGroupId); await EC_DoUpdate.InvokeAsync(Args); } } @@ -482,8 +519,9 @@ namespace WebWindowComplex /// /// Richiesta Shape compatibile da JWD /// + /// Lista degli ID numerici dei gruppi da valutare /// - protected async Task DoReqShape() + protected async Task DoReqShape(List groupIdList) { if (m_CurrWindow != null) { @@ -500,6 +538,8 @@ namespace WebWindowComplex Args.Add("Mode", $"{(int)Enums.QuestionModes.HARDWARE}"); Args.Add("SubMode", $"{(int)Enums.QuestionHwSubModes.SASHSHAPE}"); Args.Add("Jwd", CurrJwd); + string listGroupId = JsonConvert.SerializeObject(groupIdList); + Args.Add("GroupId", listGroupId); await EC_DoUpdate.InvokeAsync(Args); } } @@ -537,7 +577,7 @@ namespace WebWindowComplex protected override void OnAfterRender(bool firstRender) { - isLoading = false; + isRendered = true; } /// @@ -547,13 +587,13 @@ namespace WebWindowComplex { // reset editLock... editLock = false; - // reset variabile errori - bError = false; listErrPre = new Dictionary(); listErrLink = new Dictionary(); listWarnings = new Dictionary(); } + private bool firstDisplay = true; + /// /// Gestione update post ricezione parametri da controllo chiamante /// @@ -563,81 +603,88 @@ namespace WebWindowComplex // SOLO SE sono presenti... if (ListPayload.IsPopulated() && LiveData.IsValid()) { - bool updateSvg = false; + bool updRequested = false; listErrPre = new Dictionary(); listErrLink = new Dictionary(); listWarnings = new Dictionary(); // controllo elenchi BasePayload siano validi... if (ListPayload.IsValid()) { - // controllo sia popolato anche per la componente LIVE - if (LiveData.IsValid()) + // SOLO SE modificato live data... + if (prevLiveData == null || !prevLiveData.Equals(LiveData)) { - // SOLO SE modificato live data... - if (prevLiveData == null || !prevLiveData.Equals(LiveData)) + updRequested = true; + prevLiveData = new LivePayload() { - prevLiveData = new LivePayload() - { - CurrJwd = LiveData.CurrJwd, - OptionsXml = LiveData.OptionsXml, - Shape = LiveData.Shape, - SvgPreview = LiveData.SvgPreview - }; - m_SelSVG = LiveData.SvgPreview; - // Aggiornati parametri di ingresso selezionati - UpdateSelParameter(); - JsonWindow WindowFromJson = new JsonWindow("", "", "", ""); - // provo a deserializzare - try - { - WindowFromJson = JsonConvert.DeserializeObject(LiveData.CurrJwd, new PolymorphicJsonConverter()) ?? new JsonWindow("", "", "", ""); - setCurrWindow(WindowFromJson); - //SOLO SE non sono in edit... - if (!editLock) - { - currStep = CompileStep.Tree; - } - } - // altrimenti errore! - catch (Exception ex) - { - listErrLink.Add("Window", $"Deserializing Error:{Environment.NewLine}{ex}"); - } - updateSvg = true; - } - checkWarnings(); - } - else if (CurrSelection != null && CurrSelection.Template != null) - { - // Se viene passato il template selezionato oppure se non è ancora stato selezionato un template oppure se si cambia template di selezione - if (m_SelTemplate == null || (m_SelTemplate != null && CurrSelection.Template.nIndex != m_SelTemplate.nIndex) && !string.IsNullOrEmpty(CurrSelection.Template.JWD)) + CurrJwd = LiveData.CurrJwd, + DictOptionsXml = LiveData.DictOptionsXml, + DictShape = LiveData.DictShape, + SvgPreview = LiveData.SvgPreview + }; + + // Aggiornati parametri di ingresso selezionati + UpdateSelParameter(); + JsonWindow WindowFromJson = new JsonWindow("", "", "", ""); + // provo a deserializzare + try { - m_SelTemplate = CurrSelection.Template; - // Aggiornamento parametri di ingresso selezionati - UpdateSelParameter(); - JsonWindow WindowFromJson = new JsonWindow("", "", "", ""); - // provo a deserializzare - try + WindowFromJson = JsonConvert.DeserializeObject(LiveData.CurrJwd, new PolymorphicJsonConverter()) ?? new JsonWindow("", "", "", ""); + setCurrWindow(WindowFromJson); + //SOLO SE non sono in edit... + if (!editLock) { - WindowFromJson = JsonConvert.DeserializeObject(m_SelTemplate.JWD, new PolymorphicJsonConverter()) ?? new JsonWindow("", "", "", ""); - setCurrWindow(WindowFromJson); - currStep = CompileStep.Template; - } - // altrimenti errore! - catch (Exception ex) - { - listErrLink.Add("Window", $"Deserializing Error:{Environment.NewLine}{ex}"); + currStep = CompileStep.Tree; } } - updateSvg = true; + // altrimenti errore! + catch (Exception ex) + { + listErrLink.Add("Window", $"Deserializing Error:{Environment.NewLine}{ex}"); + } } + checkWarnings(); if (SashList.Count > 0) { currAnta = 0; } - if (updateSvg) + if (updRequested) { - await DoPreviewSvg(); + + // se mancasse dizionario forme chiamo quello + if (LiveData.DictShape.Count == 0) + { + if (firstDisplay && isRendered) + { + firstDisplay = false; + // preview SVG senza HW + await DoPreviewSvg(true, true); + } + List reqList = SashList.Select(x => x.GroupId).ToList(); + if (reqList.Count > 0) + { + await DoReqShape(reqList); + } + } + //// se mancasse xml opzioni hardware lo chiedo + //else if (LiveData.DictOptionsXml.Count == 0) + //{ + // if (firstDisplay && isRendered) + // { + // firstDisplay = false; + // // preview SVG senza HW + // await DoPreviewSvg(true, true); + // } + // List reqList = SashList.Select(x => x.GroupId).ToList(); + // if (reqList.Count > 0) + // { + // await DoReqOptHardware(reqList); + // } + //} + else + { + // chiedo SVG + await DoPreviewSvg(true); + } } } else @@ -648,15 +695,23 @@ namespace WebWindowComplex } } + /// + /// Metodo per costruire oggetti della Window + /// + /// protected void setCurrWindow(JsonWindow WindowFromJson) { if (m_CurrWindow != null) { m_CurrWindow.OnPreview -= M_CurrWindow_OnPreview; + m_CurrWindow.OnReqHwOption -= M_CurrWindow_OnHwOption; + m_CurrWindow.OnReqShape -= M_CurrWindow_OnShape; m_CurrWindow = null; } m_CurrWindow = WindowFromJson.Deserialize(); m_CurrWindow.OnPreview += M_CurrWindow_OnPreview; + m_CurrWindow.OnReqHwOption += M_CurrWindow_OnHwOption; + m_CurrWindow.OnReqShape += M_CurrWindow_OnShape; // Recupero dimensioni Frame e Joint del frame della finestra precedente if (m_PreviousWindow != null) { @@ -672,6 +727,32 @@ namespace WebWindowComplex } if (SashList.Count > 0) currAnta = 0; + // se ho i dizionari delle forme le aggiungo + if (LiveData.DictShape.Count > 0) + { + // Inserisco le forme ricevuto nei sash group + foreach (var item in LiveData.DictShape) + { + //if (LiveData.DictShape.ContainsKey(item.GroupId)) + //{ + // item.UpdateShape(LiveData.DictOptionsXml[item.GroupId]); + //} + Sash sashFromGroupId = SashList.Where(x => x.GroupId == item.Key).ToList().First(); + sashFromGroupId.SashShape = item.Value; + sashFromGroupId.UpdateShape(item.Value); + } + } + // se ho le opzioni hw le aggiungo + if (LiveData.DictOptionsXml.Count > 0) + { + foreach (var item in SashList) + { + if (LiveData.DictOptionsXml.ContainsKey(item.GroupId)) + { + item.SetHardwareOption(LiveData.DictOptionsXml[item.GroupId]); + } + } + } } /// @@ -711,8 +792,6 @@ namespace WebWindowComplex #region Private Fields - private bool bError = false; - private int currAnta = 0; private int currFill = -1; @@ -729,6 +808,7 @@ namespace WebWindowComplex /// Booleana fase loading /// private bool isLoading = false; + private bool isRendered = false; /// /// ELenco errori di coerenza/link dati (vanno risolti per disegnare/procedere) @@ -782,9 +862,43 @@ namespace WebWindowComplex #region Private Methods + /// + /// Metodo per aggiungere una Sash + /// + /// + /// + private void AddSashIntoSplit(DataAreaSplitted Args) + { + Splitted currSplitted = Args.splitted; + currSplitted.AddFirstSash(); + // ricalcolo liste + UpdateLists(); + // richiedo update shape + List reqList = SashList.Select(x => x.GroupId).ToList(); + _ = DoReqShape(reqList); + } + + /// + /// Metodo per aggiungere una sash di default al Frame + /// + /// private void AddSashToFrame(Frame f) { - bError = f.AddFirstSash(); + f.AddFirstSash(); + // ricalcolo liste + UpdateLists(); + // richiedo update shape + List reqList = SashList.Select(x => x.GroupId).ToList(); + _ = DoReqShape(reqList); + } + + /// + /// Metodo per aggiungere uno split di default al Frame + /// + /// + private void AddSplitToFrame(Frame f) + { + f.AddSplit(); } /// @@ -829,7 +943,7 @@ namespace WebWindowComplex { foreach (Fill currFill in FillList) { - currFill.SetFillType(type); + currFill.SetSelFillType(type); } await DoPreviewSvg(); } @@ -869,7 +983,7 @@ namespace WebWindowComplex private async Task ChangeOneFill(FillTypes type) { Fill fillChange = FillList.ElementAt(currFill); - fillChange.SetFillType(type); + fillChange.SetSelFillType(type); await DoPreviewSvg(); } @@ -996,6 +1110,28 @@ namespace WebWindowComplex _ = EC_DoUpdate.InvokeAsync(Args); } + private void M_CurrWindow_OnHwOption(object? sender, OnReqHwOptEventArgs e) + { + Dictionary Args = new Dictionary(); + Args.Add("Mode", $"{(int)Enums.QuestionModes.HARDWARE}"); + Args.Add("SubMode", $"{(int)Enums.QuestionHwSubModes.HARDWAREOPTIONS}"); + Args.Add("Jwd", e.sJwd); + string listGroupId = JsonConvert.SerializeObject(new List { e.nGroupId }); + Args.Add("GroupId", listGroupId); + _ = EC_DoUpdate.InvokeAsync(Args); + } + + private void M_CurrWindow_OnShape(object? sender, OnReqShapeEventArgs e) + { + Dictionary Args = new Dictionary(); + Args.Add("Mode", $"{(int)Enums.QuestionModes.HARDWARE}"); + Args.Add("SubMode", $"{(int)Enums.QuestionHwSubModes.SASHSHAPE}"); + Args.Add("Jwd", e.sJwd); + string listGroupId = JsonConvert.SerializeObject(new List { e.groupId }); + Args.Add("GroupId", listGroupId); + _ = EC_DoUpdate.InvokeAsync(Args); + } + /// /// Calcola larghezza colonna contenente nav da mostrare /// @@ -1057,6 +1193,7 @@ namespace WebWindowComplex /// private void RemoveArea(Area currArea) { + //LiveData.DictShape.Clear(); if (currArea is Split) ((Split)currArea).Remove(); else if (currArea is Sash) @@ -1176,17 +1313,6 @@ namespace WebWindowComplex await DoPreviewSvg(); } - /// - /// Aggiornamento Sash e Frame - /// - /// nuova sash - /// - private async Task UpdateSash(Sash newSash) - { - SearchSash(m_Frame, newSash.IdGroup, newSash); - await DoPreviewSvg(); - } - /// /// Aggiornamento opzioni dato update sash /// @@ -1194,34 +1320,63 @@ namespace WebWindowComplex /// private async Task UpdateHwOptions(Sash newSash) { - await DoReqOptHardware(); + // richiesta calcolo opzioni hardware per la singola sash group + //string req = newSash.SelHardware.Id; + List reqList = new List() { newSash.GroupId }; + // chiamo con gruppo della nuova sash + await DoReqOptHardware(reqList); } /// - /// Cerca e aggiorna la sash + /// Prima chiamata alle opzioni hardware /// - /// area corrente che si sta valutando - /// id della sash che si sta cercando - /// nuova sash + /// Group Id del sash group di cui si vuole Hw option /// - public Area SearchSash(Area currentArea, int idSearch, Sash newSash) + private async Task CallFirstHwOpt(int groupId) { - if (currentArea.IdGroup == idSearch && currentArea.AreaType.Equals(AreaTypes.SASH)) - { - currentArea = newSash; - return currentArea; - } - foreach (Area child in currentArea.AreaList) - { - Area found = SearchSash(child, idSearch, newSash); - if (found != null) - { - return found; - } - } - return null; + bool isFirst = true; + List reqList = new List() { groupId }; + await DoReqOptHardware(reqList, isFirst); } + /// + /// Aggiornamento Sash e Frame + /// + /// nuova sash + /// + private async Task UpdateSash(Sash newSash) + { + SearchSash(FrameWindow, newSash.GroupId, newSash); + await DoPreviewSvg(); + } + + /// + /// Aggiornamento Shape x ogni Group di Sash della finestra + /// + /// + /// + private async Task UpdateShape(Frame newFrame) + { + //LiveData.DictShape.Clear(); + FrameWindow = newFrame; + // ciclo x ogni group della mia frame + List reqList = SashList.Select(x => x.GroupId).ToList(); + await DoReqShape(reqList); + } + + /// + /// Aggiornamento shape dato GroupId + /// + /// nuova sash + /// + private async Task UpdateShape(int groupId) + { + List reqList = new List() { groupId }; + await DoReqShape(reqList); +#if false + await DoReqShape(groupId); +#endif + } #endregion Private Methods } diff --git a/WebWindowComplex/WebWindowComplex.csproj b/WebWindowComplex/WebWindowComplex.csproj index 8a8a518..732ce7a 100644 --- a/WebWindowComplex/WebWindowComplex.csproj +++ b/WebWindowComplex/WebWindowComplex.csproj @@ -6,7 +6,7 @@ net8.0 enable enable - 2.7.10.2117 + 2.7.11.315 Annamaria Sassi Egalware Componente gestione Configurazioni avanzate Window per LUX @@ -39,3 +39,226 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/WebWindowConfigurator/WebWindowConfigurator.csproj b/WebWindowConfigurator/WebWindowConfigurator.csproj index 18da0ef..b3ffd65 100644 --- a/WebWindowConfigurator/WebWindowConfigurator.csproj +++ b/WebWindowConfigurator/WebWindowConfigurator.csproj @@ -6,7 +6,7 @@ net8.0 enable enable - 2.7.10.2117 + 2.7.11.315 Annamaria Sassi Egalware Componente gestione JWD per LUX @@ -98,6 +98,263 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/WebWindowTest/Window.cs b/WebWindowTest/Window.cs index bffa8bb..ef4cca0 100644 --- a/WebWindowTest/Window.cs +++ b/WebWindowTest/Window.cs @@ -1222,7 +1222,7 @@ namespace WebWindowTest } private string FindSashShape() { - return "Rectangular"; + return "Rectangle"; } internal Enums.OpeningTypes GetOpeningType(Openings OpeningType) {