Merge branch 'release/UpdateGestioneEventreport_01'

This commit is contained in:
Samuele Locatelli
2025-12-05 15:38:45 +01:00
68 changed files with 5712 additions and 1986 deletions
+32 -43
View File
@@ -7,23 +7,24 @@ Durante la configurazione ad ogni cambiamento viene aggiornata l'immagine del se
## 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
- 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
- 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;
- Cambiare le caratteristiche dei gruppi di ante, delle singole ante, degli split e del frame.
## JWD
@@ -53,17 +54,17 @@ Al frame sono associate le seguenti caratteristiche:
#### Forme Telaio
Le forme ammesse per il telaio sono le seguenti:
- Rectangle
- Right Chamfer
- Left Chamfer
- Double Chamfer
- Arc
- Full Arc
- Fillet
- Double Arc
- Three Center Arc
- Triangle,
- Custom
- Rectangle;
- Right Chamfer;
- Left Chamfer;
- Double Chamfer;
- Arc;
- Full Arc;
- Fillet;
- Double Arc;
- Three Center Arc;
- Triangle;
- Custom.
### Divisione (Split)
@@ -71,9 +72,9 @@ Uno split genera sempre almeno due sottoaree contenenti ognuna un riempimento (F
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.
- Orizzontale, viene definito il numero di split orizzontali e l'altezza delle nuove aree orizzontali formate;
- Verticale, viene definito il numero di split verticali e la larghezza delle nuove aree verticali formate;
- A griglia, viene definito il numero di split orizzontali e verticali e l'altezza delle aree orizzontali e la larghezza delle aree verticali; in questo caso si può scegliere se hanno la precedenza gli split orizzontali o verticali (cambia il modo in cui si esegue l'incrocio tra gli split).
### Gruppo di ante (Sash group)
@@ -81,33 +82,22 @@ Al gruppo di ante sono associate le seguenti caratteristiche:
- Numero di ante;
- Orientamento;
- Quantità bottom rail;
- Giunti;
- Codice hardware.
#### Forme gruppo ante
Le forme ammesse per il telaio sono le seguenti:
- Arc
- Circle
- Custom
- FullArc
- Rectangle
- SemiArc
- SemiFullArc
- Trapezoid
#### Singola anta
La singola anta ha associate le seguenti caratteristiche:
- Tipologia di apertura;
- Dimensione;
- Presenza maniglia.
- Tipo di misura per la dimensione (assoluta, percentuale o proporzionale)
- Presenza maniglia;
- Giunti.
#### 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;
- Tipo di 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).
@@ -115,6 +105,7 @@ La richiesta della forma del gruppo di ante viene trasmessa se si cambiano i seg
- Forma del telaio;
- Dimensioni del telaio;
- Aggiunta di uno split nel frame se già presente un gruppo di ante;
- Se si effettua lo scambio delle aree di uno split e una delle aree contiene una sash
- Eliminazione di uno split.
La lista degli hardware viene aggiornata se si cambiano i seguenti parametri:
@@ -135,8 +126,6 @@ Vengono richieste nei seguenti casi:
Descrive il tipo di riempimento: vetro o pannello.
## Roadmap
Mancano:
+7 -5
View File
@@ -9,6 +9,7 @@ using System.Diagnostics;
using System.Security.AccessControl;
using WebWindowComplex;
using WebWindowComplex.DTO;
using static WebWindowComplex.LayoutConst;
namespace Test.UI.Components.Pages
{
@@ -126,8 +127,9 @@ namespace Test.UI.Components.Pages
protected override async Task OnInitializedAsync()
{
ConfInit();
//InitialJwd = File.ReadAllText("Data\\FinestraDueAnteSeparate.jwd");
//InitialJwd = File.ReadAllText("Data\\FinestraSplitVert.jwd");
InitialJwd = File.ReadAllText("Data\\AntaDoppia.jwd");
//InitialJwd = File.ReadAllText("Data\\ArcoAntaDoppia.jwd");
currJwd = InitialJwd;
// rileggo altri dati
await ReloadData();
@@ -228,18 +230,18 @@ namespace Test.UI.Components.Pages
/// Esecuzione azione richiesta
/// </summary>
/// <param name="actReq">Azione richiesta</param>
private void DoAction(TableComp.DataAction actReq)
private void DoAction(DataAction actReq)
{
switch (actReq)
{
case TableComp.DataAction.None:
case DataAction.None:
break;
case TableComp.DataAction.ResetDictShape:
case DataAction.ResetDictShape:
CurrData.DictShape = new Dictionary<int, string>();
break;
case TableComp.DataAction.ResetHwOpt:
case DataAction.ResetHwOpt:
CurrData.DictOptionsXml = new Dictionary<int, string>();
break;
+40 -20
View File
@@ -29,11 +29,11 @@
},
{
"Index": 3,
"JointType": "FULL_H"
"JointType": "FULL_V"
},
{
"Index": 4,
"JointType": "FULL_H"
"JointType": "FULL_V"
}
],
"BottomRail": false,
@@ -47,34 +47,54 @@
"SashId": 1,
"OpeningType": "TILTTURN_LEFT",
"HasHandle": true,
"JointList": [
{
"Index": 1,
"JointType": "FULL_V"
},
{
"Index": 2,
"JointType": "FULL_V"
},
{
"Index": 3,
"JointType": "FULL_V"
},
{
"Index": 4,
"JointType": "FULL_V"
}
],
"MeasureType": "PERCENTAGE",
"Dimension": 50.0
},
{
"SashId": 2,
"OpeningType": "TURNONLY_RIGHT",
"HasHandle": false,
"JointList": [
{
"Index": 1,
"JointType": "FULL_V"
},
{
"Index": 2,
"JointType": "FULL_V"
},
{
"Index": 3,
"JointType": "FULL_V"
},
{
"Index": 4,
"JointType": "FULL_V"
}
],
"MeasureType": "PERCENTAGE",
"Dimension": 50.0
}
],
"SashType": "NULL",
"JointList": [
{
"Index": 1,
"JointType": "FULL_H"
},
{
"Index": 2,
"JointType": "FULL_H"
},
{
"Index": 3,
"JointType": "FULL_H"
},
{
"Index": 4,
"JointType": "FULL_H"
}
],
"BottomRail": false,
"BottomRailQty": 0,
"Hardware": "000633",
+6 -6
View File
@@ -29,11 +29,11 @@
},
{
"Index": 3,
"JointType": "FULL_H"
"JointType": "FULL_V"
},
{
"Index": 4,
"JointType": "FULL_H"
"JointType": "FULL_V"
}
],
"BottomRail": false,
@@ -54,19 +54,19 @@
"JointList": [
{
"Index": 1,
"JointType": "FULL_H"
"JointType": "FULL_V"
},
{
"Index": 2,
"JointType": "FULL_H"
"JointType": "FULL_V"
},
{
"Index": 3,
"JointType": "FULL_H"
"JointType": "FULL_V"
},
{
"Index": 4,
"JointType": "FULL_H"
"JointType": "FULL_V"
}
],
"Hardware": "000635",
+150
View File
@@ -0,0 +1,150 @@
{
"ProfilePath": "Profilo78",
"Material": "Pino",
"ColorMaterial": "Black",
"Glass": "Vetro BE 2S 4T/16/4T",
"AreaList": [
{
"Shape": "ARC",
"DimensionList": [
{
"Index": 1,
"Name": "Width",
"Value": 800.0
},
{
"Index": 2,
"Name": "Height",
"Value": 1500.0
},
{
"Index": 3,
"Name": "Full Height",
"Value": 1800.0
}
],
"JointList": [
{
"Index": 1,
"JointType": "FULL_H"
},
{
"Index": 2,
"JointType": "FULL_H"
},
{
"Index": 3,
"JointType": "FULL_V"
},
{
"Index": 4,
"JointType": "FULL_V"
}
],
"BottomRail": false,
"BottomRailQty": 0,
"ArcElement": {
"Section": 10.0,
"CutEdge": true,
"IsAlign": true
},
"GroupId": 1,
"AreaList": [
{
"IsSashVertical": true,
"ArcElement": {
"Section": 10.0,
"CutEdge": true,
"IsAlign": true
},
"SashList": [
{
"SashId": 1,
"OpeningType": "TILTTURN_LEFT",
"MeasureType": "PERCENTAGE",
"Dimension": 50.0,
"HasHandle": true,
"JointList": [
{
"Index": 1,
"JointType": "FULL_V"
},
{
"Index": 2,
"JointType": "FULL_V"
},
{
"Index": 3,
"JointType": "FULL_V"
},
{
"Index": 4,
"JointType": "FULL_V"
}
]
},
{
"SashId": 2,
"OpeningType": "TURNONLY_RIGHT",
"MeasureType": "PERCENTAGE",
"Dimension": 50.0,
"HasHandle": false,
"JointList": [
{
"Index": 1,
"JointType": "FULL_V"
},
{
"Index": 2,
"JointType": "FULL_V"
},
{
"Index": 3,
"JointType": "FULL_V"
},
{
"Index": 4,
"JointType": "FULL_V"
}
]
}
],
"SashType": "NULL",
"BottomRail": false,
"BottomRailQty": 0,
"Hardware": "000644",
"HwOptionList": [],
"GroupId": 2,
"AreaList": [
{
"GroupId": 4,
"AreaList": [
{
"FillType": "GLASS",
"GroupId": 3,
"AreaList": [],
"AreaType": "FILL"
}
],
"AreaType": "SPLITTED"
},
{
"GroupId": 5,
"AreaList": [
{
"FillType": "GLASS",
"GroupId": 6,
"AreaList": [],
"AreaType": "FILL"
}
],
"AreaType": "SPLITTED"
}
],
"AreaType": "SASH"
}
],
"AreaType": "FRAME"
}
]
}
+6 -6
View File
@@ -29,11 +29,11 @@
},
{
"Index": 3,
"JointType": "FULL_H"
"JointType": "FULL_V"
},
{
"Index": 4,
"JointType": "FULL_H"
"JointType": "FULL_V"
}
],
"BottomRail": false,
@@ -91,19 +91,19 @@
"JointList": [
{
"Index": 1,
"JointType": "FULL_H"
"JointType": "FULL_V"
},
{
"Index": 2,
"JointType": "FULL_H"
"JointType": "FULL_V"
},
{
"Index": 3,
"JointType": "FULL_H"
"JointType": "FULL_V"
},
{
"Index": 4,
"JointType": "FULL_H"
"JointType": "FULL_V"
}
],
"Hardware": "000631",
+10 -10
View File
@@ -34,11 +34,11 @@
},
{
"Index": 3,
"JointType": "FULL_H"
"JointType": "FULL_V"
},
{
"Index": 4,
"JointType": "FULL_H"
"JointType": "FULL_V"
}
],
"BottomRail": false,
@@ -78,19 +78,19 @@
"JointList": [
{
"Index": 1,
"JointType": "FULL_H"
"JointType": "FULL_V"
},
{
"Index": 2,
"JointType": "FULL_H"
"JointType": "FULL_V"
},
{
"Index": 3,
"JointType": "FULL_H"
"JointType": "FULL_V"
},
{
"Index": 4,
"JointType": "FULL_H"
"JointType": "FULL_V"
}
],
"BottomRail": false,
@@ -157,19 +157,19 @@
"JointList": [
{
"Index": 1,
"JointType": "FULL_H"
"JointType": "FULL_V"
},
{
"Index": 2,
"JointType": "FULL_H"
"JointType": "FULL_V"
},
{
"Index": 3,
"JointType": "FULL_H"
"JointType": "FULL_V"
},
{
"Index": 4,
"JointType": "FULL_H"
"JointType": "FULL_V"
}
],
"BottomRail": false,
+2 -2
View File
@@ -29,11 +29,11 @@
},
{
"Index": 3,
"JointType": "FULL_H"
"JointType": "FULL_V"
},
{
"Index": 4,
"JointType": "FULL_H"
"JointType": "FULL_V"
}
],
"BottomRail": false,
+4 -2
View File
@@ -29,11 +29,11 @@
},
{
"Index": 3,
"JointType": "FULL_H"
"JointType": "FULL_V"
},
{
"Index": 4,
"JointType": "FULL_H"
"JointType": "FULL_V"
}
],
"BottomRail": false,
@@ -46,10 +46,12 @@
"SplitVertList": [
{
"IsRelative": true,
"MeasureType": "PERCENTAGE",
"Dimension": 50.0
},
{
"IsRelative": true,
"MeasureType": "PERCENTAGE",
"Dimension": 50.0
}
],
+5 -2
View File
@@ -34,8 +34,8 @@
<ProjectReference Include="..\WebWindowComplex\WebWindowComplex.csproj" />
<ProjectReference Include="..\WebWindowConfigurator\WebWindowConfigurator.csproj" />
<ProjectReference Include="..\WebWindowTest\WebWindowTest.csproj" />
<PackageReference Include="EgwCoreLib.Lux.Core" Version="1.0.2511.318" />
<PackageReference Include="EgwCoreLib.Lux.Data" Version="1.0.2511.318" />
<PackageReference Include="EgwCoreLib.Lux.Core" Version="1.0.2511.1815" />
<PackageReference Include="EgwCoreLib.Lux.Data" Version="1.0.2511.1815" />
<PackageReference Include="EgwCoreLib.Razor" Version="1.5.2511.312" />
<PackageReference Include="EgwCoreLib.Utils" Version="1.5.2511.312" />
<PackageReference Include="Microsoft.AspNetCore.Components.WebAssembly.Server" Version="8.0.21" />
@@ -43,6 +43,9 @@
</ItemGroup>
<ItemGroup>
<None Update="Data\ArcoAntaDoppia.jwd">
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
</None>
<None Update="Data\AntaDoppia.jwd">
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
</None>
+8 -8
View File
@@ -10,14 +10,14 @@
"Redis": "redis.ufficio:26379, serviceName=devel, DefaultDatabase=6, keepAlive=180, connectTimeout=15000, syncTimeout=15000, asyncTimeout=15000, abortConnect=false, ssl=false, allowAdmin=true"
},
"ServerConf": {
"ChannelPng": "Egw:png:img",
"ChannelSvg": "Egw:svg:img",
"ChannelShape": "Egw:shape:curr",
"ChannelHwList": "Egw:hw:list",
"ChannelHwOpt": "Egw:hw:opt",
"ChannelProfList": "Egw:prof:list",
"ChannelBom": "Egw:bom",
"ChannelUpdate": "Egw:update",
"ChannelPng": "lux:png:img",
"ChannelSvg": "lux:svg:img",
"ChannelShape": "lux:shape:curr",
"ChannelHwList": "lux:hw:list",
"ChannelHwOpt": "lux:hw:opt",
"ChannelProfList": "lux:prof:list",
"ChannelBom": "lux:bom",
"ChannelUpdate": "lux:update",
"ChannelPub": "EgwEngineInput",
"ChannelSub": "EgwEngineOutput",
+1 -1
View File
@@ -5,7 +5,7 @@
<h5>Area frame</h5>
</div>
<div class="col d-flex justify-content-between">
@if (CurrSashList.Count == 0 && CurrSplitList.Count == 0)
@if (SashList.Count == 0 && SplitList.Count == 0)
{
<div class="input-group mb-2 justify-content-center">
<button class="btn btn-outline-secondary btn-sm" @onclick="RaiseAddSash">Aggiungi sash</button>
+16 -7
View File
@@ -7,14 +7,23 @@ namespace WebWindowComplex.Compo
{
#region Public Properties
[Parameter]
/// <summary>
/// Frame corrente
/// </summary>
[CascadingParameter(Name = "CurrFrameWindow")]
public Frame CurrFrameWindow { get; set; } = null!;
[Parameter]
public List<Sash> CurrSashList { get; set; } = null!;
/// <summary>
/// Lista sash
/// </summary>
[CascadingParameter(Name = "SashList")]
public List<Sash> SashList { get; set; } = null!;
[Parameter]
public List<Split> CurrSplitList { get; set; } = null!;
/// <summary>
/// Lista split
/// </summary>
[CascadingParameter(Name = "SplitList")]
public List<Split> SplitList { get; set; } = null!;
[Parameter]
public EventCallback<bool> EC_AddSash { get; set; }
@@ -27,7 +36,7 @@ namespace WebWindowComplex.Compo
#region Private Methods
/// <summary>
/// Sollevo evento richiesta aggiunta sash
/// Sollevo evento richiesta aggiunta sash su frame
/// </summary>
/// <returns></returns>
private async Task RaiseAddSash()
@@ -36,7 +45,7 @@ namespace WebWindowComplex.Compo
}
/// <summary>
/// Sollevo evento richiesta aggiunta window
/// Sollevo evento richiesta aggiunta split su frame
/// </summary>
/// <returns></returns>
private async Task RaiseAddSplit()
@@ -0,0 +1,66 @@
<div class="col-sm-6 my-2">
<div class="d-flex justify-content-between align-items-center">
<h6 class="fw-bold">Frame</h6>
</div>
</div>
<div class="card-body py-2">
<div class="row">
<div class="col-sm-6">
<div class="d-flex justify-content-start fs-5 mb-2">
<div class="px-1">
<input class="form-check-input ml-auto" type="checkbox" name="NumTrochetti" checked="@insertQty" @onclick="() => IsCheckedQty()">
</div>
<div class="px-2">
<div class="input-group mb-2">
<span class="input-group-text">Qty element</span>
@if (insertQty)
{
@* <input type="number" class="form-control" @bind="@ArcElementQty"> *@
}
else
{
<input type="number" class="form-control" disabled>
}
</div>
</div>
</div>
<div class="d-flex justify-content-start fs-5 mb-2">
<div class="px-1">
@* <input class="form-check-input ml-auto" type="checkbox" name="Estremità" checked="@CurrFrame.FrameArcElem.bCutEdge" @onclick="() => IsCheckCutEdge()"> *@
</div>
<div class="px-2">
<label class="form-check-label fs-6 text-dark">Taglio estremità</label>
</div>
</div>
</div>
<div class="col-sm-6">
<div class="d-flex justify-content-start fs-5 mb-2">
<div class="px-1">
<input class="form-check-input ml-auto" type="checkbox" name="Sezione" checked="@(!insertQty)" @onclick="() => IsCheckedQty()">
</div>
<div class="px-2">
<div class="input-group mb-2">
<span class="input-group-text">Section</span>
@if (!insertQty)
{
@* <input type="number" class="form-control" @bind="@ArcSection"> *@
}
else
{
<input type="number" class="form-control" disabled>
}
</div>
</div>
</div>
<div class="d-flex justify-content-start fs-5 mb-2">
<div class="px-1">
@* <input class="form-check-input ml-auto" type="checkbox" name="Allineamento" checked="@CurrFrame.FrameArcElem.bIsAlign" @onclick="() => IsCheckAlign()"> *@
</div>
<div class="px-2">
<label class="form-check-label fs-6 text-dark">Allineamento</label>
</div>
</div>
</div>
</div>
</div>
@@ -0,0 +1,84 @@
using Microsoft.AspNetCore.Components;
using System.Runtime.CompilerServices;
using WebWindowComplex.DTO;
using WebWindowComplex.Models;
namespace WebWindowComplex.Compo
{
public partial class AreaFrameArcElem
{
#region Public Properties
/// <summary>
/// Frame corrente
/// </summary>
[Parameter]
public Frame CurrFrame { get; set; } = null!;
[Parameter]
public EventCallback<Frame> EC_UpdatePreview { get; set; }
#endregion Public Properties
#region Protected Properties
//protected int ArcElementQty
//{
// get => CurrFrame.FrameArcElem.nQty;
// set
// {
// CurrFrame.FrameArcElem.nQty = value;
// _ = EC_UpdatePreview.InvokeAsync(CurrFrame);
// }
//}
//protected double ArcSection
//{
// get => CurrFrame.FrameArcElem.nSection;
// set
// {
// CurrFrame.FrameArcElem.nSection = value;
// _ = EC_UpdatePreview.InvokeAsync(CurrFrame);
// }
//}
#endregion Protected Properties
#region Protected Methods
protected void IsCheckedQty()
{
insertQty = !insertQty;
}
//protected void IsCheckCutEdge()
//{
// CurrFrame.FrameArcElem.bCutEdge = !CurrFrame.FrameArcElem.bCutEdge;
// _ = EC_UpdatePreview.InvokeAsync(CurrFrame);
//}
//protected void IsCheckAlign()
//{
// CurrFrame.FrameArcElem.bIsAlign = !CurrFrame.FrameArcElem.bIsAlign;
// _ = EC_UpdatePreview.InvokeAsync(CurrFrame);
//}
protected string IsUsedQty()
{
if (insertQty)
return "form-control";
else
return "form-control disabled";
}
#endregion Protected Methods
#region Private Fields
private bool insertQty = false;
#endregion Private Fields
}
}
+3 -3
View File
@@ -1,11 +1,11 @@
@using static WebWindowComplex.Json.WindowConst
<div class="row mt-2">
<div class="row">
<div class="col d-flex justify-content-start align-items-center">
<h6 class="fw-bold">Hardware option</h6>
</div>
<div class="col d-flex justify-content-md-end align-items-center">
<button class="btn btn-primary" type="button" @onclick="() => changeCollapsed()">@((MarkupString)hwIcon)</button>
<button class="btn btn-primary btn-sm" type="button" @onclick="() => changeCollapsed()">@((MarkupString)hwIcon)</button>
</div>
</div>
<div class="row mt-2">
@@ -30,7 +30,7 @@
{
<div class="scrollspy my-2" tabindex="0"
style="position: relative; height: 15rem; overflow-y: auto;">
@foreach (var currOpt in CurrSash.HwOptionList)
@foreach (var currOpt in CurrSashGroup.HwOptionList)
{
switch (currOpt.Type)
{
+26 -14
View File
@@ -11,20 +11,14 @@ namespace WebWindowComplex.Compo
/// <summary>
/// Sash corrente rispetto alla lista Sash
/// </summary>
[Parameter]
public Sash CurrSash { get; set; } = null!;
[CascadingParameter(Name = "CurrSashGroup")]
public Sash CurrSashGroup { get; set; } = null!;
/// <summary>
/// Evento per aggiornare gli hardware option di tipo combo
/// Evento per aggiornare gli hardware option
/// </summary>
[Parameter]
public EventCallback<AGBOptionCombo> EC_UpdateHwOptCombo { get; set; }
/// <summary>
/// Evento per aggiornare gli hardware option di tipo text
/// </summary>
[Parameter]
public EventCallback<AGBOptionText> EC_UpdateHwOptText { get; set; }
public EventCallback<DataUpdateHwOption> EC_UpdateHwOpt { get; set; }
/// <summary>
/// Evento per chiamare la prima volta la lista delle opzioni
@@ -48,9 +42,9 @@ namespace WebWindowComplex.Compo
private async Task changeCollapsed()
{
hwOptCollapsed = !hwOptCollapsed;
if (CurrSash.HwOptionList.Count == 0)
if (CurrSashGroup.HwOptionList.Count == 0)
{
await EC_FirstHwOptionList.InvokeAsync(CurrSash.GroupId);
await EC_FirstHwOptionList.InvokeAsync();
}
}
@@ -66,7 +60,11 @@ namespace WebWindowComplex.Compo
/// <returns></returns>
private async Task RaiseOptCombo(AGBOptionCombo updRec)
{
await EC_UpdateHwOptCombo.InvokeAsync(updRec);
var args = new DataUpdateHwOption
{
AGBOptCombo = updRec
};
await EC_UpdateHwOpt.InvokeAsync(args);
}
/// <summary>
@@ -76,11 +74,25 @@ namespace WebWindowComplex.Compo
/// <returns></returns>
private async Task RaiseOptText(AGBOptionText updRec)
{
await EC_UpdateHwOptText.InvokeAsync(updRec);
var args = new DataUpdateHwOption
{
AGBOptText = updRec
};
await EC_UpdateHwOpt.InvokeAsync(args);
}
private bool IsLoadingHwOpt
{
get => IsLoading != null && IsLoading.Count > 0 && IsLoading.Contains("LoadHwOpt");
}
}
/// <summary>
/// Classe per oggetto di aggiornamento delle opzioni
/// </summary>
public class DataUpdateHwOption
{
public AGBOptionText AGBOptText { get; set; } = null;
public AGBOptionCombo AGBOptCombo { get; set; } = null;
}
}
+163 -67
View File
@@ -1,78 +1,174 @@
<div class="col-sm-6 my-2">
<div class="d-flex justify-content-start align-items-center">
<h6 class="fw-bold">Sash @(CurrSashGroup.SashList.Count == 1 ? "" : (IndexSash + 1))</h6>
</div>
<div class="input-group mb-2">
<label class="input-group-text">Tipology</label>
<select class="form-select" @bind="@CurrSashDim.SelOpeningTypeIndex">
@foreach (var openingType in CurrSashDim.OpeningTypeList)
@using EgwCoreLib.Razor
@if(mode == ModeView.View)
{
<div class="col-lg-6 col-md-12 my-2">
<div class="d-flex justify-content-between align-items-center">
<h6 class="fw-bold">Sash @(CurrSashGroup.SashList.Count == 1 ? "" : (IndexSash + 1))</h6>
@if(CurrSashGroup.SashList.Count > 1)
{
<option value=@(openingType.Id)>@(openingType.Name)</option>
<div class="dropdown">
<button class="btn btn-outline-secondary dropdown-toggle btn-sm" type="button" @onclick="ToggleDropdown">
Copy content
</button>
<ul class="dropdown-menu @(isOpen ? "show" : "")" style="min-width:5rem; max-width:10rem">
@for (int k = 0; k <= CurrSashGroup.SashList.Count - 1; k++)
{
@if (k != IndexSash)
{
int IndexCopy = k;
int IndexModify = IndexSash;
<li>
<button class="dropdown-item" @onclick="() => CopyContentSash(IndexCopy, IndexModify)">
Sash @(k + 1)
</button>
</li>
}
}
</ul>
</div>
}
</select>
</div>
<div class="input-group mb-2">
<label class="input-group-text">MeasureType</label>
<select class="form-select" @bind="@CurrSashDim.SelMeasureTypeIndex">
@foreach (var mType in CurrSashDim.MeasureTypeList)
{
<option value=@(mType.Id)>@(mType.Name)</option>
}
</select>
</div>
<div class="input-group mb-2">
<span class="input-group-text">Dimension</span>
<input type="number" class="form-control" @bind="@CurrSashDim.dDimension">
@switch (CurrSashDim.MeasureType)
{
case Json.WindowConst.MeasureTypes.ABSOLUT:
{
<span class="input-group-text">mm</span>
break;
}
case Json.WindowConst.MeasureTypes.PERCENTAGE:
{
<span class="input-group-text">%</span>
break;
}
}
</div>
<div class="d-flex justify-content-start fs-5 mb-2">
<div class="px-1">
<input class="form-check-input ml-auto" type="checkbox" name="Handle" checked="@CurrSashDim.bHasHandle" @onclick="() => RaiseChangeHandle(CurrSashDim, CurrSashGroup)">
<button class="btn btn-outline-secondary btn-sm" type="button" @onclick="() => doEdit(IndexSash)">Edit</button>
</div>
<div class="px-2">
<label class="form-check-label fs-6 text-dark">Handle</label>
<div class="input-group mb-2 mt-2">
<label class="input-group-text">Tipology</label>
<select class="form-select" @bind="@OpeningTypeIndex">
@foreach (var openingType in CurrSashDim.OpeningTypeList)
{
<option value=@(openingType.Id)>@(openingType.Name)</option>
}
</select>
</div>
</div>
@if (!(CurrAnta.AreaList[0] is Split))
{
<div class="row">
<div class="col-md-12 col-lg-6">
<div class="input-group mb-2 justify-content-center">
<button class="btn btn-outline-secondary btn-sm" @onclick="() => CurrAnta.AddSplit()">Add split</button>
</div>
<div class="input-group mb-2">
<span class="input-group-text">Dimension</span>
<InputDouble CssClass="form-control form-control text-end" Decimals="@CssDecimals()" @bind-Value="@Dimension"></InputDouble>
@* <input type="number" class="form-control" @bind="@CurrSashDim.dDimension"> *@
<select class="form-select" style="max-width:6rem; background-color:#e9ecef" @bind="@MeasureTypeIndex">
@foreach (var mType in CurrSashDim.MeasureTypeList)
{
<option value=@(mType.Id)>
@switch (mType.Name)
{
case "Absolute":
{
<span class="input-group-text">mm</span>
break;
}
case "Proportional":
{
<span class="input-group-text">*</span>
break;
}
case "Percentage":
{
<span class="input-group-text">%</span>
break;
}
}
</option>
}
</select>
</div>
<div class="d-flex justify-content-start fs-5 mb-2">
<div class="px-1">
<input class="form-check-input ml-auto" type="checkbox" name="Handle" checked="@CurrSashDim.bHasHandle" @onclick="() => ChangeHandle()">
</div>
<div class="col-md-12 col-lg-6">
<div class="px-2">
<label class="form-check-label fs-6 text-dark">Handle</label>
</div>
</div>
</div>
}
else
{
@* <div class="border rounded py-2 px-3"> *@
<div class="d-flex justify-content-between align-items-center mb-2">
<h6 class="fw-bold text-nowrap">Sash @(CurrSashGroup.SashList.Count == 1 ? "" : (IndexSash + 1))</h6>
@if (!(CurrAnta.AreaList[0] is Split))
{
<div class="input-group mb-2 justify-content-center">
<button class="btn btn-outline-secondary btn-sm" @onclick="() => AddSplitToSash()">Add split</button>
</div>
<div class="input-group mb-2 justify-content-center">
<button class="btn btn-outline-secondary btn-sm">Add inglesina</button>
</div>
</div>
}
<button type="button" class="btn-close" data-bs-dismiss="modal" aria-label="Close" @onclick="() => ClosePopup(IndexSash)"></button>
</div>
}
<div class="row d-flex justify-content-center align-items-center">
@for (int k = 0; k <= CurrSashGroup.SashList.Count - 1; k++)
{
@if (k != IndexSash)
{
int IndexCopy = k;
int IndexModify = IndexSash;
<div class="col-md-12 col-lg-6 my-1">
<div class="input-group justify-content-center">
<button class="btn btn-outline-secondary btn-sm" @onclick="() => RaiseCopyContentSash(CurrSashGroup, IndexCopy, IndexModify)">Copy sash @(k + 1)</button>
<div class="row">
<div class="col-lg-6 col-md-12 my-2">
<div class="input-group mb-2">
<label class="input-group-text">Tipology</label>
<select class="form-select" @bind="@OpeningTypeIndex">
@foreach (var openingType in CurrSashDim.OpeningTypeList)
{
<option value=@(openingType.Id)>@(openingType.Name)</option>
}
</select>
</div>
<div class="input-group mb-2">
<span class="input-group-text">Dimension</span>
<InputDouble CssClass="form-control form-control text-end" Decimals="@CssDecimals()" @bind-Value="@Dimension"></InputDouble>
<select class="form-select" style="max-width:6rem; background-color:#e9ecef" @bind="@MeasureTypeIndex">
@foreach (var mType in CurrSashDim.MeasureTypeList)
{
<option value=@(mType.Id)>
@switch (mType.Name)
{
case "Absolute":
{
<span class="input-group-text">mm</span>
break;
}
case "Proportional":
{
<span class="input-group-text">*</span>
break;
}
case "Percentage":
{
<span class="input-group-text">%</span>
break;
}
}
</option>
}
</select>
</div>
<div class="d-flex justify-content-start fs-5 mb-2">
<div class="px-1">
<input class="form-check-input ml-auto" type="checkbox" name="Handle" checked="@CurrSashDim.bHasHandle" @onclick="() => ChangeHandle()">
</div>
<div class="px-2">
<label class="form-check-label fs-6 text-dark">Handle</label>
</div>
</div>
</div>
}
}
</div>
</div>
<div class="col-lg-6 col-md-12">
<div class="row justify-content-between align-items-center">
<div class="col d-flex justify-content-start align-items-center">
<h6>Joints</h6>
</div>
<div class="col d-flex">
<div class="input-group mb-2 justify-content-center">
<button class="@ButtonJointCss(WebWindowComplex.Json.WindowConst.Joints.ANGLED)" @onclick="() => ChangeAllJoints(WebWindowComplex.Json.WindowConst.Joints.ANGLED)">Angled</button>
</div>
</div>
<div class="col d-flex">
<div class="input-group mb-2 justify-content-center">
<button class="@ButtonJointCss(WebWindowComplex.Json.WindowConst.Joints.FULL_H)" @onclick="() => ChangeAllJoints(WebWindowComplex.Json.WindowConst.Joints.FULL_H)">Horizontal</button>
</div>
</div>
<div class="col d-flex">
<div class="input-group mb-2 justify-content-center">
<button class="@ButtonJointCss(WebWindowComplex.Json.WindowConst.Joints.FULL_V)" @onclick="() => ChangeAllJoints(WebWindowComplex.Json.WindowConst.Joints.FULL_V)">Vertical</button>
</div>
</div>
</div>
@foreach (Joint joint in CurrSashDim.JointList)
{
<EditJoint CurrRec="joint" EC_Update="UpdateJoint"></EditJoint>
}
</div>
</div>
@* </div> *@
}
+254 -37
View File
@@ -1,5 +1,9 @@
using EgwCoreLib.Razor;
using Microsoft.AspNetCore.Components;
using Newtonsoft.Json.Linq;
using System;
using WebWindowComplex.Models;
using static WebWindowComplex.Json.WindowConst;
namespace WebWindowComplex.Compo
{
@@ -8,7 +12,7 @@ namespace WebWindowComplex.Compo
/// <summary>
/// Sash group corrente
/// </summary>
[Parameter]
[CascadingParameter(Name = "CurrSashGroup")]
public Sash CurrSashGroup { get; set; } = null!;
/// <summary>
@@ -17,6 +21,18 @@ namespace WebWindowComplex.Compo
[Parameter]
public SashDimension CurrSashDim { get; set; } = null!;
/// <summary>
/// Lista delle sash
/// </summary>
[CascadingParameter(Name = "SashList")]
public List<Sash> SashList { get; set; } = null!;
/// <summary>
/// Modalità di visualizzazione (view /edit)
/// </summary>
[Parameter]
public bool EditMode { get; set; } = false;
/// <summary>
/// Indice della sash corrente
/// </summary>
@@ -24,26 +40,33 @@ namespace WebWindowComplex.Compo
public int IndexSash { get; set; } = 0;
/// <summary>
/// Evento per cambiare l'anta su cui è presente la maniglia
/// Evento per aggiornare sash dimension
/// </summary>
[Parameter]
public EventCallback<DataChangeHandle> EC_ChangeHandle { get; set; }
public EventCallback<SashDimension> EC_UpdateSashDim { get; set; }
/// <summary>
/// Evento per cambiare l'anta su cui è presente la maniglia
/// Evento per aggiornare sash
/// </summary>
[Parameter]
public EventCallback<DataCopyContentSash> EC_CopyContentSash { get; set; }
public EventCallback<Sash> EC_UpdateSash { get; set; }
/// <summary>
/// Evento per cambiare modalità di visualizzazione
/// </summary>
[Parameter]
public EventCallback<DataChangeMode> EC_EditView { get; set; }
/// <summary>
/// Anta corrente
/// </summary>
public Area CurrAnta
{
public Area CurrAnta
{
get
{
if(CurrSashGroup.AreaList[IndexSash] is Splitted)
{
if (CurrSashGroup.AreaList[IndexSash] is Splitted)
{
return CurrSashGroup.AreaList[IndexSash];
}
else
@@ -58,49 +81,243 @@ namespace WebWindowComplex.Compo
}
/// <summary>
/// Sollevo evento per cambiare l'anta su cui è presente la maniglia
/// Metodo per avere il numero di decimali da usare nella form-input
/// </summary>
/// <returns></returns>
private async Task RaiseChangeHandle(SashDimension sashDim, Sash currSash)
public int CssDecimals()
{
var Args = new DataChangeHandle
switch (CurrSashDim.MeasureType)
{
currSashDimension = sashDim,
currItem = currSash,
};
await EC_ChangeHandle.InvokeAsync(Args);
case Json.WindowConst.MeasureTypes.ABSOLUTE:
{
return 2;
}
case Json.WindowConst.MeasureTypes.PROPORTIONAL:
{
return 0;
}
case Json.WindowConst.MeasureTypes.PERCENTAGE:
{
return 1;
}
}
return 0;
}
/// <summary>
/// Sollevo evento per cambiare l'anta su cui è presente la maniglia
/// Selezione tipo di apertura anta
/// </summary>
protected int OpeningTypeIndex
{
get => CurrSashDim.SelOpeningTypeIndex;
set
{
if (CurrSashDim.SelOpeningTypeIndex != value)
{
CurrSashDim.SelOpeningTypeIndex = value;
_ = EC_UpdateSashDim.InvokeAsync(CurrSashDim);
}
}
}
/// <summary>
/// Selezione tipo di misura della dimensione dell'anta
/// </summary>
protected int MeasureTypeIndex
{
get => CurrSashDim.SelMeasureTypeIndex;
set
{
if (CurrSashDim.SelMeasureTypeIndex != value)
{
CurrSashDim.SelMeasureTypeIndex = value;
_ = EC_UpdateSashDim.InvokeAsync(CurrSashDim);
}
}
}
/// <summary>
/// Inserimento dimensione anta
/// </summary>
protected double Dimension
{
get => CurrSashDim.dDimension;
set
{
if (CurrSashDim.dDimension != value)
{
CurrSashDim.dDimension = value;
_ = EC_UpdateSashDim.InvokeAsync(CurrSashDim);
}
}
}
/// <summary>
/// Sollevo evento richiesta per cambiare tutti i Joint
/// </summary>
/// <returns></returns>
private async Task RaiseCopyContentSash(Sash currSash, int indexC, int indexM)
private async Task ChangeAllJoints(Json.WindowConst.Joints JointType)
{
var Args = new DataCopyContentSash
foreach (var item in CurrSashDim.JointList)
item.SetSelJointType(JointType);
await EC_UpdateSashDim.InvokeAsync(CurrSashDim);
}
/// <summary>
/// Aggiornamento joint
/// </summary>
/// <param name="updRec"></param>
/// <returns></returns>
private async Task UpdateJoint(Joint updRec)
{
// cerco il record
var currRec = CurrSashDim.JointList.FirstOrDefault(x => x.ParentArea == updRec.ParentArea && x.nIndex == updRec.nIndex);
// lo aggiorno
if (updRec != null)
{
currItem = currSash,
indexCopy = indexC,
indexModify = indexM,
currRec = updRec;
await EC_UpdateSashDim.InvokeAsync(CurrSashDim);
}
}
/// <summary>
/// Metodo per cambiare l'anta su cui è presente la maniglia
/// </summary>
/// <returns></returns>
private async Task ChangeHandle()
{
// Cerco la Sash che si sta considerando nella lista Sash
var s = SashList.Where(x => x.GroupId == CurrSashGroup.GroupId).FirstOrDefault();
if (s != null)
{
// Setto la presenza o meno della maniglia per ogni anta
foreach (SashDimension item in s.SashList)
{
if (item.Equals(CurrSashDim))
{
item.bHasHandle = true;
}
else
{
if (item.bHasHandle)
{
switch (item.SelOpeningType)
{
case Openings.TILTTURN_LEFT:
{
item.SetOpeningType(Openings.TURNONLY_LEFT);
break;
}
case Openings.TILTTURN_RIGHT:
{
item.SetOpeningType(Openings.TURNONLY_RIGHT);
break;
}
default:
{
break;
}
}
}
item.bHasHandle = false;
}
}
}
CurrSashGroup.RefreshHardwareList();
CurrSashGroup.SetFirstHardware();
await EC_UpdateSash.InvokeAsync(CurrSashGroup);
}
/// <summary>
/// Copio contenuto anta da indexCopy a IndexModify
/// </summary>
/// <returns></returns>
private async Task CopyContentSash(int IndexCopy, int IndexModify)
{
isOpen = !isOpen;
// Anta selezionata
Area sashSplitted = CurrSashGroup.AreaList[IndexModify];
// Rimuovo riempimento da anta selezionata
sashSplitted.AreaList.RemoveAt(0);
// Creo la copia dell'anta scelta
Area a = CurrSashGroup.AreaList[IndexCopy].AreaList.First().Copy(sashSplitted);
// Aggiungo copia all'anta selezionata
CurrSashGroup.AreaList[IndexModify].AreaList.Add(a);
await EC_UpdateSash.InvokeAsync(CurrSashGroup);
}
/// <summary>
/// Metodo per aggiungere lo split nella singola anta
/// </summary>
/// <returns></returns>
private async Task AddSplitToSash()
{
CurrAnta.AddSplit();
await EC_UpdateSash.InvokeAsync(CurrSashGroup);
}
private bool isOpen = false;
private void ToggleDropdown()
{
isOpen = !isOpen;
}
/// <summary>
/// Metodo per determinare la visualizzazione dei pulsanti dei joint
/// </summary>
/// <param name="type"></param>
/// <returns></returns>
private string ButtonJointCss(WebWindowComplex.Json.WindowConst.Joints type)
{
foreach (var item in CurrSashDim.JointList)
{
if (!item.SelJointType.Equals(type))
return "btn btn-outline-secondary btn-sm";
}
return "btn btn-secondary btn-sm";
}
private enum ModeView
{
NULL = 0,
View = 1,
Edit = 2
}
protected override void OnParametersSet()
{
if (EditMode)
mode = ModeView.Edit;
else
mode = ModeView.View;
}
private ModeView mode { get; set; } = ModeView.View;
private void doEdit(int index)
{
var args = new DataChangeMode
{
Edit = true,
IndexSashEdit = index,
IndexSashClose = -1
};
await EC_CopyContentSash.InvokeAsync(Args);
_ = EC_EditView.InvokeAsync(args);
}
protected void ClosePopup(int index)
{
var args = new DataChangeMode
{
Edit = false,
IndexSashEdit = -1,
IndexSashClose = index
};
_ = EC_EditView.InvokeAsync(args);
}
}
public class DataChangeHandle
{
public SashDimension currSashDimension { get; set; } = null!;
public Sash currItem { get; set; } = null!;
public class DataChangeMode {
public bool Edit { get; set; }
public int IndexSashEdit { get; set; }
public int IndexSashClose { get; set; }
}
public class DataCopyContentSash
{
public Sash currItem { get; set; } = null!;
public int indexCopy { get; set; } = 0;
public int indexModify { get; set; } = 0;
}
}
@@ -0,0 +1,58 @@
<div class="col-sm-6 my-2">
<div class="d-flex justify-content-between align-items-center">
<h6 class="fw-bold">Sash</h6>
</div>
</div>
<div class="card-body py-2">
<div class="row">
<div class="col-sm-6">
<div class="d-flex justify-content-start fs-5 mb-2">
<div class="px-1">
<input class="form-check-input ml-auto" type="checkbox" name="NumTrochetti" checked="@insertQty" @onclick="() => IsCheckedQty()">
</div>
<div class="px-2">
<div class="input-group mb-2">
<span class="input-group-text">Qty element</span>
@if (insertQty)
{
@* <input type="number" class="form-control" @bind="@ArcElementQty"> *@
}
else
{
<input type="number" class="form-control" disabled>
}
</div>
</div>
</div>
<div class="d-flex justify-content-start fs-5 mb-2">
<div class="px-1">
@* <input class="form-check-input ml-auto" type="checkbox" name="Estremità" checked="@CurrSashGroup.SashArcElem.bCutEdge" @onclick="() => IsCheckCutEdge()"> *@
</div>
<div class="px-2">
<label class="form-check-label fs-6 text-dark">Taglio estremità</label>
</div>
</div>
</div>
<div class="col-sm-6">
<div class="d-flex justify-content-start fs-5 mb-2">
<div class="px-1">
<input class="form-check-input ml-auto" type="checkbox" name="Sezione" checked="@(!insertQty)" @onclick="() => IsCheckedQty()">
</div>
<div class="px-2">
<div class="input-group mb-2">
<span class="input-group-text">Section</span>
@if (!insertQty)
{
@* <input type="number" class="form-control" @bind="@ArcSection"> *@
}
else
{
<input type="number" class="form-control" disabled>
}
</div>
</div>
</div>
</div>
</div>
</div>
@@ -0,0 +1,78 @@
using Microsoft.AspNetCore.Components;
using System.Runtime.CompilerServices;
using WebWindowComplex.DTO;
using WebWindowComplex.Models;
namespace WebWindowComplex.Compo
{
public partial class AreaSashArcElem
{
#region Public Properties
/// <summary>
/// Sash corrente
/// </summary>
[Parameter]
public Sash CurrSashGroup { get; set; } = null!;
[Parameter]
public EventCallback<Sash> EC_UpdatePreview { get; set; }
#endregion Public Properties
#region Protected Properties
//protected int ArcElementQty
//{
// get => CurrSashGroup.SashArcElem.nQty;
// set
// {
// CurrSashGroup.SashArcElem.nQty = value;
// _ = EC_UpdatePreview.InvokeAsync(CurrSashGroup);
// }
//}
//protected double ArcSection
//{
// get => CurrSashGroup.SashArcElem.nSection;
// set
// {
// CurrSashGroup.SashArcElem.nSection = value;
// _ = EC_UpdatePreview.InvokeAsync(CurrSashGroup);
// }
//}
#endregion Protected Properties
#region Protected Methods
protected void IsCheckedQty()
{
insertQty = !insertQty;
}
//protected void IsCheckCutEdge()
//{
// CurrSashGroup.SashArcElem.bCutEdge = !CurrSashGroup.SashArcElem.bCutEdge;
// _ = EC_UpdatePreview.InvokeAsync(CurrSashGroup);
//}
protected string IsUsedQty()
{
if (insertQty)
return "form-control";
else
return "form-control disabled";
}
#endregion Protected Methods
#region Private Fields
private bool insertQty = false;
#endregion Private Fields
}
}
+5 -5
View File
@@ -1,20 +1,20 @@
<div class="card shadow-sm rounded">
<div class="card-body py-2">
<div class="d-flex justify-content-between align-items-center">
<div class="col d-flex justify-content-center">
<h5>Area split @(CurrSplittedList.Count > 1 ? (CurrSplittedList.IndexOf(CurrSplitted) + 1) : "")</h5>
<div class="col-4 d-flex justify-content-left">
<h5>Area split @(SplittedList.Count > 1 ? (SplittedList.IndexOf(CurrSplitted) + 1) : "")</h5>
</div>
<div class="col d-flex justify-content-center">
<div class="input-group mb-2 justify-content-center">
<button class="btn btn-outline-secondary btn-sm" @onclick="() => RaiseAddSash(CurrSplitted)">Add Sash</button>
<button class="btn btn-outline-secondary btn-sm" @onclick="() => RaiseAddSash()">Add Sash</button>
</div>
</div>
<div class="col d-flex justify-content-center">
@for (int j = 0; j < CurrSashList.Count; j++)
@for (int j = 0; j < SashList.Count; j++)
{
int Index = j;
<div class="input-group mb-2 justify-content-center">
<button class="btn btn-outline-secondary btn-sm" @onclick="() => RaiseCopySash(CurrSplitted,Index)">Copy Sash @(CurrSashList.Count == 1 ? "" : (Index + 1))</button>
<button class="btn btn-outline-secondary btn-sm" @onclick="() => RaiseCopySash(Index)">Copy Sash @(SashList.Count == 1 ? "" : (Index + 1))</button>
</div>
}
</div>
+19 -43
View File
@@ -12,80 +12,56 @@ namespace WebWindowComplex.Compo
/// Lista delle sash
/// </summary>
[Parameter]
public List<Sash> CurrSashList { get; set; } = null;
public List<Sash> SashList { get; set; } = null!;
/// <summary>
/// Oggetto splitted corrente
/// </summary>
[Parameter]
public Splitted CurrSplitted { get; set; } = null;
public Splitted CurrSplitted { get; set; } = null!;
/// <summary>
/// Lista degli Splitted
/// </summary>
[Parameter]
public List<Splitted> CurrSplittedList { get; set; } = null;
/// <summary>
/// Evento per copiare Sash
/// </summary>
[Parameter]
public EventCallback<DataAreaSplit> EC_CopySash { get; set; }
public List<Splitted> SplittedList { get; set; } = null!;
/// <summary>
/// Evento per aggiungere Sash
/// </summary>
[Parameter]
public EventCallback<DataAreaSplitted> EC_AddSash { get; set; }
public EventCallback<Splitted> EC_UpdateSplitted { get; set; }
#endregion Public Properties
#region Private Methods
/// <summary>
/// Sollevo evento richiesta copia sash
/// Metodo per copiare sash
/// </summary>
/// <returns></returns>
private async Task RaiseCopySash(Splitted item, int indexCurrSash)
private async Task RaiseCopySash(int indexCurrSash)
{
var Args = new DataAreaSplit
{
splitted = item,
index = indexCurrSash,
};
await EC_CopySash.InvokeAsync(Args);
//Rimuovo contenuto di Splitted e rimuovo area da conteggio gruppi
CurrSplitted.AreaList.RemoveAll(i => i != null);
// Copio sash
Area a = SashList[indexCurrSash].Copy(CurrSplitted);
a.SetParentArea(CurrSplitted);
// Aggiungo copia a Splitted
CurrSplitted.AreaList.Add(a);
await EC_UpdateSplitted.InvokeAsync(CurrSplitted);
}
/// <summary>
/// Sollevo evento richiesta copia sash
/// Metodo per aggiungere prima sash
/// </summary>
/// <returns></returns>
private async Task RaiseAddSash(Splitted item)
private async Task RaiseAddSash()
{
var Args = new DataAreaSplitted
{
splitted = item
};
await EC_AddSash.InvokeAsync(Args);
CurrSplitted.AddFirstSash();
await EC_UpdateSplitted.InvokeAsync(CurrSplitted);
}
#endregion Private Methods
}
/// <summary>
/// Classe per raggruppare oggetti che servono per copiare Sash
/// </summary>
public class DataAreaSplit
{
public Splitted splitted { get; set; }
public int index { get; set; }
}
/// <summary>
/// Classe per raggruppare oggetti che servono per aggiungere Sash
/// </summary>
public class DataAreaSplitted
{
public Splitted splitted { get; set; }
}
}
@@ -0,0 +1,27 @@
<div class="card shadow-sm rounded">
<div class="card-header bg-light bg-opacity-25">
<div class="d-flex justify-content-between align-items-center">
<div class="px-2">
<h5>Arc Element</h5>
</div>
<div class="px-2">
<button class="btn btn-close" @onclick="ReqClose"></button>
</div>
</div>
</div>
<div class="card-body py-2">
<div class="row">
<AreaFrameArcElem CurrFrame="CurrFrame"
EC_UpdatePreview ="UpdatePreview">
</AreaFrameArcElem>
@foreach (var sashGroup in SashList)
{
<hr />
<AreaSashArcElem CurrSashGroup="sashGroup"
EC_UpdatePreview="UpdatePreviewSash">
</AreaSashArcElem>
}
</div>
</div>
</div>
@@ -0,0 +1,60 @@
using Microsoft.AspNetCore.Components;
using WebWindowComplex.DTO;
using WebWindowComplex.Models;
namespace WebWindowComplex.Compo
{
public partial class CardArcElement
{
#region Public Properties
/// <summary>
/// Frame corrente
/// </summary>
[Parameter]
public Frame CurrFrame { get; set; } = null!;
/// <summary>
/// Lista sash group
/// </summary>
[Parameter]
public List<Sash> SashList { get; set; } = null!;
[Parameter]
public EventCallback<DataUpdateFrame> EC_UpdatePreview { get; set; }
[Parameter]
public EventCallback<bool> EC_ReqClose { get; set; }
#endregion Public Properties
private async Task UpdatePreview()
{
var args = new DataUpdateFrame
{
currFrame = CurrFrame
};
await EC_UpdatePreview.InvokeAsync(args);
}
private async Task UpdatePreviewSash(Sash CurrSashGRoup)
{
var currRec = SashList.First(x => x.GroupId == CurrSashGRoup.GroupId);
if (currRec != null)
{
currRec = CurrSashGRoup;
var args = new DataUpdateFrame
{
currFrame = CurrFrame
};
await EC_UpdatePreview.InvokeAsync(args);
}
}
private void ReqClose()
{
_ = EC_ReqClose.InvokeAsync(true);
}
}
}
+9 -12
View File
@@ -1,7 +1,7 @@
<div class="card shadow-sm rounded mb-4">
<div class="card-header bg-light bg-opacity-25">
<div class="d-flex justify-content-between align-middle">
<div class="d-flex justify-content-between align-items-center">
<div class="px-2">
<h5>Fill @(CurrIndex + 1)</h5>
</div>
@@ -11,8 +11,8 @@
</div>
</div>
<div class="card-body py-2">
<div class="d-flex justify-content-between align-center my-2">
<div class="col d-flex justify-content-center">
<div class="d-flex justify-content-between align-items-center my-2">
<div class="col d-flex justify-content-left">
<h6>Select only current fill</h6>
</div>
<div class="col d-flex">
@@ -26,7 +26,7 @@
</div>
</div>
</div>
<div class="d-flex justify-content-between align-items-center">
@* <div class="d-flex justify-content-between align-items-center">
<div class="col d-flex justify-content-center">
<h6 class="text-center">Selected all fill</h6>
</div>
@@ -40,19 +40,16 @@
<button class="btn btn-outline-secondary btn-sm" @onclick="() => ChangeAllFill(WebWindowComplex.Json.WindowConst.FillTypes.WOOD)">All wood</button>
</div>
</div>
</div>
</div> *@
</div>
</div>
@foreach (var currSplitted in SplittedList)
@* @foreach (var currSplitted in SplittedList)
{
@if (currSplitted.AreaList.First().Equals(CurrItem))
@if (currSplitted.AreaList.First().Equals(CurrFill))
{
<AreaSplit CurrSashList="SashList"
CurrSplittedList="SplittedList"
CurrSplitted="currSplitted"
<AreaSplit CurrSplitted="currSplitted"
EC_AddSash="AddSash"
EC_CopySash="CopySash">
</AreaSplit>
}
}
} *@
+7 -73
View File
@@ -18,31 +18,13 @@ namespace WebWindowComplex.Compo
/// Fill corrente rispetto alla lista fill
/// </summary>
[Parameter]
public Fill CurrItem { get; set; } = null!;
public Fill CurrFill { get; set; } = null!;
/// <summary>
/// Evento per cambiare tutti i fill
/// </summary>
[Parameter]
public EventCallback<FillTypes> EC_ChangeAllType { get; set; }
/// <summary>
/// Evento per cambiare solo il fill corrente
/// </summary>
[Parameter]
public EventCallback<FillTypes> EC_ChangeType { get; set; }
/// <summary>
/// Evento per copiare sash
/// </summary>
[Parameter]
public EventCallback<DataAreaSplit> EC_CopySash { get; set; }
/// <summary>
/// Evento per aggiungere sash
/// </summary>
[Parameter]
public EventCallback<DataAreaSplitted> EC_AddSash { get; set; }
public EventCallback<Fill> EC_UpdatePreviewFill { get; set; }
/// <summary>
/// Evento per tornare nella pagine Tree
@@ -50,67 +32,19 @@ namespace WebWindowComplex.Compo
[Parameter]
public EventCallback<bool> EC_ReqClose { get; set; }
/// <summary>
/// Lista dei Fill
/// </summary>
[Parameter]
public List<Fill> FillList { get; set; } = null!;
/// <summary>
/// Lista delle sash
/// </summary>
[Parameter]
public List<Sash> SashList { get; set; } = null!;
/// <summary>
/// Lista degli Splitted
/// </summary>
[Parameter]
public List<Splitted> SplittedList { get; set; } = null!;
#endregion Public Properties
#region Protected Methods
/// <summary>
/// Sollevo evento per cambiare tutti i Fill
/// </summary>
/// <param name="reqFillType"> tipo di fill richiesto </param>
/// <returns></returns>
protected async Task ChangeAllFill(FillTypes reqFillType)
{
await EC_ChangeAllType.InvokeAsync(reqFillType);
}
/// <summary>
/// Sollevo evento per cambiare solo il Fill corrente
/// Metodo per cambiare solo il Fill corrente
/// </summary>
/// <param name="reqFillType"> tipo di fill richiesto </param>
/// <returns></returns>
protected async Task ChangeOneFill(FillTypes reqFillType)
{
await EC_ChangeType.InvokeAsync(reqFillType);
}
/// <summary>
/// Sollevo evento per copiare sash
/// </summary>
/// <param name="Args"></param>
/// <returns></returns>
protected async Task CopySash(DataAreaSplit Args)
{
await EC_CopySash.InvokeAsync(Args);
}
/// <summary>
/// Sollevo evento per aggiungere sash
/// </summary>
/// <param name="Args"></param>
/// <returns></returns>
protected async Task AddSash(DataAreaSplitted Args)
{
await EC_AddSash.InvokeAsync(Args);
CurrFill.SetFillType(reqFillType);
await EC_UpdatePreviewFill.InvokeAsync(CurrFill);
}
#endregion Protected Methods
@@ -118,7 +52,7 @@ namespace WebWindowComplex.Compo
#region Private Methods
/// <summary>
/// Sollevo evento per tornare alla pagina Tree
/// Metodo per tornare alla pagina Tree
/// </summary>
private void ReqClose()
{
@@ -131,7 +65,7 @@ namespace WebWindowComplex.Compo
/// <returns></returns>
private string buttonFillCss(FillTypes reqFillTypes)
{
return (FillList.ElementAt(CurrIndex).SelFillType == reqFillTypes) ? "btn btn-secondary btn-sm" : "btn btn-outline-secondary btn-sm";
return (CurrFill.SelFillType == reqFillTypes) ? "btn btn-secondary btn-sm" : "btn btn-outline-secondary btn-sm";
}
#endregion Private Methods
+16 -21
View File
@@ -17,18 +17,10 @@
<div class="input-group my-2">
<label class="input-group-text">Shape</label>
<select class="form-select" @bind="@SelShapeIndex">
@foreach (var i in FrameWindow.ShapeList)
@foreach (var i in CurrFrameWindow.ShapeList)
{
<option value="@(i.Id)">@(i.Name)</option>
}
@* <option value="0">Rectangle</option>
<option value="1">Right Chamfer</option>
<option value="2">Left Chamfer</option>
<option value="3">Double Chamfer</option>
<option value="4">Arc</option>
<option value="5">Arc Full</option>
<option value="6">Double Arc</option>
<option value="7">Triangle</option> *@
</select>
</div>
</div>
@@ -39,9 +31,9 @@
<div class="d-flex justify-content-start align-items-center">
<h6 class="fw-bold">Dimension</h6>
</div>
@foreach (FrameDimension dimension in FrameWindow.DimensionList)
@foreach (FrameDimension dimension in CurrFrameWindow.DimensionList)
{
<EditDimensions CurrRec="dimension" EC_Update="UpdateDim"></EditDimensions>
<EditFrameDimensions CurrRec="dimension" EC_Update="UpdateDim"></EditFrameDimensions>
}
</div>
<div class="col-md-12 col-lg-6">
@@ -66,22 +58,22 @@
</div>
<div class="col d-flex">
<div class="input-group mb-2 justify-content-center">
<button class="btn btn-outline-secondary btn-sm" @onclick="() => ChangeAllJoints(WebWindowComplex.Json.WindowConst.Joints.ANGLED, FrameWindow)">Angled</button>
<button class="@ButtonJointCss(Json.WindowConst.Joints.ANGLED)" @onclick="() => ChangeAllJoints(WebWindowComplex.Json.WindowConst.Joints.ANGLED, CurrFrameWindow)">Angled</button>
</div>
</div>
<div class="col d-flex">
<div class="input-group mb-2 justify-content-center">
<button class="btn btn-outline-secondary btn-sm" @onclick="() => ChangeAllJoints(WebWindowComplex.Json.WindowConst.Joints.FULL_H, FrameWindow)">Horizontal</button>
<button class="@ButtonJointCss(Json.WindowConst.Joints.FULL_H)" @onclick="() => ChangeAllJoints(WebWindowComplex.Json.WindowConst.Joints.FULL_H, CurrFrameWindow)">Horizontal</button>
</div>
</div>
<div class="col d-flex">
<div class="input-group mb-2 justify-content-center">
<button class="btn btn-outline-secondary btn-sm" @onclick="() => ChangeAllJoints(WebWindowComplex.Json.WindowConst.Joints.FULL_V, FrameWindow)">Vertical</button>
<button class="@ButtonJointCss(Json.WindowConst.Joints.FULL_V)" @onclick="() => ChangeAllJoints(WebWindowComplex.Json.WindowConst.Joints.FULL_V, CurrFrameWindow)">Vertical</button>
</div>
</div>
</div>
<div class="row">
@foreach (Joint joint in FrameWindow.JointList)
@foreach (Joint joint in CurrFrameWindow.JointList)
{
<EditJoint CurrRec="joint" EC_Update="UpdateJoint"></EditJoint>
}
@@ -96,7 +88,7 @@
<div class="row">
<div class="input-group mb-2">
<span class="input-group-text">Quantity</span>
<input type="number" class="form-control" @bind="@FrameWindow.BottomRailQty">
<input type="number" class="form-control" @bind="@FrameBottomRailQty">
</div>
</div>
}
@@ -105,12 +97,15 @@
</div>
</div>
@if (!(FrameWindow.AreaList[0] is Split) || (SashList.Count == 0 && SplitList.Count == 0))
@if (!(CurrFrameWindow.AreaList[0] is Split) || (SashList.Count == 0 && SplitList.Count == 0))
{
<AreaFrame CurrFrameWindow="FrameWindow"
CurrSashList="SashList"
CurrSplitList="SplitList"
EC_AddSash="AddSash"
<AreaFrame EC_AddSash="AddSash"
EC_AddSplit="AddSplit">
</AreaFrame>
@* <Arame CurrFrameWindow="CurrFrameWindow"
CurrSashList="SashList"
CurrSplitList="SplitList"
EC_AddSash="AddSash"
EC_AddSplit="AddSplit">
</AreaFrame> *@
}
+115 -54
View File
@@ -7,24 +7,6 @@ namespace WebWindowComplex.Compo
{
#region Public Properties
/// <summary>
/// Evento per aggiungere sash
/// </summary>
[Parameter]
public EventCallback<bool> EC_AddSash { get; set; }
/// <summary>
/// Evento per aggiungere split
/// </summary>
[Parameter]
public EventCallback<bool> EC_AddSplit { get; set; }
/// <summary>
/// Evento per cambiare tutti i Joints
/// </summary>
[Parameter]
public EventCallback<DataChangeJoints> EC_ChangeAllJoints { get; set; }
/// <summary>
/// Evento per tornare nella pagine Tree
/// </summary>
@@ -35,58 +17,92 @@ namespace WebWindowComplex.Compo
/// Evento per richiedere reset dizionario Shape
/// </summary>
[Parameter]
public EventCallback<bool> EC_ReqResetDictShape { get; set; }
public EventCallback<DataUpdateRes> EC_ReqResetDictShape { get; set; }
/// <summary>
/// Evento per aggiornare info frame (es cambaire tutti i Joints)
/// Evento per richiedere opzioni hardware
/// </summary>
[Parameter]
public EventCallback<Frame> EC_UpdateFrame { get; set; }
public EventCallback<Frame> EC_ReqOptionHw { get; set; }
/// <summary>
/// Evento per richiesta calcolo Shape
/// Evento per richiesta calcolo preview
/// </summary>
[Parameter]
public EventCallback<Frame> EC_UpdateShape { get; set; }
public EventCallback<DataUpdateFrame> EC_UpdatePreview { get; set; }
/// <summary>
/// Frame corrente
/// </summary>
[Parameter]
public Frame FrameWindow { get; set; } = null!;
[CascadingParameter(Name = "CurrFrameWindow")]
public Frame CurrFrameWindow { get; set; } = null!;
/// <summary>
/// Lista di sash
/// </summary>
[Parameter]
[CascadingParameter(Name = "SashList")]
public List<Sash> SashList { get; set; } = null!;
/// <summary>
/// Lista di split
/// </summary>
[Parameter]
[CascadingParameter(Name = "SplitList")]
public List<Split> SplitList { get; set; } = null!;
#endregion Public Properties
#region Protected Properties
/// <summary>
/// Metodo per selezionare shape
/// </summary>
protected int SelShapeIndex
{
get => FrameWindow.SelShapeIndex;
get => CurrFrameWindow.SelShapeIndex;
set
{
if (FrameWindow.SelShapeIndex != value)
if (CurrFrameWindow.SelShapeIndex != value)
{
FrameWindow.SelShapeIndex = value;
CurrFrameWindow.SelShapeIndex = value;
// richiesta reset dict shape
_ = EC_ReqResetDictShape.InvokeAsync(true);
_ = EC_ReqResetDictShape.InvokeAsync(new DataUpdateRes { req = LayoutConst.DataAction.ResetDictShape});
foreach(var s in SashList)
{
s.SelHardwareFromId = "000000";
}
_ = EC_UpdateFrame.InvokeAsync(FrameWindow);
_ = EC_UpdateShape.InvokeAsync(FrameWindow);
var args = new DataUpdateFrame()
{
currFrame = CurrFrameWindow,
svgNoHw = true
};
_ = EC_UpdatePreview.InvokeAsync(args);
//_ = EC_ReqOptionHw.InvokeAsync(CurrFrameWindow);
//_ = EC_UpdateShape.InvokeAsync(CurrFrameWindow);
}
}
}
/// <summary>
/// Selezione quantità bottom rail
/// </summary>
protected int FrameBottomRailQty
{
get => CurrFrameWindow.BottomRailQty;
set
{
if (CurrFrameWindow.BottomRailQty != value)
{
CurrFrameWindow.BottomRailQty = value;
if (CurrFrameWindow.BottomRailQty > 0)
CurrFrameWindow.SetBottomRail(true);
else
CurrFrameWindow.SetBottomRail(false);
var args = new DataUpdateFrame()
{
currFrame = CurrFrameWindow,
svgNoHw = false
};
_ = EC_UpdatePreview.InvokeAsync(args);
}
}
}
@@ -96,36 +112,56 @@ namespace WebWindowComplex.Compo
#region Private Methods
/// <summary>
/// Sollevo evento richiesta aggiunta sash
/// Metodo per aggiungere sash
/// </summary>
/// <returns></returns>
private async Task AddSash()
{
//await EC_UpdateShape.InvokeAsync(FrameWindow);
await EC_AddSash.InvokeAsync(true);
CurrFrameWindow.AddFirstSash();
var args = new DataUpdateFrame()
{
currFrame = CurrFrameWindow,
svgNoHw = true
};
await EC_UpdatePreview.InvokeAsync(args);
}
/// <summary>
/// Sollevo evento richiesta aggiunta window
/// Metodo per aggiungere window
/// </summary>
/// <returns></returns>
private async Task AddSplit()
{
await EC_AddSplit.InvokeAsync(true);
CurrFrameWindow.AddSplit();
var args = new DataUpdateFrame()
{
currFrame = CurrFrameWindow,
svgNoHw = true
};
await EC_ReqResetDictShape.InvokeAsync();
await EC_ReqOptionHw.InvokeAsync(CurrFrameWindow);
await EC_UpdatePreview.InvokeAsync(args);
}
/// <summary>
/// Sollevo evento richiesta copia sash
/// Metodo per cambiare tutti i joint
/// </summary>
/// <returns></returns>
private async Task ChangeAllJoints(Json.WindowConst.Joints JointType, Area a)
{
var Args = new DataChangeJoints
if (a is Frame)
{
currJointType = JointType,
currArea = a,
foreach (Joint joint in CurrFrameWindow.JointList)
{
joint.SetSelJointType(JointType);
}
}
var args = new DataUpdateFrame()
{
currFrame = CurrFrameWindow,
svgNoHw = false
};
await EC_ChangeAllJoints.InvokeAsync(Args);
await EC_UpdatePreview.InvokeAsync(args);
}
/// <summary>
@@ -143,45 +179,70 @@ namespace WebWindowComplex.Compo
private async Task UpdateDim(FrameDimension updRec)
{
// cerco il record
var currRec = FrameWindow.DimensionList.FirstOrDefault(x => x.ParentFrame == updRec.ParentFrame && x.nIndex == updRec.nIndex);
var currRec = CurrFrameWindow.DimensionList.FirstOrDefault(x => x.ParentFrame == updRec.ParentFrame && x.nIndex == updRec.nIndex);
// lo aggiorno
if (updRec != null)
{
currRec = updRec;
await EC_UpdateShape.InvokeAsync(FrameWindow);
await EC_UpdateFrame.InvokeAsync(FrameWindow);
var args = new DataUpdateFrame()
{
currFrame = CurrFrameWindow,
svgNoHw = true
};
await EC_ReqResetDictShape.InvokeAsync();
await EC_UpdatePreview.InvokeAsync(args);
}
}
/// <summary>
/// Report aggiornamento joint
/// Aggiornamento joint
/// </summary>
/// <param name="updRec"></param>
/// <returns></returns>
private async Task UpdateJoint(Joint updRec)
{
// cerco il record
var currRec = FrameWindow.JointList.FirstOrDefault(x => x.ParentArea == updRec.ParentArea && x.nIndex == updRec.nIndex);
var currRec = CurrFrameWindow.JointList.FirstOrDefault(x => x.ParentArea == updRec.ParentArea && x.nIndex == updRec.nIndex);
// lo aggiorno
if (updRec != null)
{
currRec = updRec;
await EC_UpdateFrame.InvokeAsync(FrameWindow);
var args = new DataUpdateFrame()
{
currFrame = CurrFrameWindow,
svgNoHw = false
};
await EC_UpdatePreview.InvokeAsync(args);
}
}
/// <summary>
/// Metodo per la visualizzazione dei pulsanti joint
/// </summary>
/// <param name="type"></param>
/// <returns></returns>
private string ButtonJointCss(WebWindowComplex.Json.WindowConst.Joints type)
{
foreach (var item in CurrFrameWindow.JointList)
{
if (!item.SelJointType.Equals(type))
return "btn btn-outline-secondary btn-sm";
}
return "btn btn-secondary btn-sm";
}
#endregion Private Methods
}
/// <summary>
/// Classe per raggruppare oggetti che servono per copiare Sash
/// Classe per raggruppare oggetti che servono per aggiornare frame
/// </summary>
public class DataChangeJoints
public class DataUpdateFrame
{
#region Public Properties
public Area currArea { get; set; } = null!;
public Json.WindowConst.Joints currJointType { get; set; }
public Frame currFrame { get; set; } = null!;
public bool svgNoHw { get; set; } = false;
#endregion Public Properties
}
+69 -59
View File
@@ -1,14 +1,15 @@
@using static WebWindowComplex.Json.WindowConst
@using WebWindowComplex.Models
@using static WebWindowComplex.Json.WindowConst
<div class="card shadow-sm rounded mb-4">
<div class="card-header bg-light bg-opacity-25">
<div class="d-flex justify-content-between align-items-center">
<div class="px-2">
<h5>Sash group @(SashList.Count > 1 ? (CurrIndex + 1) : "")</h5>
<h5>Sash group @(SashList.Count > 1 ? (SashList.IndexOf(CurrSashGroup) + 1) : "")</h5>
</div>
<div class="px-2">
<div class="input-group mb-2 justify-content-center">
<button class="btn btn-outline-secondary btn-sm" @onclick="() => RemoveArea(CurrItem)">Remove sash group</button>
<button class="btn btn-outline-secondary btn-sm" @onclick="() => RemoveArea()">Remove sash group</button>
</div>
</div>
<div class="px-2">
@@ -21,7 +22,7 @@
<div class="col-md-12 col-lg-6">
<div class="input-group mb-2">
<span class="input-group-text">Qty sash</span>
<input type="number" class="form-control" @bind="@CurrItem.nSashQty">
<input type="number" class="form-control" @bind="@SashQty">
</div>
</div>
</div>
@@ -29,20 +30,18 @@
<div class="col-md-12 col-lg-6">
<div class="input-group mb-2">
<label class="input-group-text">Tipology</label>
<select class="form-select" @bind="@CurrItem.SelOrientationSashTypeIndex">
@foreach (var orientationSash in CurrItem.OrientationSashTypeList)
<select class="form-select" @bind="@OrientationSashTypeIndex">
@foreach (var orientationSash in CurrSashGroup.OrientationSashTypeList)
{
<option value="@(orientationSash.Id)">@(orientationSash.Name)</option>
}
@* <option value="0">Vertical</option>
<option value="1">Horizontal</option> *@
</select>
</div>
</div>
<div class="col-md-12 col-lg-6">
<div class="input-group mb-2">
<span class="input-group-text">Qty bottom rail</span>
<input type="number" class="form-control" @bind="@CurrItem.SashBottomRailQty">
<input type="number" class="form-control" @bind="@SashBottomRailQty">
</div>
</div>
</div>
@@ -56,7 +55,7 @@
</div>
<div class="input-group mb-2">
<label class="input-group-text">Family</label>
<select class="form-select" @bind="@CurrItem.SelFamilyHardware">
<select class="form-select" @bind="@FamilyHardware">
@if (Sash.s_FamilyHardwareList == null || Sash.s_FamilyHardwareList.Count == 0)
{
<option value="000000">CUSTOM</option>
@@ -70,7 +69,7 @@
}
</select>
</div>
@if (string.IsNullOrEmpty(CurrItem.SashShape))
@if (string.IsNullOrEmpty(CurrSashGroup.SashShape))
{
<div class="input-group mb-2">
<label class="input-group-text">Type</label>
@@ -85,64 +84,75 @@
<label class="input-group-text">Type</label>
<select class="form-select" @bind="SelHwType">
<option value="000000">Custom HW</option>
@foreach (var hlItem in CurrItem.HardwareList)
@foreach (var hlItem in CurrSashGroup.HardwareList)
{
<option value="@hlItem.Id">@hlItem.Description</option>
}
</select>
</div>
<AreaHwOption CurrSash="CurrItem"
EC_UpdateHwOptCombo="UpdateOptCombo"
EC_UpdateHwOptText="UpdateOptText"
EC_FirstHwOptionList="FirstHwOptionList">
</AreaHwOption>
}
</div>
<div class="col-md-12 col-lg-6">
<div class="row justify-content-between align-items-center">
<div class="col d-flex justify-content-start align-items-center">
<h6 class="fw-bold">Joints</h6>
</div>
<div class="col d-flex">
<div class="input-group mb-2 justify-content-center">
<button class="btn btn-outline-secondary btn-sm" @onclick="() => ChangeAllJoints(WebWindowComplex.Json.WindowConst.Joints.ANGLED, CurrItem)">Angled</button>
</div>
</div>
<div class="col d-flex">
<div class="input-group mb-2 justify-content-center">
<button class="btn btn-outline-secondary btn-sm" @onclick="() => ChangeAllJoints(WebWindowComplex.Json.WindowConst.Joints.FULL_H, CurrItem)">Horizontal</button>
</div>
</div>
<div class="col d-flex">
<div class="input-group mb-2 justify-content-center">
<button class="btn btn-outline-secondary btn-sm" @onclick="() => ChangeAllJoints(WebWindowComplex.Json.WindowConst.Joints.FULL_V, CurrItem)">Vertical</button>
</div>
</div>
</div>
@foreach (Joint joint in CurrItem.JointList)
{
<EditJoint CurrRec="joint" EC_Update="UpdateJoint"></EditJoint>
}
<AreaHwOption EC_UpdateHwOpt="UpdateOpt"
EC_FirstHwOptionList="FirstHwOptionList">
</AreaHwOption>
</div>
</div>
</div>
</div>
<div class="card shadow-sm rounded mb-4">
<div class="card-body py-2">
<div class="row">
@for (int i = 0; i < CurrItem.SashList.Count; i++)
{
<AreaSash CurrSashDim="CurrItem.SashList[i]"
CurrSashGroup="CurrItem"
IndexSash="i"
EC_ChangeHandle="ChangeHandle"
EC_CopyContentSash="CopyContentSash">
</AreaSash>
}
</div>
</div>
</div>
<div class="card shadow-sm rounded mb-4">
<div class="card-body py-2">
<div class="d-flex justify-content-end">
<div class="dropdown">
<button class="btn btn-outline-secondary dropdown-toggle btn-sm" type="button" @onclick="ToggleDropdown">
Measure
</button>
<ul class="dropdown-menu @(isOpen ? "show" : "")" style="min-width:5rem; max-width:10rem">
<li>
<button class="dropdown-item" @onclick="() => SetMeasureType(MeasureTypes.ABSOLUTE)">
Absolute
</button>
</li>
<li>
<button class="dropdown-item" @onclick="() => SetMeasureType(MeasureTypes.PROPORTIONAL)">
Proportional
</button>
</li>
<li>
<button class="dropdown-item" @onclick="() => SetMeasureType(MeasureTypes.PERCENTAGE)">
Percentage
</button>
</li>
</ul>
</div>
</div>
<div class="row">
@for (int i = 0; i < CurrSashGroup.SashList.Count; i++)
{
@if (editMode && currSashDimEdit.Contains(i))
{
<div class="col-12 my-2">
<AreaSash CurrSashDim="CurrSashGroup.SashList[i]"
IndexSash="i"
EditMode="editMode"
EC_UpdateSash="UpdateSash"
EC_UpdateSashDim="UpdateSashDimension"
EC_EditView="EditView">
</AreaSash>
</div>
}
else if(currSashDimEdit.Count == 0)
{
<AreaSash CurrSashDim="CurrSashGroup.SashList[i]"
IndexSash="i"
EditMode="editMode"
EC_UpdateSash="UpdateSash"
EC_UpdateSashDim="UpdateSashDimension"
EC_EditView="EditView">
</AreaSash>
}
}
</div>
</div>
</div>
+262 -114
View File
@@ -1,6 +1,7 @@
using Microsoft.AspNetCore.Components;
using WebWindowComplex.Models;
using static WebWindowComplex.Json.WindowConst;
using static WebWindowComplex.LayoutConst;
namespace WebWindowComplex.Compo
{
@@ -8,41 +9,17 @@ namespace WebWindowComplex.Compo
{
#region Public Properties
/// <summary>
/// Indice della sash corrente rispetto alla lista sash
/// </summary>
[Parameter]
public int CurrIndex { get; set; } = 0;
/// <summary>
/// Sash corrente rispetto alla lista Sash
/// </summary>
[Parameter]
public Sash CurrItem { get; set; } = null!;
/// <summary>
/// Evento per cambiare tutti i Joints
/// </summary>
[Parameter]
public EventCallback<DataChangeJoints> EC_ChangeAllJoints { get; set; }
/// <summary>
/// Evento per cambiare l'anta su cui è presente la maniglia
/// </summary>
[Parameter]
public EventCallback<DataChangeHandle> EC_ChangeHandle { get; set; }
/// <summary>
/// Evento per cambiare l'anta su cui è presente la maniglia
/// </summary>
[Parameter]
public EventCallback<DataCopyContentSash> EC_CopyContentSash { get; set; }
[CascadingParameter(Name = "CurrSashGroup")]
public Sash CurrSashGroup { get; set; } = null!;
/// <summary>
/// Evento per cambiare tutti i fill
/// </summary>
[Parameter]
public EventCallback<Area> EC_RemoveArea { get; set; }
public EventCallback<DataUpdateFrame> EC_UpdateFrame { get; set; }
/// <summary>
/// Evento per tornare nella pagine Tree
@@ -54,48 +31,155 @@ namespace WebWindowComplex.Compo
/// Evento per richiedere reset dizionario Shape
/// </summary>
[Parameter]
public EventCallback<bool> EC_ReqResetDictShape { get; set; }
public EventCallback<DataUpdateRes> EC_ReqResetDictShape { get; set; }
/// <summary>
/// Evento per cambiare tutti i Joints
/// Evento per richiedere reset dizionario Hw option
/// </summary>
[Parameter]
public EventCallback<Sash> EC_UpdateSash { get; set; }
public EventCallback<DataUpdateRes> EC_ReqResetDictHwOpt { get; set; }
/// <summary>
/// Evento per segnalare cambio hw e richiesta calcolo
/// Evento per richiedere opzioni hardware
/// </summary>
[Parameter]
public EventCallback<Sash> EC_UpdateSashHardware { get; set; }
public EventCallback<Sash> EC_ReqOptionHw { get; set; }
/// <summary>
/// Evento per richiedere la prima volta le opzioni hardware
/// Evento per richiedere per la prima volta opzioni hardware
/// </summary>
[Parameter]
public EventCallback<int> EC_CallFirstHwOpt { get; set; }
public EventCallback<Sash> EC_ReqFirstOptionHw { get; set; }
/// <summary>
/// Evento per segnalare aggiornamento
/// </summary>
[Parameter]
public EventCallback<DataUpdateSash> EC_UpdatePreview { get; set; }
/// <summary>
/// Lista di sash
/// </summary>
[Parameter]
[CascadingParameter(Name = "SashList")]
public List<Sash> SashList { get; set; } = null!;
/// <summary>
/// Frame corrente
/// </summary>
[Parameter]
public Frame FrameWindow { get; set; } = null!;
#endregion Public Properties
#region Protected Properties
/// <summary>
/// Selezione quantità di ante
/// </summary>
protected int SashQty
{
get => CurrSashGroup.nSashQty;
set
{
if (CurrSashGroup.nSashQty != value)
{
CurrSashGroup.nSashQty = value;
var args = new DataUpdateSash()
{
currSash = CurrSashGroup,
svgNoHw = true
};
_ = EC_UpdatePreview.InvokeAsync(args);
//_ = EC_ReqResetDictShape.InvokeAsync(true);
_ = EC_ReqOptionHw.InvokeAsync(CurrSashGroup);
}
}
}
/// <summary>
/// Selezione quantità bottom rail
/// </summary>
protected int SashBottomRailQty
{
get => CurrSashGroup.SashBottomRailQty;
set
{
if (CurrSashGroup.SashBottomRailQty != value)
{
CurrSashGroup.SashBottomRailQty = value;
if (CurrSashGroup.SashBottomRailQty > 0)
CurrSashGroup.SetSashBottomRail(true);
else
CurrSashGroup.SetSashBottomRail(false);
var args = new DataUpdateSash()
{
currSash = CurrSashGroup
};
_ = EC_UpdatePreview.InvokeAsync(args);
}
}
}
/// <summary>
/// Selezione tipo di orientamento della sash
/// </summary>
protected int OrientationSashTypeIndex
{
get => CurrSashGroup.SelOrientationSashTypeIndex;
set
{
if (CurrSashGroup.SelOrientationSashTypeIndex != value)
{
CurrSashGroup.SelOrientationSashTypeIndex = value;
var args = new DataUpdateSash()
{
currSash = CurrSashGroup
};
_ = EC_UpdatePreview.InvokeAsync(args);
}
}
}
/// <summary>
/// Selezione famiglia hardware
/// </summary>
protected string FamilyHardware
{
get => CurrSashGroup.SelFamilyHardware;
set
{
if (CurrSashGroup.SelFamilyHardware != value)
{
CurrSashGroup.SelFamilyHardware = value;
var args = new DataUpdateSash()
{
currSash = CurrSashGroup,
svgNoHw = true
};
_ = EC_UpdatePreview.InvokeAsync(args);
_ = EC_ReqResetDictHwOpt.InvokeAsync(new DataUpdateRes { req = DataAction.ResetHwOpt});
_ = EC_ReqOptionHw.InvokeAsync(CurrSashGroup);
}
}
}
/// <summary>
/// Selezione hardware
/// </summary>
protected string SelHwType
{
get => CurrItem.SelHardwareFromId;
get => CurrSashGroup.SelHardwareFromId;
set
{
if (CurrItem.SelHardwareFromId != value)
if (CurrSashGroup.SelHardwareFromId != value)
{
CurrItem.SelHardwareFromId = value;
_ = EC_UpdateSashHardware.InvokeAsync(CurrItem);
CurrSashGroup.SelHardwareFromId = value;
var args = new DataUpdateSash
{
currSash = CurrSashGroup
};
_ = EC_UpdatePreview.InvokeAsync(args);
_ = EC_ReqOptionHw.InvokeAsync(CurrSashGroup);
}
}
}
@@ -105,51 +189,92 @@ namespace WebWindowComplex.Compo
#region Protected Methods
/// <summary>
/// Sollevo evento per rimuovere area
/// Metodo per rimuovere area
/// </summary>
/// <param name="currArea"> area da rimuovere </param>
/// <returns></returns>
protected async Task RemoveArea(Area currArea)
protected async Task RemoveArea()
{
CurrSashGroup.Remove();
var args = new DataUpdateFrame()
{
currFrame = FrameWindow
};
// richiesta reset dict shape
await EC_ReqResetDictShape.InvokeAsync(true);
await EC_RemoveArea.InvokeAsync(currArea);
await EC_ReqResetDictShape.InvokeAsync(new DataUpdateRes { req=DataAction.ResetDictShape});
await EC_UpdateFrame.InvokeAsync(args);
await EC_ReqClose.InvokeAsync(true);
}
/// <summary>
/// Metodo per scegliere tipo di misura
/// </summary>
/// <param name="type"></param>
/// <returns></returns>
protected async Task SetMeasureType(MeasureTypes type)
{
isOpen = !isOpen;
foreach (var item in CurrSashGroup.SashList)
{
item.SetSelMeasureType(type);
}
var args = new DataUpdateSash
{
currSash = CurrSashGroup
};
await EC_UpdatePreview.InvokeAsync(args);
}
/// <summary>
/// Metodo per aggiornare la sash dimension
/// </summary>
/// <param name="updateSD"></param>
/// <returns></returns>
protected async Task UpdateSashDimension(SashDimension updateSD)
{
var currRec = CurrSashGroup.SashList.First(x => x.nSashId == updateSD.nSashId);
if(currRec != null)
{
currRec = updateSD;
var args = new DataUpdateSash
{
currSash = CurrSashGroup
};
await EC_UpdatePreview.InvokeAsync(args);
}
}
/// <summary>
/// Metodo per aggiornare sash
/// </summary>
/// <param name="updateS"></param>
/// <returns></returns>
protected async Task UpdateSash(Sash updateS)
{
if (updateS != null)
{
CurrSashGroup = updateS;
var args = new DataUpdateSash
{
currSash = CurrSashGroup
};
await EC_UpdatePreview.InvokeAsync(args);
}
}
#endregion Protected Methods
#region Private Methods
/// <summary>
/// Sollevo evento richiesta per cambiare tutti i Joint
/// </summary>
/// <returns></returns>
private async Task ChangeAllJoints(Json.WindowConst.Joints JointType, Area a)
private bool editMode = false;
private List<int> currSashDimEdit = new List<int>();
private void EditView(DataChangeMode args)
{
var Args = new DataChangeJoints
{
currJointType = JointType,
currArea = a,
};
await EC_ChangeAllJoints.InvokeAsync(Args);
}
/// <summary>
/// Sollevo evento per cambiare l'anta su cui è presente la maniglia
/// </summary>
/// <returns></returns>
private async Task ChangeHandle(DataChangeHandle Args)
{
await EC_ChangeHandle.InvokeAsync(Args);
}
/// <summary>
/// Sollevo evento per cambiare l'anta su cui è presente la maniglia
/// </summary>
/// <returns></returns>
private async Task CopyContentSash(DataCopyContentSash Args)
{
await EC_CopyContentSash.InvokeAsync(Args);
editMode = args.Edit;
if(args.IndexSashEdit != -1)
currSashDimEdit.Add(args.IndexSashEdit);
if (args.IndexSashClose != -1)
currSashDimEdit.Remove(args.IndexSashClose);
}
/// <summary>
@@ -161,53 +286,45 @@ namespace WebWindowComplex.Compo
}
/// <summary>
/// Report aggiornamento joint
/// Aggiornamento opzioni hardware
/// </summary>
/// <param name="updRec"></param>
/// <returns></returns>
private async Task UpdateJoint(Joint updRec)
private async Task UpdateOpt(DataUpdateHwOption argsHw)
{
// cerco il record
var currRec = CurrItem.JointList.FirstOrDefault(x => x.ParentArea == updRec.ParentArea && x.nIndex == updRec.nIndex);
// lo aggiorno
if (updRec != null)
AGBOptionCombo AGBOptCombo = argsHw.AGBOptCombo;
AGBOptionText AGBOptText = argsHw.AGBOptText;
if (AGBOptCombo != null)
{
currRec = updRec;
await EC_UpdateSash.InvokeAsync(CurrItem);
// cerco il record
var currRec = CurrSashGroup.HwOptionList.FirstOrDefault(x => x.sName == AGBOptCombo.sName && x.sDescription == AGBOptCombo.sDescription);
// lo aggiorno
if (AGBOptCombo != null)
{
currRec = AGBOptCombo;
var args = new DataUpdateSash
{
currSash = CurrSashGroup
};
await EC_UpdatePreview.InvokeAsync(args);
await EC_ReqOptionHw.InvokeAsync(CurrSashGroup);
}
}
}
/// <summary>
/// Report aggiornamento Option Combo
/// </summary>
/// <param name="updRec"></param>
/// <returns></returns>
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)
else
{
currRec = updRec;
await EC_UpdateSashHardware.InvokeAsync(CurrItem);
}
}
/// <summary>
/// Report aggiornamento Option Text
/// </summary>
/// <param name="updRec"></param>
/// <returns></returns>
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);
// cerco il record
var currRec = CurrSashGroup.HwOptionList.FirstOrDefault(x => x.sName == AGBOptText.sName && x.sDescription == AGBOptText.sDescription);
// lo aggiorno
if (AGBOptText != null)
{
currRec = AGBOptText;
var args = new DataUpdateSash
{
currSash = CurrSashGroup
};
await EC_UpdatePreview.InvokeAsync(args);
await EC_ReqOptionHw.InvokeAsync(CurrSashGroup);
}
}
}
@@ -216,11 +333,42 @@ namespace WebWindowComplex.Compo
/// </summary>
/// <param name="updRec"></param>
/// <returns></returns>
private async Task FirstHwOptionList(int groupId)
private async Task FirstHwOptionList()
{
await EC_CallFirstHwOpt.InvokeAsync(groupId);
var args = new DataUpdateSash
{
currSash = CurrSashGroup
};
//await EC_UpdatePreview.InvokeAsync(args);
await EC_ReqFirstOptionHw.InvokeAsync(CurrSashGroup);
}
private string ButtonMeasureCss(MeasureTypes type)
{
foreach(var item in CurrSashGroup.SashList)
{
if (!item.SelMeasureType.Equals(type))
return "btn btn-outline-secondary btn-sm";
}
return "btn btn-secondary btn-sm";
}
private bool isOpen = false;
private void ToggleDropdown()
{
isOpen = !isOpen;
}
#endregion Private Methods
}
public class DataUpdateSash
{
public Sash currSash { get; set; } = null!;
public bool svgNoHw { get; set; } = false;
}
public class DataUpdateRes
{
public DataAction req { get; set; } = DataAction.None;
}
}
+177 -48
View File
@@ -1,9 +1,10 @@

@using static WebWindowComplex.Json.WindowConst
<div class="card shadow-sm rounded mb-4">
<div class="card-header bg-light bg-opacity-25">
<div class="d-flex justify-content-between align-items-center">
<div class="px-2">
<h5>@(descParentSplit(CurrItem))</h5>
<h5>@(descParentSplit())</h5>
</div>
<div class="px-2">
<button class="btn btn-close" @onclick="ReqClose"></button>
@@ -11,119 +12,247 @@
</div>
</div>
<div class="card-body py-2">
<div class="row">
<div class="col-sm-4">
<h5>Split</h5>
</div>
<div class="col-sm-4">
@if ((CurrItem.nSplitQtyVert == 1 && CurrItem.nSplitQtyHoriz == 0) || (CurrItem.nSplitQtyVert == 0 && CurrItem.nSplitQtyHoriz == 1))
{
<div class="input-group mb-2 justify-content-center">
<button class="btn btn-outline-secondary btn-sm" @onclick="() => SwapTwoAree(CurrItem)">Swap Aree</button>
</div>
}
</div>
<div class="col-sm-4">
<div class="d-flex justify-content-between align-items-center">
<h5>Split</h5>
@if ((CurrSplit.nSplitQtyVert == 1 && CurrSplit.nSplitQtyHoriz == 0) || (CurrSplit.nSplitQtyVert == 0 && CurrSplit.nSplitQtyHoriz == 1))
{
<div class="input-group mb-2 justify-content-center">
<button class="btn btn-outline-secondary btn-sm" @onclick="() => RemoveArea(CurrItem)">Remove split</button>
<button class="btn btn-outline-secondary btn-sm" @onclick="() => SwapTwoAree()">Swap Aree</button>
</div>
}
<div class="input-group mb-2 justify-content-center">
<button class="btn btn-outline-secondary btn-sm" @onclick="() => RemoveArea()">Remove split</button>
</div>
<div class="dropdown">
<button class="btn btn-outline-secondary dropdown-toggle btn-sm" type="button" @onclick="ToggleDropdown">
Measure
</button>
<ul class="dropdown-menu @(isOpen ? "show" : "")" style="min-width:5rem; max-width:10rem">
<li>
<button class="dropdown-item" @onclick="() => SetMeasureType(MeasureTypes.ABSOLUTE)">
Absolute
</button>
</li>
<li>
<button class="dropdown-item" @onclick="() => SetMeasureType(MeasureTypes.PROPORTIONAL)">
Proportional
</button>
</li>
<li>
<button class="dropdown-item" @onclick="() => SetMeasureType(MeasureTypes.PERCENTAGE)">
Percentage
</button>
</li>
</ul>
</div>
</div>
<div class="row">
<div class="col-md-12 col-lg-6">
<div class="input-group mb-2">
<label class="input-group-text">Shape</label>
<select class="form-select" @bind="@CurrItem.SelSplitShapeIndex">
@foreach (var shapeType in CurrItem.SplitShapeList)
<select class="form-select" @bind="@SplitShapeIndex">
@foreach (var shapeType in CurrSplit.SplitShapeList)
{
<option value=@(shapeType.Id)>@(shapeType.Name)</option>
}
@* <option value="0">Vertical</option>
<option value="1">Horizontal</option>
<option value="2">Grid</option>
<option value="3">Custom</option> *@
</select>
</div>
</div>
</div>
<div class="row">
@if (CurrItem.nSplitQtyVert > 0)
@if (CurrSplit.nSplitQtyVert > 0)
{
<div class="col-md-12 col-lg-6">
<div class="input-group mb-2">
<span class="input-group-text">QtyVert</span>
<input type="number" class="form-control" @bind="@CurrItem.nSplitQtyVert">
<input type="number" class="form-control" @bind="@SplitQtyVert">
</div>
</div>
}
@if (CurrItem.nSplitQtyHoriz > 0)
@if (CurrSplit.nSplitQtyHoriz > 0)
{
<div class="col-md-12 col-lg-6">
<div class="input-group mb-2">
<span class="input-group-text">QtyHoriz</span>
<input type="number" class="form-control" @bind="@CurrItem.nSplitQtyHoriz">
<input type="number" class="form-control" @bind="@SplitQtyHoriz">
</div>
</div>
}
</div>
<div class="row">
@if (CurrItem.SplitVertList.Count > 0 && CurrItem.SplitHorizList.Count > 0)
@if (CurrSplit.SplitVertList.Count > 0 && CurrSplit.SplitHorizList.Count > 0)
{
<div class="col-md-12 col-lg-6">
@foreach (var dim in CurrItem.SplitVertList)
@for (int i = 0; i < CurrSplit.SplitVertList.Count; i++)
{
<div class="input-group mb-2">
<EditSplitDimensions CurrRec="CurrSplit.SplitVertList[i]"
Name="Width"
Index="i"
EC_Update="UpdateDimension">
</EditSplitDimensions>
@* <div class="input-group mb-2">
<span class="input-group-text">Width</span>
<input type="number" class="form-control" @bind="@dim.dDimension">
<span class="input-group-text">%</span>
</div>
<select class="form-select" style="max-width:6rem; background-color:#e9ecef" @bind="@dim.SelMeasureTypeIndex">
@foreach (var mType in dim.MeasureTypeList)
{
<option value=@(mType.Id)>
@switch (mType.Name)
{
case "Absolute":
{
<span class="input-group-text">mm</span>
break;
}
case "Proportional":
{
<span class="input-group-text">*</span>
break;
}
case "Percentage":
{
<span class="input-group-text">%</span>
break;
}
}
</option>
}
</select>
</div>*@
}
</div>
<div class="col-md-12 col-lg-6">
@foreach (var dim in CurrItem.SplitHorizList)
@for (int i = 0; i < CurrSplit.SplitHorizList.Count; i++)
{
<div class="input-group mb-2">
<EditSplitDimensions CurrRec="CurrSplit.SplitHorizList[i]"
Name="Height"
Index="i"
EC_Update="UpdateDimension">
</EditSplitDimensions>
@* <div class="input-group mb-2">
<span class="input-group-text">Height</span>
<input type="number" class="form-control" @bind="@dim.dDimension">
<span class="input-group-text">%</span>
</div>
<select class="form-select" style="max-width:6rem; background-color:#e9ecef" @bind="@dim.SelMeasureTypeIndex">
@foreach (var mType in dim.MeasureTypeList)
{
<option value=@(mType.Id)>
@switch (mType.Name)
{
case "Absolute":
{
<span class="input-group-text">mm</span>
break;
}
case "Proportional":
{
<span class="input-group-text">*</span>
break;
}
case "Percentage":
{
<span class="input-group-text">%</span>
break;
}
}
</option>
}
</select>
</div> *@
}
</div>
</div>
}
else if (CurrItem.SplitHorizList.Count > 0)
else if (CurrSplit.SplitHorizList.Count > 0)
{
@foreach (var dim in CurrItem.SplitHorizList)
@for (int i = 0; i < CurrSplit.SplitHorizList.Count; i++)
{
<div class="col-md-12 col-lg-6">
<EditSplitDimensions CurrRec="CurrSplit.SplitHorizList[i]"
Name="Height"
Index="i"
EC_Update="UpdateDimension">
</EditSplitDimensions>
@* <div class="col-md-12 col-lg-6">
<div class="input-group mb-2">
<span class="input-group-text">Height</span>
<input type="number" class="form-control" @bind="@dim.dDimension">
<span class="input-group-text">%</span>
<select class="form-select" style="max-width:6rem; background-color:#e9ecef" @bind="@dim.SelMeasureTypeIndex">
@foreach (var mType in dim.MeasureTypeList)
{
<option value=@(mType.Id)>
@switch (mType.Name)
{
case "Absolute":
{
<span class="input-group-text">mm</span>
break;
}
case "Proportional":
{
<span class="input-group-text">*</span>
break;
}
case "Percentage":
{
<span class="input-group-text">%</span>
break;
}
}
</option>
}
</select>
</div>
</div>
</div> *@
}
}
else if (CurrItem.SplitVertList.Count > 0)
else if (CurrSplit.SplitVertList.Count > 0)
{
@foreach (var dim in CurrItem.SplitVertList)
@for (int i = 0; i < CurrSplit.SplitVertList.Count; i++)
{
<div class="col-md-12 col-lg-6">
<EditSplitDimensions CurrRec="CurrSplit.SplitVertList[i]"
Name="Width"
Index="i"
EC_Update="UpdateDimension">
</EditSplitDimensions>
@* <div class="col-md-12 col-lg-6">
<div class="input-group mb-2">
<span class="input-group-text">Width</span>
<input type="number" class="form-control" @bind="@dim.dDimension">
<span class="input-group-text">%</span>
<select class="form-select" style="max-width:6rem; background-color:#e9ecef" @bind="@dim.SelMeasureTypeIndex">
@foreach (var mType in dim.MeasureTypeList)
{
<option value=@(mType.Id)>
@switch (mType.Name)
{
case "Absolute":
{
<span class="input-group-text">mm</span>
break;
}
case "Proportional":
{
<span class="input-group-text">*</span>
break;
}
case "Percentage":
{
<span class="input-group-text">%</span>
break;
}
}
</option>
}
</select>
</div>
</div>
</div> *@
}
}
</div>
@if (CurrItem.SelSplitShape == Json.WindowConst.SplitShapes.GRID)
@if (CurrSplit.SelSplitShape == Json.WindowConst.SplitShapes.GRID)
{
<div class="row">
<div class="col-md-12 col-lg-6">
<div class="d-flex justify-content-start fs-5 mb-2">
<div class="px-1">
<input class="form-check-input ml-auto" type="checkbox" name="SplitStartVert" checked="@CurrItem.bSplitStartVert" @oninput="(ChangeEventArgs e) => ChangeStartVert(e, CurrItem)">
<input class="form-check-input ml-auto" type="checkbox" name="SplitStartVert" checked="@CurrSplit.bSplitStartVert" @oninput="(ChangeEventArgs e) => ChangeStartVert(e)">
</div>
<div class="px-2">
<label class="form-check-label fs-6 text-dark">StartVert</label>
+218 -63
View File
@@ -1,21 +1,19 @@
using Microsoft.AspNetCore.Components;
using Newtonsoft.Json.Linq;
using WebWindowComplex.Models;
using static WebWindowComplex.Json.WindowConst;
using static WebWindowComplex.LayoutConst;
namespace WebWindowComplex.Compo
{
public partial class CardSplit
{
/// <summary>
/// Indice del fill corrente rispetto alla lista fill
/// Split corrente rispetto alla lista split
/// </summary>
[Parameter]
public int CurrIndex { get; set; } = 0;
/// <summary>
/// Fill corrente rispetto alla lista fill
/// </summary>
[Parameter]
public Split CurrItem { get; set; } = null!;
public Split CurrSplit { get; set; } = null!;
/// <summary>
/// Lista di sash
@@ -30,28 +28,34 @@ namespace WebWindowComplex.Compo
public List<Split> SplitList { get; set; } = null!;
/// <summary>
/// Evento per scambiare le aree di uno split
/// Frame
/// </summary>
[Parameter]
public EventCallback<Area> EC_SwapTwoAree { get; set; }
/// <summary>
/// Evento per rimuovere split
/// </summary>
[Parameter]
public EventCallback<Area> EC_RemoveArea { get; set; }
/// <summary>
/// Evento per cambiare nel caso di split a griglia se inizia con lo split verticale
/// </summary>
[Parameter]
public EventCallback<DataChangeStartVert> EC_ChangeStartVert { get; set; }
public Frame FrameWindow { get; set; } = null!;
/// <summary>
/// Evento per richiedere reset dizionario Shape
/// </summary>
[Parameter]
public EventCallback<bool> EC_ReqResetDictShape { get; set; }
public EventCallback<DataUpdateRes> EC_ReqResetDictShape { get; set; }
/// <summary>
/// Evento per richiedere reset dizionario opzioni hardware
/// </summary>
[Parameter]
public EventCallback<DataUpdateRes> EC_ReqResetDictHwOpt { get; set; }
/// <summary>
/// Evento per aggiornare Split
/// </summary>
[Parameter]
public EventCallback<DataUpdateSplit> EC_UpdatePreview { get; set; }
/// <summary>
/// Evento per aggiornare Frame
/// </summary>
[Parameter]
public EventCallback<DataUpdateFrame> EC_UpdateFrame { get; set; }
/// <summary>
/// Evento per tornare nella pagine Tree
@@ -60,64 +64,183 @@ namespace WebWindowComplex.Compo
public EventCallback<bool> EC_ReqClose { get; set; }
/// <summary>
/// Sollevo evento per scambiare le aree di uno split
/// Metodo per scambiare le aree di uno split (solo se si hanno due aree)
/// </summary>
/// <param name="item"> split corrente </param>
/// <returns></returns>
protected async Task SwapTwoAree(Split item)
protected async Task SwapTwoAree()
{
// richiesta reset dict shape
_ = EC_ReqResetDictShape.InvokeAsync(true);
await EC_SwapTwoAree.InvokeAsync(item);
}
/// <summary>
/// Sollevo evento per rimuovere split
/// </summary>
/// <param name="item"> split corrente </param>
/// <returns></returns>
protected async Task RemoveArea(Split item)
{
// richiesta reset dict shape
await EC_ReqResetDictShape.InvokeAsync(true);
await EC_RemoveArea.InvokeAsync(item);
}
/// <summary>
/// Sollevo evento per rimuovere split
/// </summary>
/// <param name="item"> split corrente </param>
/// <returns></returns>
protected async Task ChangeStartVert(ChangeEventArgs e, Split item)
{
var Args = new DataChangeStartVert
{
eventArg = e,
currItem = item,
CurrSplit.SwapAree();
var args = new DataUpdateSplit(){
currSplit = CurrSplit,
svgNoHw = true
};
await EC_ChangeStartVert.InvokeAsync(Args);
await EC_ReqResetDictShape.InvokeAsync(new DataUpdateRes { req = DataAction.ResetDictShape });
await EC_UpdatePreview.InvokeAsync(args);
}
/// <summary>
/// Metodo per rimuovere split
/// </summary>
/// <param name="item"> split corrente </param>
/// <returns></returns>
protected async Task RemoveArea()
{
CurrSplit.Remove();
var args = new DataUpdateFrame()
{
currFrame = FrameWindow
};
// richiesta reset dict shape
await EC_ReqResetDictShape.InvokeAsync(new DataUpdateRes { req = DataAction.ResetDictShape });
await EC_UpdateFrame.InvokeAsync(args);
await EC_ReqClose.InvokeAsync(true);
}
/// <summary>
/// Proprietà per selezionare shape split
/// </summary>
/// <returns></returns>
protected int SplitShapeIndex
{
get => CurrSplit.SelSplitShapeIndex;
set
{
if (CurrSplit.SelSplitShapeIndex != value)
{
CurrSplit.SelSplitShapeIndex = value;
var args = new DataUpdateSplit()
{
currSplit = CurrSplit
};
if (SearchSash(CurrSplit))
{
_ = EC_ReqResetDictShape.InvokeAsync(new DataUpdateRes { req = DataAction.ResetDictShape });
_ = EC_ReqResetDictHwOpt.InvokeAsync(new DataUpdateRes { req = DataAction.ResetHwOpt });
}
_ = EC_UpdatePreview.InvokeAsync(args);
}
}
}
private bool SearchSash(Area area)
{
if (area is Sash)
return true;
foreach (var item in area.AreaList)
return SearchSash(item);
return false;
}
/// <summary>
/// Proprietà per selezionare numero di split verticali
/// </summary>
/// <returns></returns>
protected int SplitQtyVert
{
get => CurrSplit.nSplitQtyVert;
set
{
if (CurrSplit.nSplitQtyVert != value)
{
CurrSplit.nSplitQtyVert = value;
var args = new DataUpdateSplit()
{
currSplit = CurrSplit
};
_ = EC_UpdatePreview.InvokeAsync(args);
}
}
}
/// <summary>
/// Proprietà per selezionare numero di split verticali
/// </summary>
/// <returns></returns>
protected int SplitQtyHoriz
{
get => CurrSplit.nSplitQtyHoriz;
set
{
if (CurrSplit.nSplitQtyHoriz != value)
{
CurrSplit.nSplitQtyHoriz = value;
var args = new DataUpdateSplit()
{
currSplit = CurrSplit
};
_ = EC_UpdatePreview.InvokeAsync(args);
}
}
}
/// <summary>
/// Metodo per aggiornare la dimensione dello split
/// </summary>
/// <param name="updRec"></param>
/// <returns></returns>
protected async Task UpdateDimension(DataUpdateSplitDimension updRec)
{
SplitDimension currSplitDim = updRec.currSplit;
SplitDimension currRec = null;
// cerco il record
if (currSplitDim.bIsVertListDim)
currRec = CurrSplit.SplitVertList.ElementAt(updRec.index);
else
currRec = CurrSplit.SplitHorizList.ElementAt(updRec.index);
// lo aggiorno
if (currSplitDim != null)
{
currRec = currSplitDim;
var args = new DataUpdateSplit()
{
currSplit = CurrSplit
};
await EC_ReqResetDictShape.InvokeAsync(new DataUpdateRes { req = DataAction.ResetDictShape });
await EC_UpdatePreview.InvokeAsync(args);
}
}
/// <summary>
/// Metodo per rimuovere split
/// </summary>
/// <param name="e"></param>
/// <returns></returns>
protected async Task ChangeStartVert(ChangeEventArgs e)
{
foreach (Split s in SplitList)
{
if (s.Equals(CurrSplit))
{
s.SetSplitStartVert((bool)e.Value);
}
}
var args = new DataUpdateSplit()
{
currSplit = CurrSplit
};
await EC_UpdatePreview.InvokeAsync(args);
}
/// <summary>
/// Metodo per determinare la descrizione del parent dello split corrente
/// </summary>
/// <param name="currSplit"> split corrente </param>
/// <returns></returns>
protected string descParentSplit(Split currSplit)
protected string descParentSplit()
{
if ((currSplit.ParentArea is Splitted || currSplit.ParentArea is Sash) && SashList.Count > 0)
if ((CurrSplit.ParentArea is Splitted || CurrSplit.ParentArea is Sash) && SashList.Count > 0)
{
for (int j = 0; j < SashList.Count; j++)
{
if (SashList[j].Equals(currSplit.ParentArea))
if (SashList[j].Equals(CurrSplit.ParentArea))
{
return "Sash " + (j + 1);
}
else if (SashList[j].Equals(currSplit.ParentArea.ParentArea))
else if (SashList[j].Equals(CurrSplit.ParentArea.ParentArea))
{
for (int k = 0; k < SashList[j].AreaList.Count; k++)
{
if (SashList[j].AreaList[k].AreaList[0].Equals(currSplit))
if (SashList[j].AreaList[k].AreaList[0].Equals(CurrSplit))
{
return "Sash group " + (j + 1) + " - sash " + (k + 1);
}
@@ -139,11 +262,43 @@ namespace WebWindowComplex.Compo
{
_ = EC_ReqClose.InvokeAsync(true);
}
private bool isOpen = false;
private void ToggleDropdown()
{
isOpen = !isOpen;
}
/// <summary>
/// Metodo per cambiare il tipo di misura di tutti gli SplitDimension
/// </summary>
/// <param name="type"> nuovo tipo </param>
/// <returns></returns>
protected async Task SetMeasureType(MeasureTypes type)
{
isOpen = !isOpen;
foreach (var item in CurrSplit.SplitVertList)
{
item.SetSelMeasureType(type);
}
foreach (var item in CurrSplit.SplitHorizList)
{
item.SetSelMeasureType(type);
}
var args = new DataUpdateSplit()
{
currSplit = CurrSplit
};
await EC_UpdatePreview.InvokeAsync(args);
}
}
public class DataChangeStartVert
/// <summary>
/// Classe per raggruppare oggetti che servono per aggiornare split
/// </summary>
public class DataUpdateSplit
{
public ChangeEventArgs eventArg { get; set; } = null!;
public Split currItem { get; set; }
public Split currSplit { get; set; } = null!;
public bool svgNoHw { get; set; } = false;
}
}
+5
View File
@@ -37,6 +37,11 @@
}
<td>
<button class="btn btn-sm btn-secondary" style="font-size: 1rem;" @onclick="() => RaiseNextStep(cs, ind)" title="@(s)">@ItemTableList[i].Desc</button>
@* @if (ItemTableList[i].Type is Json.WindowConst.AreaTypes.SASH ||
ItemTableList[i].Type is Json.WindowConst.AreaTypes.SPLIT)
{
<button class="btn btn-sm btn-secondary" style="font-size: 1rem;" @onclick="() => Remove(cs, ind)" title="Remove">Canc</button>
} *@
</td>
}
else
+11 -1
View File
@@ -29,7 +29,7 @@ namespace WebWindowComplex.Compo
public EventCallback<DataNextStep> EC_NextStep { get; set; }
/// <summary>
/// Sollevo evento richiesta prossimo step
/// Metodo per richiesta prossimo step
/// </summary>
/// <returns></returns>
private async Task RaiseNextStep(CompileStep cs, int indexStep)
@@ -42,6 +42,16 @@ namespace WebWindowComplex.Compo
await EC_NextStep.InvokeAsync(Args);
}
//private async Task Remove(CompileStep cs, int indexStep)
//{
// var Args = new DataNextStep
// {
// currCompileStep = cs,
// index = indexStep,
// };
// await EC_NextStep.InvokeAsync(Args);
//}
/// <summary>
/// Metodo per riempire tabella con contenuto vuoto o con i simboli per rappresentare la struttura
/// </summary>
@@ -3,10 +3,13 @@ using WebWindowComplex.Models;
namespace WebWindowComplex.Compo
{
public partial class EditDimensions
public partial class EditFrameDimensions
{
#region Public Properties
/// <summary>
/// Frame dimension corrente
/// </summary>
[Parameter]
public FrameDimension CurrRec { get; set; } = null!;
@@ -17,6 +20,9 @@ namespace WebWindowComplex.Compo
#region Private Properties
/// <summary>
/// Metodo per aggiornare valore dimension
/// </summary>
private double CurrVal
{
get => CurrRec.dValue;
+1 -4
View File
@@ -1,13 +1,10 @@
@using static WebWindowComplex.LayoutConst
<div class="input-group mb-2">
<label class="input-group-text">@((PositionJoints)(CurrRec.nIndex - 1))</label>
<select class="form-select" @bind="@CurrVal">
<select class="form-select" @bind="@CurrJoint">
@foreach (var typeJoint in CurrRec.JointTypeList)
{
<option value="@(typeJoint.Id)">@(typeJoint.Name)</option>
}
@* <option value="0">Angled</option>
<option value="1">Full H</option>
<option value="2">Full V</option> *@
</select>
</div>
+8 -1
View File
@@ -7,9 +7,13 @@ namespace WebWindowComplex.Compo
{
#region Public Properties
/// <summary>
/// Joint corrente
/// </summary>
[Parameter]
public Joint CurrRec { get; set; } = null!;
[Parameter]
public EventCallback<Joint> EC_Update { get; set; }
@@ -17,7 +21,10 @@ namespace WebWindowComplex.Compo
#region Private Properties
private int CurrVal
/// <summary>
/// Metodo per aggiornare joint corrente
/// </summary>
private int CurrJoint
{
get => CurrRec.SelJointTypeIndex;
set
@@ -7,6 +7,9 @@ namespace WebWindowComplex.Compo
{
#region Public Properties
/// <summary>
/// Opzione hardware combo corrente
/// </summary>
[Parameter]
public AGBOptionCombo CurrOpt { get; set; } = null!;
@@ -17,6 +20,9 @@ namespace WebWindowComplex.Compo
#region Private Properties
/// <summary>
/// Metodo per aggiornare opzione hardware corrente
/// </summary>
private string CurrValue
{
get => CurrOpt.sValue.sValue;
@@ -7,6 +7,9 @@ namespace WebWindowComplex.Compo
{
#region Public Properties
/// <summary>
/// Opzione hardware text corrente
/// </summary>
[Parameter]
public AGBOptionText CurrOpt { get; set; } = null!;
@@ -17,6 +20,9 @@ namespace WebWindowComplex.Compo
#region Private Properties
/// <summary>
/// Metodo per aggiornare opzione hardware text corrente
/// </summary>
private string CurrValue
{
get => CurrOpt.sValue;
@@ -0,0 +1,32 @@

<div class="@SplitDimCss()">
<div class="input-group mb-2">
<span class="input-group-text">@Name</span>
<input type="number" class="form-control" @bind="@CurrVal">
<select class="form-select" style="max-width:6rem; background-color:#e9ecef" @bind="@CurrType">
@foreach (var mType in CurrRec.MeasureTypeList)
{
<option value=@(mType.Id)>
@switch (mType.Name)
{
case "Absolute":
{
<span class="input-group-text">mm</span>
break;
}
case "Proportional":
{
<span class="input-group-text">*</span>
break;
}
case "Percentage":
{
<span class="input-group-text">%</span>
break;
}
}
</option>
}
</select>
</div>
</div>
@@ -0,0 +1,96 @@
using Microsoft.AspNetCore.Components;
using WebWindowComplex.Models;
namespace WebWindowComplex.Compo
{
public partial class EditSplitDimensions
{
#region Public Properties
/// <summary>
/// Split dimension corrente
/// </summary>
[Parameter]
public SplitDimension CurrRec { get; set; } = null!;
/// <summary>
/// Nome dello split dimension corrente
/// </summary>
[Parameter]
public string Name { get; set; } = null!;
/// <summary>
/// Indice dello split dimension
/// </summary>
[Parameter]
public int Index { get; set; } = -1;
[Parameter]
public EventCallback<DataUpdateSplitDimension> EC_Update { get; set; }
#endregion Public Properties
#region Private Properties
/// <summary>
/// Metodo per aggiornare la dimensione
/// </summary>
private double CurrVal
{
get => CurrRec.dDimension;
set
{
if (CurrRec.dDimension != value)
{
CurrRec.dDimension = value;
var args = new DataUpdateSplitDimension()
{
currSplit = CurrRec,
index = Index
};
_ = EC_Update.InvokeAsync(args);
}
}
}
/// <summary>
/// Metodo per aggiornare il tipo della dimensione
/// </summary>
private int CurrType
{
get => CurrRec.SelMeasureTypeIndex;
set
{
if (CurrRec.SelMeasureTypeIndex != value)
{
CurrRec.SelMeasureTypeIndex = value;
var args = new DataUpdateSplitDimension()
{
currSplit = CurrRec,
index=Index
};
_ = EC_Update.InvokeAsync(args);
}
}
}
private string SplitDimCss()
{
if (CurrRec.Parent.SelSplitShape.Equals(Json.WindowConst.SplitShapes.GRID))
return "";
else
return "col-md-12 col-lg-6";
}
#endregion Private Properties
}
/// <summary>
/// Classe per aggiornare split dimension
/// </summary>
public class DataUpdateSplitDimension
{
public SplitDimension currSplit { get; set; } = null!;
public int index { get; set; } = -1;
}
}
+45 -14
View File
@@ -15,16 +15,7 @@ namespace WebWindowComplex.Compo
public Window CurrWindow { get; set; } = null!;
[Parameter]
public EventCallback<string> EC_SelColor { get; set; }
[Parameter]
public EventCallback<string> EC_SelGlass { get; set; }
[Parameter]
public EventCallback<string> EC_SelWindMat { get; set; }
[Parameter]
public EventCallback<string> EC_SelProfile { get; set; }
public EventCallback<DataUpdateGeneral> EC_UpdateGeneral { get; set; }
[Parameter]
public EventCallback<bool> EC_ReqClose { get; set; }
@@ -45,43 +36,71 @@ namespace WebWindowComplex.Compo
#region Protected Properties
/// <summary>
/// Colore corrente
/// </summary>
protected string CurrColor
{
get => currColor;
set
{
currColor = value;
_ = EC_SelColor.InvokeAsync(value);
var args = new DataUpdateGeneral
{
Color = value,
};
_ = EC_UpdateGeneral.InvokeAsync(args);
}
}
/// <summary>
/// Vetro corrente
/// </summary>
protected string CurrGlass
{
get => currGlass;
set
{
currGlass = value;
_ = EC_SelGlass.InvokeAsync(value);
var args = new DataUpdateGeneral
{
Glass = value,
};
_ = EC_UpdateGeneral.InvokeAsync(args);
}
}
/// <summary>
/// Materiale corrente
/// </summary>
protected string CurrMaterial
{
get => currMaterial;
set
{
currMaterial = value;
_ = EC_SelWindMat.InvokeAsync(value);
var args = new DataUpdateGeneral
{
Material = value,
};
_ = EC_UpdateGeneral.InvokeAsync(args);
}
}
/// <summary>
/// Profilo corrente
/// </summary>
protected string CurrProfile
{
get => currProfile;
set
{
currProfile = value;
_ = EC_SelProfile.InvokeAsync(value);
var args = new DataUpdateGeneral
{
Profile = value,
};
_ = EC_UpdateGeneral.InvokeAsync(args);
}
}
@@ -123,4 +142,16 @@ namespace WebWindowComplex.Compo
_ = EC_ReqClose.InvokeAsync(true);
}
}
/// <summary>
/// Classe per aggiornamento dati general
/// </summary>
public class DataUpdateGeneral
{
public string Color { get; set; } = "";
public string Glass { get; set; } = "";
public string Material { get; set; } = "";
public string Profile { get; set; } = "";
}
}
+12
View File
@@ -9,6 +9,9 @@ namespace WebWindowComplex
{
public class ItemTable
{
/// <summary>
/// Tipo di area
/// </summary>
private AreaTypes m_type;
public AreaTypes Type
{
@@ -22,6 +25,9 @@ namespace WebWindowComplex
}
}
/// <summary>
/// Descrizione
/// </summary>
private string m_desc;
public string Desc
{
@@ -35,6 +41,9 @@ namespace WebWindowComplex
}
}
/// <summary>
/// Numero di riga nell'albero gerarchico
/// </summary>
private int m_row;
public int Row
{
@@ -48,6 +57,9 @@ namespace WebWindowComplex
}
}
/// <summary>
/// Numero di colonna nell'albero gerarchico
/// </summary>
private int m_col;
public int Col
{
+187 -31
View File
@@ -229,6 +229,20 @@ namespace WebWindowComplex.Json
}
}
//private JsonFrameArcElement m_FrameArcElem;
//[JsonProperty]
//public JsonFrameArcElement ArcElement
//{
// get
// {
// return m_FrameArcElem;
// }
// set
// {
// m_FrameArcElem = value;
// }
//}
public JsonFrame() : base(AreaTypes.FRAME)
{
}
@@ -249,9 +263,11 @@ namespace WebWindowComplex.Json
newFrame.SetSelShape(m_Shape);
newFrame.SetBottomRail(m_bBottomRail);
newFrame.SetBottomRailQty(m_nBottomRailQty);
//if(ArcElement != null)
// newFrame.SetFrameArcElem(ArcElement.Deserialize(newFrame, ParentWindow));
//Frame.AppliedDone();
for (var DimensionIndex = 0; DimensionIndex <= m_DimensionList.Count - 1; DimensionIndex++)
newFrame.DimensionList[DimensionIndex].dValue = m_DimensionList[DimensionIndex].Value;
newFrame.DimensionList[DimensionIndex].SetDimension(m_DimensionList[DimensionIndex].Value);
for (var JointIndex = 0; JointIndex <= m_JointList.Count - 1; JointIndex++)
newFrame.JointList[JointIndex].SetSelJointType(m_JointList[JointIndex].JointType);
foreach (var Area in AreaList)
@@ -311,20 +327,6 @@ namespace WebWindowComplex.Json
}
}
private List<JsonJoint> m_JointList = new List<JsonJoint>();
[JsonProperty]
public List<JsonJoint> JointList
{
get
{
return m_JointList;
}
set
{
m_JointList = value;
}
}
private bool m_bBottomRail;
[JsonProperty]
public bool BottomRail
@@ -353,6 +355,20 @@ namespace WebWindowComplex.Json
}
}
//private JsonSashArcElement m_SashArcElem;
//[JsonProperty]
//public JsonSashArcElement ArcElement
//{
// get
// {
// return m_SashArcElem;
// }
// set
// {
// m_SashArcElem = value;
// }
//}
private string m_Hardware;
[JsonProperty]
public string Hardware
@@ -409,16 +425,17 @@ namespace WebWindowComplex.Json
newSash.SashList[SashIndex].SetOpeningType(m_SashList[SashIndex].OpeningType);
newSash.SashList[SashIndex].SetHasHandle(m_SashList[SashIndex].HasHandle);
newSash.SashList[SashIndex].SetDimension(m_SashList[SashIndex].Dimension);
newSash.SashList[SashIndex].SetMeasureType(m_SashList[SashIndex].MeasureType);
foreach (var Joint in m_SashList[SashIndex].JointList)
newSash.SashList[SashIndex].JointList.Add(Joint.Deserialize((Area)ParentArea));
}
foreach (var Joint in m_JointList)
newSash.JointList.Add(Joint.Deserialize((Area)ParentArea));
newSash.SetSelFamilyHardwareFromIndex(Hardware);
newSash.ReqRefreshShape();
//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());
//if (ArcElement != null)
// newSash.SetSashArcElem(ArcElement.Deserialize(newSash, ParentWindow));
foreach (var Area in AreaList)
{
var AreaDeserealized = Area.Deserialize(newSash, ParentWindow);
@@ -511,24 +528,24 @@ namespace WebWindowComplex.Json
Split.SetSplitQtyVert(0);
else
{
//Split.SplitVertList.Clear();
Split.SetSplitQtyVert(m_SplitVertList.Count - 1);
for (var SplitIndex = 0; SplitIndex <= m_SplitVertList.Count - 1; SplitIndex++)
{
Split.SplitVertList[SplitIndex].SetIsRelative(m_SplitVertList[SplitIndex].IsRelative);
Split.SplitVertList[SplitIndex].SetDimension(m_SplitVertList[SplitIndex].Dimension);
Split.SplitVertList[SplitIndex].SetMeasureType(m_SplitVertList[SplitIndex].MeasureType);
}
}
if (m_SplitHorizList.Count == 0)
Split.SetSplitQtyHoriz(0);
else
{
//Split.SplitHorizList.Clear();
Split.SetSplitQtyHoriz(m_SplitHorizList.Count - 1);
for (var SplitIndex = 0; SplitIndex <= m_SplitHorizList.Count - 1; SplitIndex++)
{
Split.SplitHorizList[SplitIndex].SetIsRelative(m_SplitHorizList[SplitIndex].IsRelative);
Split.SplitHorizList[SplitIndex].SetDimension(m_SplitHorizList[SplitIndex].Dimension);
Split.SplitHorizList[SplitIndex].SetMeasureType(m_SplitHorizList[SplitIndex].MeasureType);
}
}
foreach (var Area in AreaList)
@@ -618,6 +635,107 @@ namespace WebWindowComplex.Json
}
}
//public class JsonFrameArcElement
//{
// private double m_Section;
// [JsonProperty]
// public double Section
// {
// get
// {
// return m_Section;
// }
// set
// {
// m_Section = value;
// }
// }
// private bool m_bCutEdge;
// [JsonProperty]
// public bool CutEdge
// {
// get
// {
// return m_bCutEdge;
// }
// set
// {
// m_bCutEdge = value;
// }
// }
// private bool m_bIsAlign;
// [JsonProperty]
// public bool IsAlign
// {
// get
// {
// return m_bIsAlign;
// }
// set
// {
// m_bIsAlign = value;
// }
// }
// public JsonFrameArcElement(double Section, bool CutEdge, bool IsAlign)
// {
// m_Section = Section;
// m_bCutEdge = CutEdge;
// m_bIsAlign = IsAlign;
// }
// internal FrameArcElement Deserialize(Area ParentArea, Window ParentWindow)
// {
// FrameArcElement arcElement = new FrameArcElement(ParentArea, ParentWindow, m_Section, m_bCutEdge, m_bIsAlign);
// return arcElement;
// }
//}
//public class JsonSashArcElement
//{
// private double m_Section;
// [JsonProperty]
// public double Section
// {
// get
// {
// return m_Section;
// }
// set
// {
// m_Section = value;
// }
// }
// private bool m_bCutEdge;
// [JsonProperty]
// public bool CutEdge
// {
// get
// {
// return m_bCutEdge;
// }
// set
// {
// m_bCutEdge = value;
// }
// }
// public JsonSashArcElement(double Section, bool CutEdge)
// {
// m_Section = Section;
// m_bCutEdge = CutEdge;
// }
// internal SashArcElement Deserialize(Area ParentArea, Window ParentWindow)
// {
// SashArcElement arcElement = new SashArcElement(ParentArea, ParentWindow, m_Section, m_bCutEdge);
// return arcElement;
// }
//}
public class JsonJoint
{
private int m_nIndex;
@@ -769,17 +887,14 @@ namespace WebWindowComplex.Json
}
}
private bool m_bHasHandle;
private MeasureTypes m_MeasureType;
[JsonProperty]
public bool HasHandle
[JsonConverter(typeof(StringEnumConverter))]
public MeasureTypes MeasureType
{
get
{
return m_bHasHandle;
}
set
{
m_bHasHandle = value;
return m_MeasureType;
}
}
@@ -797,9 +912,38 @@ namespace WebWindowComplex.Json
}
}
public JsonSashDimension(Openings OpeningType, bool HasHandle, double Dimension, int SashId)
private bool m_bHasHandle;
[JsonProperty]
public bool HasHandle
{
get
{
return m_bHasHandle;
}
set
{
m_bHasHandle = value;
}
}
private List<JsonJoint> m_JointList = new List<JsonJoint>();
[JsonProperty]
public List<JsonJoint> JointList
{
get
{
return m_JointList;
}
set
{
m_JointList = value;
}
}
public JsonSashDimension(Openings OpeningType, MeasureTypes MeasureType, bool HasHandle, double Dimension, int SashId)
{
m_OpeningType = OpeningType;
m_MeasureType = MeasureType;
m_bHasHandle = HasHandle;
m_dDimension = Dimension;
m_nSashId = SashId;
@@ -832,10 +976,22 @@ namespace WebWindowComplex.Json
}
}
public JsonSplitDimension(bool IsRelative, double Dimension)
private MeasureTypes m_MeasureType;
[JsonProperty]
[JsonConverter(typeof(StringEnumConverter))]
public MeasureTypes MeasureType
{
get
{
return m_MeasureType;
}
}
public JsonSplitDimension(bool IsRelative, double Dimension, MeasureTypes MeasureType)
{
m_bIsRelative = IsRelative;
m_dDimension = Dimension;
m_MeasureType = MeasureType;
}
}
+1 -1
View File
@@ -121,7 +121,7 @@ namespace WebWindowComplex.Json
public enum MeasureTypes: int
{
NULL = 0,
ABSOLUT = 1,
ABSOLUTE = 1,
PROPORTIONAL = 2,
PERCENTAGE = 3
}
+19 -1
View File
@@ -15,7 +15,8 @@ namespace WebWindowComplex
Split,
Sash,
Fill,
General
General,
ArcElement
}
public enum PositionJoints
@@ -25,5 +26,22 @@ namespace WebWindowComplex
TR, // Top Right
TL // Top Left
}
public enum DataAction
{
/// <summary>
/// Nessuna richiesta
/// </summary>
None = 0,
/// <summary>
/// Reset dizionario shape
/// </summary>
ResetDictShape,
/// <summary>
/// Reset dizionario HwOptions
/// </summary>
ResetHwOpt
}
}
}
+3 -1
View File
@@ -54,7 +54,9 @@ namespace WebWindowComplex.Models
{
foreach (var Value in HdwOptionParam.Opzioni)
m_ValueList.Add(Value.Valore);
m_sValue = m_ValueList.FirstOrDefault(x => x == HdwOptionParam.ValoreCorrente) ?? "";
m_sValue = m_ValueList.FirstOrDefault(x => x == HdwOptionParam.ValoreCorrente);
if (string.IsNullOrEmpty(m_sValue))
m_sValue = m_ValueList.FirstOrDefault();
}
else
{
+168 -4
View File
@@ -69,7 +69,7 @@ namespace WebWindowComplex.Models
set
{
m_nAreaId = value;
m_ParentWindow.OnUpdatePreview(m_ParentWindow.sSerialized());
//m_ParentWindow.OnUpdatePreview(m_ParentWindow.sSerialized());
}
}
@@ -108,8 +108,15 @@ namespace WebWindowComplex.Models
SashArea.SetSelFamilyHardware("");
// Inserisco hardware di default
SashArea.SetSelHardwareFromId("000000");
//if (ParentWindow.AreaList.First().SelShapeIndex == (int)Shapes.ARC ||
// ParentWindow.AreaList.First().SelShapeIndex == (int)Shapes.DOUBLEARC ||
// ParentWindow.AreaList.First().SelShapeIndex == (int)Shapes.ARC_FULL ||
// ParentWindow.AreaList.First().SelShapeIndex == (int)Shapes.THREECENTERARC)
// SashArea.SashArcElem = new SashArcElement(SashArea, ParentWindow, 10, true);
//else
// SashArea.SashArcElem = null;
// Salvo gli oggetti già presenti e li cancello da AreaList
List<Area> ContentArea = new List<Area>();
List <Area> ContentArea = new List<Area>();
ContentArea.Add(AreaList[0]);
AreaList.Remove(AreaList[0]);
// Aggiungo area
@@ -118,7 +125,7 @@ namespace WebWindowComplex.Models
AreaList[0].AreaList.Add(ContentArea[0]);
AreaList[0].AreaList[0].SetParentArea(AreaList[0]);
// Richiesta SVG con hardware di default
ParentWindow.OnUpdatePreview(ParentWindow.sSerialized());
//ParentWindow.OnUpdatePreview(ParentWindow.sSerialized());
}
public void AddSplit()
@@ -157,7 +164,6 @@ namespace WebWindowComplex.Models
// All'area Split aggiunto le due aree Splitted
for (int i = 0; i < 2; i++)
AreaList[0].AreaList.Add(newSplittedList[i]);
ParentWindow.OnUpdatePreview(ParentWindow.sSerialized());
}
public abstract Area Copy(Area ParentArea);
@@ -194,6 +200,164 @@ namespace WebWindowComplex.Models
m_ParentArea = ParentArea;
}
/// <summary>
/// Metodo per calcolare larghezza area
/// </summary>
/// <param name="area"> area di partenza </param>
/// <param name="width"> larghezza di partenza </param>
/// <returns></returns>
internal double CalculateWidthArea(Area area, double width)
{
for (int i = 0; i < area.AreaList.Count; i++)
{
double risultato = -1;
if (area.Equals(this))
return width;
Area item = area.AreaList[i];
if (area is Split)
{
Split split = (Split)area;
if (split.SplitVertList.Count > 0)
{
switch (split.SplitVertList.ElementAt(i).SelMeasureType)
{
case MeasureTypes.ABSOLUTE:
{
risultato = CalculateWidthArea(item, split.SplitVertList.ElementAt(i).dDimension);
break;
}
case MeasureTypes.PROPORTIONAL:
{
//risultato = CalculateWidthSashGroup(item, split.SplitVertList.ElementAt(i).dDimension);
break;
}
case MeasureTypes.PERCENTAGE:
{
risultato = CalculateWidthArea(item, split.SplitVertList.ElementAt(i).dDimension * width / 100);
break;
}
}
}
else
{
risultato = CalculateWidthArea(item, width);
}
if (risultato != -1)
return risultato;
}
else if (area is Sash)
{
Sash sash = (Sash)area;
switch (sash.SashList.ElementAt(i).SelMeasureType)
{
case MeasureTypes.ABSOLUTE:
{
risultato = CalculateWidthArea(item, sash.SashList.ElementAt(i).dDimension);
break;
}
case MeasureTypes.PROPORTIONAL:
{
//risultato = CalculateWidthSashGroup(item, sash.SashList.ElementAt(i).dDimension);
break;
}
case MeasureTypes.PERCENTAGE:
{
risultato = CalculateWidthArea(item, sash.SashList.ElementAt(i).dDimension * width / 100);
break;
}
}
if (risultato != -1)
return risultato;
}
else
{
risultato = CalculateWidthArea(item, width);
if (risultato != -1)
return risultato;
}
}
return width;
}
/// <summary>
/// Metodo per calcolare larghezza area
/// </summary>
/// <param name="area"> area di partenza </param>
/// <param name="height"> altezza di partenza </param>
/// <returns></returns>
internal double CalculateHeightArea(Area area, double height)
{
for (int i = 0; i < area.AreaList.Count; i++)
{
double risultato = -1;
if (area.Equals(this))
return height;
Area item = area.AreaList[i];
if (area is Split)
{
Split split = (Split)area;
if (split.SplitHorizList.Count > 0)
{
switch (split.SplitHorizList.ElementAt(i).SelMeasureType)
{
case MeasureTypes.ABSOLUTE:
{
risultato = CalculateHeightArea(item, split.SplitHorizList.ElementAt(i).dDimension);
break;
}
case MeasureTypes.PROPORTIONAL:
{
//risultato = CalculateHeighthArea(item, split.SplitHorizList.ElementAt(i).dDimension);
break;
}
case MeasureTypes.PERCENTAGE:
{
risultato = CalculateHeightArea(item, split.SplitHorizList.ElementAt(i).dDimension * height / 100);
break;
}
}
}
else
{
risultato = CalculateHeightArea(item, height);
}
if (risultato != -1)
return risultato;
}
else if (area is Sash)
{
Sash sash = (Sash)area;
switch (sash.SashList.ElementAt(i).SelMeasureType)
{
case MeasureTypes.ABSOLUTE:
{
risultato = CalculateHeightArea(item, sash.SashList.ElementAt(i).dDimension);
break;
}
case MeasureTypes.PROPORTIONAL:
{
//risultato = CalculateHeighthArea(item, sash.SashList.ElementAt(i).dDimension);
break;
}
case MeasureTypes.PERCENTAGE:
{
risultato = CalculateHeightArea(item, sash.SashList.ElementAt(i).dDimension * height / 100);
break;
}
}
if (risultato != -1)
return risultato;
}
else
{
risultato = CalculateHeightArea(item, height);
if (risultato != -1)
return risultato;
}
}
return height;
}
#endregion Internal Methods
#region Protected Fields
-2
View File
@@ -52,7 +52,6 @@ namespace WebWindowComplex.Models
set
{
m_SelFillType = (FillTypes)IdNameStruct.IdFromInd(value, m_FillTypeList);
m_ParentWindow.OnUpdatePreview(m_ParentWindow.sSerialized());
}
}
@@ -97,7 +96,6 @@ namespace WebWindowComplex.Models
internal void SetSelFillType(FillTypes value)
{
m_SelFillType = value;
//m_ParentWindow.OnUpdatePreview(m_ParentWindow.sSerialized());
}
internal void SetFillType(FillTypes value)
{
+91 -16
View File
@@ -20,6 +20,18 @@ namespace WebWindowComplex.Models
#region Public Properties
//public FrameArcElement? FrameArcElem
//{
// get
// {
// return m_FrameArcElem;
// }
// set
// {
// m_FrameArcElem = value!;
// }
//}
public bool BottomRail
{
get
@@ -29,7 +41,6 @@ namespace WebWindowComplex.Models
set
{
m_bBottomRail = value;
m_ParentWindow.OnUpdatePreview(m_ParentWindow.sSerialized());
}
}
@@ -53,7 +64,6 @@ namespace WebWindowComplex.Models
m_bBottomRail = false;
}
}
m_ParentWindow.OnUpdatePreview(m_ParentWindow.sSerialized());
}
}
@@ -79,12 +89,10 @@ namespace WebWindowComplex.Models
{
get
{
//return IdNameStruct.IndFromId((int)m_Shape, m_ShapeList);
return (int)m_Shape;
}
set
{
//Shapes SelShape = (Shapes)IdNameStruct.IdFromInd(value, m_ShapeList);
Shapes SelShape = (Shapes)value;
if (m_Shape != SelShape)
{
@@ -100,7 +108,7 @@ namespace WebWindowComplex.Models
case Shapes.ARC_FULL:
{
DimensionList.Add(new FrameDimension(this, 1, "Width", widthVal, true));
DimensionList.Add(new FrameDimension(this, 2, "Height", 1800, true));
DimensionList.Add(new FrameDimension(this, 2, "Height", 1400, true));
break;
}
@@ -124,7 +132,7 @@ namespace WebWindowComplex.Models
case Shapes.ARC:
{
DimensionList.Add(new FrameDimension(this, 1, "Width", widthVal, true));
DimensionList.Add(new FrameDimension(this, 2, "Height", 1500, true));
DimensionList.Add(new FrameDimension(this, 2, "Height", 1800 - (0.4 * widthVal), true));
DimensionList.Add(new FrameDimension(this, 3, "Full Height", 1800, true));
break;
}
@@ -132,7 +140,7 @@ namespace WebWindowComplex.Models
case Shapes.DOUBLEARC:
{
DimensionList.Add(new FrameDimension(this, 1, "Width", widthVal, true));
DimensionList.Add(new FrameDimension(this, 2, "Height", 1500, true));
DimensionList.Add(new FrameDimension(this, 2, "Height", 2400 - (0.6 * widthVal), true));
DimensionList.Add(new FrameDimension(this, 3, "Full Height", 2400, true));
break;
}
@@ -162,6 +170,9 @@ namespace WebWindowComplex.Models
}
// salvo tipo Joint
List<Joint> oldJointType = new List<Joint>(JointList);
// salvo la lista di sash
List<Sash> sashList = new List<Sash>();
SearchSash(sashList, this);
// aggiungo Joint
m_JointList.Clear();
switch (SelShape)
@@ -176,7 +187,10 @@ namespace WebWindowComplex.Models
JointList.Add(new Joint(this, 1, oldJointType[0].SelJointType));
JointList.Add(new Joint(this, 2, oldJointType[1].SelJointType));
JointList.Add(new Joint(this, 3, oldJointType[2].SelJointType));
JointList.Add(new Joint(this, 4, oldJointType[3].SelJointType));
if(oldJointType.Count > 3)
JointList.Add(new Joint(this, 4, oldJointType[3].SelJointType));
else
JointList.Add(new Joint(this, 4, Joints.FULL_V));
break;
}
@@ -202,21 +216,70 @@ namespace WebWindowComplex.Models
JointList.Add(new Joint(this, 1, oldJointType[0].SelJointType));
JointList.Add(new Joint(this, 2, oldJointType[1].SelJointType));
JointList.Add(new Joint(this, 3, Joints.ANGLED));
foreach(var s in sashList)
{
foreach(var sashDim in s.SashList)
{
sashDim.JointList.RemoveAt(sashDim.JointList.Count - 1);
sashDim.JointList.Last().SelJointType = Joints.ANGLED;
}
}
break;
}
case Shapes.CUSTOM:
{
JointList.Clear();
break;
}
}
if(JointList.Count > 3)
{
foreach (var s in sashList)
{
foreach(var sashDim in s.SashList)
{
if (sashDim.JointList.Count == 3)
sashDim.JointList.Add(new Joint(s, 4, Joints.FULL_V));
}
}
}
//switch (SelShape)
//{
// case Shapes.RECTANGLE:
// case Shapes.RIGHTCHAMFER:
// case Shapes.LEFTCHAMFER:
// case Shapes.DOUBLECHAMFER:
// case Shapes.TRIANGLE:
// {
// FrameArcElem = null;
// foreach (var s in sashList)
// s.SashArcElem = null;
// break;
// }
//}
m_Shape = SelShape;
}
//m_ParentWindow.OnUpdatePreview(m_ParentWindow.sSerialized());
}
}
protected List<Sash> SearchSash(List<Sash> sashList,Area node)
{
if (node != null)
{
if (node.AreaType.Equals(AreaTypes.SASH))
{
sashList.Add((Sash)node);
//Sash s = (Sash)node;
//s.SashArcElem = null;
}
foreach (var item in node.AreaList)
{
SearchSash(sashList, item);
}
}
return sashList;
}
public Shapes Shape
{
get
@@ -246,14 +309,20 @@ namespace WebWindowComplex.Models
#region Internal Methods
//internal void SetFrameArcElem(FrameArcElement arcElement)
//{
// m_FrameArcElem = arcElement;
//}
internal static Area CreateFrame(Window Window)
{
Frame NewFrame = new Frame(null, Window);
NewFrame.SetAreaType(AreaTypes.FRAME);
NewFrame.SetSelShape(Shapes.RECTANGLE);
NewFrame.SetBottomRail(false);
NewFrame.SetBottomRailQty(0);
return NewFrame;
Frame newFrame = new Frame(null, Window);
newFrame.SetAreaType(AreaTypes.FRAME);
newFrame.SetSelShape(Shapes.RECTANGLE);
newFrame.SetBottomRail(false);
newFrame.SetBottomRailQty(0);
//newFrame.FrameArcElem = null;
return newFrame;
}
internal override JsonArea Serialize(bool hideHw)
@@ -262,6 +331,10 @@ namespace WebWindowComplex.Models
if (nCounterGroup < GroupId)
Area.nCounterGroup = GroupId;
JsonFrame JsonFrame = new JsonFrame(m_Shape, m_bBottomRail, m_nBottomRailQty, GroupId);
//if (FrameArcElem != null)
// JsonFrame.ArcElement = FrameArcElem.Serialize();
//else
// JsonFrame.ArcElement = null;
foreach (var Dimension in DimensionList)
JsonFrame.DimensionList.Add(Dimension.Serialize());
foreach (var Joint in JointList)
@@ -400,6 +473,8 @@ namespace WebWindowComplex.Models
#region Private Fields
//private FrameArcElement m_FrameArcElem = new FrameArcElement();
private bool m_bBottomRail;
private List<FrameDimension> m_DimensionList = new List<FrameDimension>();
+121
View File
@@ -0,0 +1,121 @@
using System;
using System.Collections;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Text.RegularExpressions;
using System.Threading.Tasks;
using WebWindowComplex.Json;
using static WebWindowComplex.Json.WindowConst;
namespace WebWindowComplex.Models
{
public class FrameArcElement
{
#region Public Constructors
public FrameArcElement() { }
public FrameArcElement(Area ParentArea, Window ParentWindow, double nSection, bool bCutEdge, bool bIsAlign)
{
m_ParentArea = ParentArea;
m_ParentWindow = ParentWindow;
m_nSection = nSection;
m_bCutEdge = bCutEdge;
m_bIsAlign = bIsAlign;
}
#endregion Public Constructors
#region Public Properties
public int nQty
{
get
{
return m_nQty;
}
set
{
m_nQty = value;
}
}
public double nSection
{
get
{
return m_nSection;
}
set
{
m_nSection = value;
}
}
public bool bCutEdge
{
get
{
return m_bCutEdge;
}
set
{
m_bCutEdge = value;
}
}
public bool bIsAlign
{
get
{
return m_bIsAlign;
}
set
{
m_bIsAlign = value;
}
}
#endregion Public Properties
#region Internal Methods
internal void SetQty(int Qty)
{
m_nQty = Qty;
}
internal void SetSection(double Section)
{
m_nSection = Section;
}
//internal JsonFrameArcElement Serialize()
//{
// JsonFrameArcElement jArcElement = new JsonFrameArcElement(nSection, bCutEdge, bIsAlign);
// return jArcElement;
//}
#endregion Internal Methods
#region Protected Fields
protected Area m_ParentArea;
protected Window m_ParentWindow;
#endregion Protected Fields
#region Private Fields
private double m_nSection;
private int m_nQty;
private bool m_bCutEdge = false;
private bool m_bIsAlign = false;
#endregion Private Fields
}
}
+243 -8
View File
@@ -4,6 +4,7 @@ using System.Linq;
using System.Text;
using System.Threading.Tasks;
using WebWindowComplex.Json;
using static WebWindowComplex.Json.WindowConst;
namespace WebWindowComplex.Models
{
@@ -32,16 +33,102 @@ namespace WebWindowComplex.Models
}
set
{
m_dValue = value;
if (value > MaxDim)
if(m_dValue != value)
{
m_dValue = MaxDim;
if (ParentFrame.SelShapeIndex == (int)Shapes.RECTANGLE ||
ParentFrame.SelShapeIndex == (int)Shapes.RIGHTCHAMFER ||
ParentFrame.SelShapeIndex == (int)Shapes.LEFTCHAMFER ||
ParentFrame.SelShapeIndex == (int)Shapes.DOUBLECHAMFER ||
ParentFrame.SelShapeIndex == (int)Shapes.TRIANGLE)
{
if (value > MaxDim)
{
m_dValue = MaxDim;
}
else if (value < MinDim && !m_sName.Equals("Radius") && !m_sName.Equals("Height projection"))
{
m_dValue = MinDim;
}
else
m_dValue = value;
}
else
{
if (ParentFrame.SelShapeIndex == (int)Shapes.ARC_FULL)
{
var width = ParentFrame.DimensionList.First(x => x.sName.Equals("Width")).dValue;
var height = ParentFrame.DimensionList.First(x => x.sName.Equals("Height")).dValue;
if (sName.Equals("Height") && value > 0.5 * width && value < MaxDim)
{
m_dValue = value;
}
else if (sName.Equals("Width") && height > 0.5 * value && value > MinDim)
{
m_dValue = value;
}
}
else if (ParentFrame.SelShapeIndex == (int)Shapes.ARC)
{
var width = ParentFrame.DimensionList.First(x => x.sName.Equals("Width")).dValue;
var height = ParentFrame.DimensionList.First(x => x.sName.Equals("Height")).dValue;
var fullHeight = ParentFrame.DimensionList.First(x => x.sName.Equals("Full Height")).dValue;
if (sName.Equals("Full Height") && (value - height) < 0.5 * width && value < MaxDim)
{
m_dValue = value;
}
else if (sName.Equals("Height") && (fullHeight - value) < 0.5 * width && value < MaxDim)
{
m_dValue = value;
}
else if (sName.Equals("Width") && (fullHeight - height) < 0.5 * value && value < MaxDim)
{
m_dValue = value;
}
}
else if (ParentFrame.SelShapeIndex == (int)Shapes.THREECENTERARC)
{
var width = ParentFrame.DimensionList.First(x => x.sName.Equals("Width")).dValue;
var height = ParentFrame.DimensionList.First(x => x.sName.Equals("Height")).dValue;
var fullHeight = ParentFrame.DimensionList.First(x => x.sName.Equals("Full Height")).dValue;
if (sName.Equals("Full Height") && (value - height) < 0.5 * width && value < MaxDim)
{
m_dValue = value;
}
else if (sName.Equals("Height") && (fullHeight - value) < 0.5 * width && value < MaxDim)
{
m_dValue = value;
}
else if (sName.Equals("Width") && (fullHeight - height) < 0.5 * value)
{
m_dValue = value;
}
else if (sName.Equals("Radius") && value < 0.5 * width)
{
m_dValue = value;
}
}
else if (ParentFrame.SelShapeIndex == (int)Shapes.DOUBLEARC)
{
var width = ParentFrame.DimensionList.First(x => x.sName.Equals("Width")).dValue;
var height = ParentFrame.DimensionList.First(x => x.sName.Equals("Height")).dValue;
var fullHeight = ParentFrame.DimensionList.First(x => x.sName.Equals("Full Height")).dValue;
if (sName.Equals("Full Height") && (value - height) > 0.5 * width && value < MaxDim)
{
m_dValue = value;
}
else if (sName.Equals("Height") && (fullHeight - value) > 0.5 * width && value < MaxDim)
{
m_dValue = value;
}
else if (sName.Equals("Width") && (fullHeight - height) > 0.5 * value && value > MinDim)
{
m_dValue = value;
}
}
}
if (ParentFrame.AreaList.Count > 0)
SearchAreaList(ParentFrame);
}
else if (value < MinDim && !m_sName.Equals("Radius"))
{
m_dValue = MinDim;
}
m_ParentFrame.ParentWindow.OnUpdatePreview(m_ParentFrame.ParentWindow.sSerialized());
}
}
@@ -73,12 +160,160 @@ namespace WebWindowComplex.Models
#region Internal Methods
/// <summary>
/// Cerca nell'albero gli oggetti Sash e Split per associare la larghezza
/// </summary>
/// <param name="node"></param>
protected void SearchAreaList(Area node)
{
if (node != null)
{
if (node.AreaType.Equals(AreaTypes.SASH))
UpdateDimSubArea((Sash)node);
else if (node.AreaType.Equals(AreaTypes.SPLIT))
UpdateDimSubArea((Split)node);
foreach (var item in node.AreaList)
{
SearchAreaList(item);
}
}
}
protected void UpdateDimSubArea(Area area)
{
if(area is Sash && sName.Equals("Width"))
{
Sash sash = (Sash)area;
int countAbsolute = sash.SashList.Where(x => x.MeasureType.Equals(MeasureTypes.ABSOLUTE)).Count();
int countProportional = sash.SashList.Where(x => x.MeasureType.Equals(MeasureTypes.PROPORTIONAL)).Count();
int countPercentage = sash.SashList.Where(x => x.MeasureType.Equals(MeasureTypes.PERCENTAGE)).Count();
if (countAbsolute == sash.SashList.Count)
{
double sum = sash.SashList.Sum(x => x.dDimension);
double res = dValue - sum;
if (res > 0)
{
foreach (var sashDim in sash.SashList)
{
sashDim.SetDimension(sashDim.dDimension + res / countAbsolute);
}
}
else
{
foreach (var sashDim in sash.SashList)
{
// Sommo perchè res è negativo
sashDim.SetDimension(sashDim.dDimension + res / countAbsolute);
}
}
}
else if (countAbsolute < sash.SashList.Count)
{
if (countPercentage > 0 && countPercentage <= sash.SashList.Count && countProportional == 0)
{
double widthTot = ParentFrame.CalculateWidthArea(ParentFrame, ParentFrame.DimensionList.First(x => x.m_sName.Equals("Width")).dValue);
double sumAbsolute = sash.SashList.Where(x => x.MeasureType.Equals(MeasureTypes.ABSOLUTE)).Sum(x => x.dDimension);
var percentageList = sash.SashList.Where(x => x.MeasureType.Equals(MeasureTypes.PERCENTAGE)).ToList();
foreach(var i in percentageList)
{
i.SetDimension(ConvertIn((widthTot - sumAbsolute) / countPercentage, i.MeasureType, widthTot, sash));
}
}
}
}
else if(area is Split)
{
Split split = (Split)area;
List<SplitDimension> splitList = null;
if (sName.Equals("Width"))
splitList = split.SplitVertList;
else
splitList = split.SplitHorizList;
int countAbsolute = splitList.Where(x => x.MeasureType.Equals(MeasureTypes.ABSOLUTE)).Count();
if (countAbsolute != 0 && countAbsolute == splitList.Count)
{
double sum = splitList.Sum(x => x.dDimension);
double res = dValue - sum;
if (res > 0)
{
foreach (var sashDim in splitList)
{
sashDim.SetDimension(sashDim.dDimension + res / countAbsolute);
}
}
else
{
foreach (var sashDim in splitList)
{
// Sommo perchè res è negativo
sashDim.SetDimension(sashDim.dDimension + res / countAbsolute);
}
}
}
}
}
internal void SetDimension(double dValue)
{
m_dValue = dValue;
}
internal JsonFrameDimension Serialize()
{
JsonFrameDimension JsonFrameDimension = new JsonFrameDimension(m_nIndex, m_sName, m_dValue);
return JsonFrameDimension;
}
/// <summary>
/// Metodo per convertire una dimensione da un valore assoluto al suo rispettivo tipo
/// </summary>
/// <param name="absoluteVal"> Valore assoluto </param>
/// <param name="type"> Tipo di misura della dimensione </param>
/// <param name="widthTot"> Larghezza totale </param>
/// <returns></returns>
internal double ConvertIn(double absoluteVal, MeasureTypes type, double widthTot, Sash sash)
{
switch (type)
{
case MeasureTypes.ABSOLUTE:
{
return absoluteVal;
}
case MeasureTypes.PROPORTIONAL:
{
return ProportionalFromAbsoluteVal(absoluteVal, widthTot, sash);
}
case MeasureTypes.PERCENTAGE:
{
return (absoluteVal / widthTot) * 100;
}
}
return -1;
}
/// <summary>
/// Metodo per trasformare il valore proporzionale in assoluto
/// </summary>
/// <returns></returns>
internal double ProportionalFromAbsoluteVal(double absoluteVal, double widthTot, Sash sash)
{
double tot = widthTot;
//Somma misura non proporzionali
double sumNotProp = sash.SashList
.Where(m => m.MeasureType != MeasureTypes.PROPORTIONAL)
.Sum(m => m.CalculateAbsoluteValue(tot));
//Calcolo residuo
double res = tot - sumNotProp;
if (res < 0) res = 0;
//Misure proporzionali
var proportionalList = sash.SashList
.Where(m => m.SelMeasureType == MeasureTypes.PROPORTIONAL)
.ToList();
double sumPesi = proportionalList.Sum(p => p.dDimension);
if (sumPesi == 0) sumPesi = 1;
return res / sumPesi * absoluteVal;
}
#endregion Internal Methods
#region Protected Fields
-3
View File
@@ -63,14 +63,11 @@ namespace WebWindowComplex.Models
{
get
{
//return IdNameStruct.IndFromId((int)m_SelJointType, m_JointTypeList);
return (int)m_SelJointType;
}
set
{
//m_SelJointType = (Joints)IdNameStruct.IdFromInd(value, m_JointTypeList);
m_SelJointType = (Joints)value;
m_ParentArea.ParentWindow.OnUpdatePreview(m_ParentArea.ParentWindow.sSerialized());
}
}
@@ -4,23 +4,23 @@ using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace WebWindowComplex
namespace WebWindowComplex.Models
{
public partial class ParametriOpzioni
{
private ParametriOpzioniParametri[] itemsField;
/// <remarks/>
[System.Xml.Serialization.XmlElementAttribute("Parametri", Form = System.Xml.Schema.XmlSchemaForm.Unqualified)]
[System.Xml.Serialization.XmlElement("Parametri", Form = System.Xml.Schema.XmlSchemaForm.Unqualified)]
public ParametriOpzioniParametri[] Items
{
get
{
return this.itemsField;
return itemsField;
}
set
{
this.itemsField = value;
itemsField = value;
}
}
}
@@ -42,100 +42,100 @@ namespace WebWindowComplex
private ParametriOpzioniParametriOpzioni[] opzioniField;
/// <remarks/>
[System.Xml.Serialization.XmlElementAttribute(Form = System.Xml.Schema.XmlSchemaForm.Unqualified)]
[System.Xml.Serialization.XmlElement(Form = System.Xml.Schema.XmlSchemaForm.Unqualified)]
public string NomeParametro
{
get
{
return this.nomeParametroField;
return nomeParametroField;
}
set
{
this.nomeParametroField = value;
nomeParametroField = value;
}
}
/// <remarks/>
[System.Xml.Serialization.XmlElementAttribute(Form = System.Xml.Schema.XmlSchemaForm.Unqualified)]
[System.Xml.Serialization.XmlElement(Form = System.Xml.Schema.XmlSchemaForm.Unqualified)]
public string DescrizioneParametro
{
get
{
return this.descrizioneParametroField;
return descrizioneParametroField;
}
set
{
this.descrizioneParametroField = value;
descrizioneParametroField = value;
}
}
/// <remarks/>
[System.Xml.Serialization.XmlElementAttribute(Form = System.Xml.Schema.XmlSchemaForm.Unqualified)]
[System.Xml.Serialization.XmlElement(Form = System.Xml.Schema.XmlSchemaForm.Unqualified)]
public string ValoreCorrente
{
get
{
return this.valoreCorrenteField;
return valoreCorrenteField;
}
set
{
this.valoreCorrenteField = value;
valoreCorrenteField = value;
}
}
/// <remarks/>
[System.Xml.Serialization.XmlElementAttribute(Form = System.Xml.Schema.XmlSchemaForm.Unqualified)]
[System.Xml.Serialization.XmlElement(Form = System.Xml.Schema.XmlSchemaForm.Unqualified)]
public string Tipo
{
get
{
return this.tipoField;
return tipoField;
}
set
{
this.tipoField = value;
tipoField = value;
}
}
/// <remarks/>
[System.Xml.Serialization.XmlElementAttribute(Form = System.Xml.Schema.XmlSchemaForm.Unqualified)]
[System.Xml.Serialization.XmlElement(Form = System.Xml.Schema.XmlSchemaForm.Unqualified)]
public string Visible
{
get
{
return this.visibleField;
return visibleField;
}
set
{
this.visibleField = value;
visibleField = value;
}
}
/// <remarks/>
[System.Xml.Serialization.XmlElementAttribute(Form = System.Xml.Schema.XmlSchemaForm.Unqualified)]
[System.Xml.Serialization.XmlElement(Form = System.Xml.Schema.XmlSchemaForm.Unqualified)]
public string RicalcolaSeModificato
{
get
{
return this.ricalcolaSeModificatoField;
return ricalcolaSeModificatoField;
}
set
{
this.ricalcolaSeModificatoField = value;
ricalcolaSeModificatoField = value;
}
}
/// <remarks/>
[System.Xml.Serialization.XmlElementAttribute("Opzioni", Form = System.Xml.Schema.XmlSchemaForm.Unqualified)]
[System.Xml.Serialization.XmlElement("Opzioni", Form = System.Xml.Schema.XmlSchemaForm.Unqualified)]
public ParametriOpzioniParametriOpzioni[] Opzioni
{
get
{
return this.opzioniField;
return opzioniField;
}
set
{
this.opzioniField = value;
opzioniField = value;
}
}
}
@@ -149,44 +149,44 @@ namespace WebWindowComplex
private string valoreField;
/// <remarks/>
[System.Xml.Serialization.XmlElementAttribute(Form = System.Xml.Schema.XmlSchemaForm.Unqualified)]
[System.Xml.Serialization.XmlElement(Form = System.Xml.Schema.XmlSchemaForm.Unqualified)]
public string NomeParametro
{
get
{
return this.nomeParametroField;
return nomeParametroField;
}
set
{
this.nomeParametroField = value;
nomeParametroField = value;
}
}
/// <remarks/>
[System.Xml.Serialization.XmlElementAttribute(Form = System.Xml.Schema.XmlSchemaForm.Unqualified)]
[System.Xml.Serialization.XmlElement(Form = System.Xml.Schema.XmlSchemaForm.Unqualified)]
public string DescrizioneOpzione
{
get
{
return this.descrizioneOpzioneField;
return descrizioneOpzioneField;
}
set
{
this.descrizioneOpzioneField = value;
descrizioneOpzioneField = value;
}
}
/// <remarks/>
[System.Xml.Serialization.XmlElementAttribute(Form = System.Xml.Schema.XmlSchemaForm.Unqualified)]
[System.Xml.Serialization.XmlElement(Form = System.Xml.Schema.XmlSchemaForm.Unqualified)]
public string Valore
{
get
{
return this.valoreField;
return valoreField;
}
set
{
this.valoreField = value;
valoreField = value;
}
}
}
+211 -111
View File
@@ -46,14 +46,6 @@ namespace WebWindowComplex.Models
}
}
//public bool bIsPercentage
//{
// get
// {
// return m_bIsPercentage;
// }
//}
public bool bIsSashVertical
{
get
@@ -66,6 +58,18 @@ namespace WebWindowComplex.Models
}
}
//public SashArcElement? SashArcElem
//{
// get
// {
// return m_SashArcElement;
// }
// set
// {
// m_SashArcElement = value!;
// }
//}
public List<Hardware> HardwareList
{
get
@@ -78,7 +82,7 @@ namespace WebWindowComplex.Models
{
get
{
return m_HwdOptionList;
return m_HwOptionList;
}
}
@@ -86,19 +90,7 @@ namespace WebWindowComplex.Models
{
get
{
return m_SelHwdOptionList;
}
}
public List<Joint> JointList
{
get
{
return m_JointList;
}
set
{
m_JointList = value;
return m_SelHwOptionList;
}
}
@@ -112,15 +104,18 @@ namespace WebWindowComplex.Models
{
if (value > 0 && value <= 3)
{
double widthTot = CalculateWidthArea(ParentWindow.AreaList.First(), ParentWindow.AreaList.FirstOrDefault().DimensionList.Where(x => x.sName == "Width").First().dValue);
if (value > m_SashList.Count)
{
// recupero larghezza ultimo
double dLastDimension = 100;
double dNewDimension = 100;
double dLastDimension = widthTot;
double dNewDimension = widthTot;
if (m_SashList.Count > 0)
{
dLastDimension = m_SashList[m_SashList.Count - 1].dDimension;
dNewDimension = dLastDimension / (value + 1 - nSashQty);
if (m_SashList[m_SashList.Count - 1].MeasureType.Equals(MeasureTypes.PROPORTIONAL))
dNewDimension = 1;
m_SashList[m_SashList.Count - 1].SetDimension(dNewDimension);
}
else
@@ -128,7 +123,12 @@ namespace WebWindowComplex.Models
// aggiungo area Sash di default
for (var SplitIndex = m_SashList.Count; SplitIndex <= value - 1; SplitIndex++)
{
SashList.Add(new SashDimension(dNewDimension, MeasureTypes.PERCENTAGE, this, SplitIndex + 1));
var addSashDim = new SashDimension(dNewDimension, m_SashList[m_SashList.Count - 1].MeasureType, this, SplitIndex + 1);
for(int i = 1; i <= 4; i++)
{
addSashDim.JointList.Add(new Joint(this, i, Joints.FULL_V));
}
SashList.Add(addSashDim);
}
}
else if (value < m_SashList.Count)
@@ -136,12 +136,20 @@ namespace WebWindowComplex.Models
if (value > 0)
{
double dLastDimension = 0;
SashDimension itemDelete = null;
double deleteDim;
for (var SplitIndex = m_SashList.Count - 1; SplitIndex >= value; SplitIndex += -1)
{
dLastDimension += m_SashList[SplitIndex].dDimension;
//dLastDimension += m_SashList[SplitIndex].dDimension;
itemDelete = m_SashList[SplitIndex];
SashList.RemoveAt(SplitIndex);
}
dLastDimension += m_SashList[SashList.Count - 1].dDimension;
if (!itemDelete.SelMeasureType.Equals(m_SashList[SashList.Count - 1].SelMeasureType))
deleteDim = itemDelete.ConvertDimension(itemDelete.SelMeasureType, m_SashList[SashList.Count - 1].SelMeasureType, widthTot);
else
deleteDim = itemDelete.dDimension;
//dLastDimension += m_SashList[SashList.Count - 1].dDimension;
dLastDimension = deleteDim + m_SashList[SashList.Count - 1].dDimension;
SashList[SashList.Count - 1].SetDimension(dLastDimension);
if (value == 1)
SashList.First().SetHasHandle(true);
@@ -221,11 +229,8 @@ namespace WebWindowComplex.Models
}
}
RefreshHardwareList();
RefreshHardwareOptionList();
ClearHardwareOptionList();
SetFirstHardware();
m_ParentWindow.OnUpdatePreview(m_ParentWindow.sSerialized());
ReqRefreshHwOption();
//m_ParentWindow.OnReqHwOptionPreview(m_ParentWindow.sSerialized(), GroupId);
}
}
@@ -277,7 +282,6 @@ namespace WebWindowComplex.Models
{
m_bSashBottomRail = false;
}
m_ParentWindow.OnUpdatePreview(m_ParentWindow.sSerialized());
}
}
}
@@ -315,7 +319,6 @@ namespace WebWindowComplex.Models
set
{
SetSelFamilyHardware(value);
m_ParentWindow.OnUpdatePreview(m_ParentWindow.sSerialized());
}
}
@@ -330,8 +333,7 @@ namespace WebWindowComplex.Models
m_SelHardware = value;
if (HwOptionList.Count != 0)
{
RefreshHardwareOptionList();
ReqRefreshHwOption();
ClearHardwareOptionList();
}
}
}
@@ -350,8 +352,6 @@ namespace WebWindowComplex.Models
{
SelHwOptionList.Clear();
}
ReqRefreshHwOption();
//ParentWindow.OnUpdatePreview(ParentWindow.sSerialized());
}
}
@@ -371,12 +371,10 @@ namespace WebWindowComplex.Models
{
get
{
//return IdNameStruct.IndFromId((int)m_SelOrientationSashType, m_OrientationSashTypeList);
return (int)m_SelOrientationSashType;
}
set
{
//m_SelOrientationSashType = (OrientationSash)IdNameStruct.IdFromInd(value, m_OrientationSashTypeList);
m_SelOrientationSashType = (OrientationSash)value;
if (value == 0)
{
@@ -386,7 +384,7 @@ namespace WebWindowComplex.Models
{
m_bIsSashVertical = false;
}
m_ParentWindow.OnUpdatePreview(m_ParentWindow.sSerialized());
//m_ParentWindow.OnUpdatePreview(m_ParentWindow.sSerialized());
}
}
@@ -411,10 +409,6 @@ namespace WebWindowComplex.Models
newSash.SetIsSashVertical(bIsSashVertical);
newSash.SetOrientationSashType(OrientationSashType);
newSash.SetSashBottomRailQty(SashBottomRailQty);
newSash.SetSelFamilyHardwareFromIndex(m_SelHardware.Id);
newSash.ReqRefreshShape();
newSash.RefreshHardwareOptionList();
newSash.SetSelHardware(m_SelHardware);
for (int i = 0; i < SashList.Count; i++)
{
//Cancello SashDimension di default e aggiungo la copia
@@ -422,16 +416,20 @@ namespace WebWindowComplex.Models
SashDimension newSashDim = SashList[i].Copy();
newSash.SashList.Insert(i, newSashDim);
}
foreach (var item in JointList)
{
Joint newJoint = item.Copy();
newSash.JointList.Add(newJoint);
}
foreach (var item in AreaList)
{
Area newArea = item.Copy(newSash);
newSash.AreaList.Add(newArea);
}
newSash.SetSelFamilyHardwareFromIndex(m_SelHardware.Id);
newSash.SetSelHardwareFromId(CustomHwId);
//if (ParentWindow.AreaList.First().SelShapeIndex == (int)Shapes.ARC ||
// ParentWindow.AreaList.First().SelShapeIndex == (int)Shapes.DOUBLEARC ||
// ParentWindow.AreaList.First().SelShapeIndex == (int)Shapes.ARC_FULL ||
// ParentWindow.AreaList.First().SelShapeIndex == (int)Shapes.THREECENTERARC)
// newSash.SashArcElem = new SashArcElement(newSash, ParentWindow, 10, true);
//else
// newSash.SashArcElem = null;
return newSash;
}
@@ -444,6 +442,8 @@ namespace WebWindowComplex.Models
{
m_HardwareList.Clear();
Enums.OpeningTypes sOpeningType = ConvertOpeningType();
if (string.IsNullOrEmpty(m_SelFamilyHardware))
m_SelFamilyHardware = s_FamilyHardwareList.FirstOrDefault();
var iComp = StringComparison.InvariantCultureIgnoreCase;
var rawList = m_HardwareCompleteList
.Where(x => x.Id == "000000" ||
@@ -454,43 +454,51 @@ namespace WebWindowComplex.Models
x.OpeningType == sOpeningType)
)
.ToList() ?? new List<Hardware>();
if(rawList.Count == 0 || rawList == null)
{
Hardware hw = new Hardware(CustomHwId, m_SelFamilyHardware, "Custom", sOpeningType, m_CurrShape, nSashQty, 1);
rawList.Add(hw);
}
m_HardwareList = new List<Hardware>(rawList);
}
}
/// <summary>
/// Metodo per rimuovere l'intero sash group
/// </summary>
public void Remove()
{
ParentArea.AreaList.Remove(this);
Fill newFill = Fill.CreateFill(ParentArea, FillTypes.GLASS);
newFill.SetAreaType(AreaTypes.FILL);
ParentArea.AreaList.Add(newFill);
m_ParentWindow.OnUpdatePreview(m_ParentWindow.sSerialized());
//m_ParentWindow.OnUpdatePreview(m_ParentWindow.sSerialized());
}
/// <summary>
/// Richiesta calcolo shape corrente
/// </summary>
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);
}
}
///// <summary>
///// Richiesta calcolo shape corrente
///// </summary>
//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
// }
//}
/// <summary>
/// Richiesta calcolo hardware option list
/// </summary>
public void ReqRefreshHwOption()
{
HwOptionList.Clear();
// chiamata evento calcolo opzioni hardware
m_ParentWindow.OnReqHwOptionPreview(m_ParentWindow.sSerialized(), GroupId);
}
///// <summary>
///// Richiesta calcolo hardware option list
///// </summary>
//public void ReqRefreshHwOption()
//{
// HwOptionList.Clear();
// m_ReqHwOption = true;
// // chiamata evento calcolo opzioni hardware
// //m_ParentWindow.OnReqHwOptionPreview(m_ParentWindow.sSerialized(), GroupId);
//}
public void SetSelFamilyHardware(string sFamilyHw)
{
@@ -502,10 +510,7 @@ namespace WebWindowComplex.Models
}
SetFirstHardware();
if (HwOptionList.Count != 0)
{
RefreshHardwareOptionList();
ReqRefreshHwOption();
}
ClearHardwareOptionList();
}
/// <summary>
@@ -520,38 +525,118 @@ namespace WebWindowComplex.Models
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();
.FirstOrDefault(x => x.Shape == m_CurrShape &&
x.SashQty == nSashQty &&
x.OpeningType == ConvertOpeningType()
);
if(listHwValid == null)
{
noHwValid = true;
var familyHwValid = Sash.m_HardwareCompleteList
.Select(x => x.FamilyName)
.First();
SelHardwareFromId = "000000";
ClearHardwareOptionList();
}
else
{
SetSelFamilyHardware(listHwValid.FamilyName);
}
if (noHwValid)
{
SelHardwareFromId = "000000";
}
}
else
{
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();
ClearHardwareOptionList();
}
}
}
#endregion Public Methods
#region Internal Methods
///// <summary>
///// Metodo per calcolare larghezza intera sash group
///// </summary>
///// <param name="area"> area di partenza </param>
///// <param name="width"> larghezza di partenza </param>
///// <returns></returns>
//internal double CalculateWidthSashGroup(Area area, double width)
//{
// for (int i = 0; i < area.AreaList.Count; i++)
// {
// double risultato = -1;
// if (area.Equals(this))
// return width;
// Area item = area.AreaList[i];
// if (area is Split)
// {
// Split split = (Split)area;
// if(split.SplitVertList.Count > 0)
// {
// switch (split.SplitVertList.ElementAt(i).SelMeasureType)
// {
// case MeasureTypes.ABSOLUTE:
// {
// risultato = CalculateWidthSashGroup(item, split.SplitVertList.ElementAt(i).dDimension);
// break;
// }
// case MeasureTypes.PROPORTIONAL:
// {
// //risultato = CalculateWidthSashGroup(item, split.SplitVertList.ElementAt(i).dDimension);
// break;
// }
// case MeasureTypes.PERCENTAGE:
// {
// risultato = CalculateWidthSashGroup(item, split.SplitVertList.ElementAt(i).dDimension * width / 100);
// break;
// }
// }
// }
// else
// {
// risultato = CalculateWidthSashGroup(item, width);
// }
// if (risultato != -1)
// return risultato;
// }
// else if (area is Sash)
// {
// Sash sash = (Sash)area;
// switch (sash.SashList.ElementAt(i).SelMeasureType)
// {
// case MeasureTypes.ABSOLUTE:
// {
// risultato = CalculateWidthSashGroup(item, sash.SashList.ElementAt(i).dDimension);
// break;
// }
// case MeasureTypes.PROPORTIONAL:
// {
// //risultato = CalculateWidthSashGroup(item, sash.SashList.ElementAt(i).dDimension);
// break;
// }
// case MeasureTypes.PERCENTAGE:
// {
// risultato = CalculateWidthSashGroup(item, sash.SashList.ElementAt(i).dDimension * width / 100);
// break;
// }
// }
// if (risultato != -1)
// return risultato;
// }
// else
// {
// risultato = CalculateWidthSashGroup(item, width);
// if (risultato != -1)
// return risultato;
// }
// }
// return width;
//}
internal static Sash CreateSash(Area Area)
{
Sash newSash = new Sash(Area, Area.ParentWindow);
@@ -561,13 +646,17 @@ namespace WebWindowComplex.Models
newSash.SetSashQty(1);
newSash.SetOrientationSashType(OrientationSash.VERTICAL);
newSash.SetIsSashVertical(true);
for (var JointIndex = 0; JointIndex <= 3; JointIndex++)
newSash.JointList.Add(new Joint(newSash, JointIndex + 1, Joints.FULL_H));
foreach(var sashDim in newSash.SashList)
{
for (var JointIndex = 0; JointIndex <= 3; JointIndex++)
sashDim.JointList.Add(new Joint(newSash, JointIndex + 1, Joints.FULL_V));
}
newSash.SetSashBottomRail(false);
newSash.SetSashBottomRailQty(0);
newSash.SetSelFamilyHardware(Sash.s_FamilyHardwareList.First());
newSash.RefreshHardwareOptionList();
newSash.ClearHardwareOptionList();
newSash.SetFirstHardware();
//newSash.SashArcElem = null;
return newSash;
}
@@ -651,10 +740,9 @@ namespace WebWindowComplex.Models
}
}
internal void RefreshHardwareOptionList()
internal void ClearHardwareOptionList()
{
m_HwdOptionList.Clear();
//ReqRefreshHwOption();
m_HwOptionList.Clear();
}
internal override JsonArea Serialize(bool hideHw)
@@ -665,8 +753,6 @@ namespace WebWindowComplex.Models
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)
@@ -677,11 +763,20 @@ namespace WebWindowComplex.Models
foreach (var HwOption in SelHwOptionList)
JsonSash.HwOptionList.Add(new JsonHwOption(HwOption.Key, HwOption.Value));
}
//if (SashArcElem != null)
// JsonSash.ArcElement = SashArcElem.Serialize();
//else
// JsonSash.ArcElement = null;
foreach (var Area in AreaList)
JsonSash.AreaList.Add(Area.Serialize(hideHw));
return JsonSash;
}
//internal void SetSashArcElem(SashArcElement arcElement)
//{
// m_SashArcElement = arcElement;
//}
internal void SetFirstHardware()
{
if (m_HardwareList.Count > 0)
@@ -718,19 +813,19 @@ namespace WebWindowComplex.Models
HwOptions = (ParametriOpzioni)serializer.Deserialize(reader);
if (HwOptions.Items != null)
{
m_HwdOptionList.Clear();
m_HwOptionList.Clear();
foreach (var HwOption in HwOptions.Items)
{
switch (HwOption.Tipo)
{
case "Text":
{
m_HwdOptionList.Add(new AGBOptionText(HwOption));
m_HwOptionList.Add(new AGBOptionText(HwOption));
break;
}
case "List":
{
m_HwdOptionList.Add(new AGBOptionCombo(HwOption));
m_HwOptionList.Add(new AGBOptionCombo(HwOption));
break;
}
}
@@ -750,14 +845,18 @@ namespace WebWindowComplex.Models
case HwOptionTypes.COMBO:
{
AGBOptionCombo OptCombo = (AGBOptionCombo)HwOption;
var selValue = OptCombo.ValueList.Where(x => x.sValue == selHwOption).First();
OptCombo.sValue = selValue;
var selValue = OptCombo.ValueList.Where(x => x.sValue == selHwOption).FirstOrDefault();
if (selValue != null)
OptCombo.sValue = selValue;
else
OptCombo.sValue = OptCombo.ValueList.First();
break;
}
case HwOptionTypes.TEXT:
{
AGBOptionText OptText = (AGBOptionText)HwOption;
OptText.sValue = selHwOption;
if(OptText.ValueList.FirstOrDefault(x => x.Equals(selHwOption)) != null)
OptText.sValue = selHwOption;
break;
}
}
@@ -804,7 +903,12 @@ namespace WebWindowComplex.Models
dNewDimension = dLastDimension / (Qty + 1 - nSashQty);
// aggiungo area Sash di default
for (var SplitIndex = m_SashList.Count; SplitIndex <= Qty - 1; SplitIndex++)
SashList.Add(new SashDimension(dNewDimension, MeasureTypes.PERCENTAGE, this, SplitIndex + 1));
{
SashDimension newSashDim = new SashDimension(dNewDimension, MeasureTypes.PERCENTAGE, this, SplitIndex + 1);
//for (var JointIndex = 0; JointIndex <= 3; JointIndex++)
// newSashDim.JointList.Add(new Joint(this, JointIndex + 1, Joints.FULL_H));
SashList.Add(newSashDim);
}
}
else if (Qty < m_SashList.Count)
{
@@ -833,11 +937,6 @@ namespace WebWindowComplex.Models
return SelFamilyHardware;
}
internal void SetSelHardware(Hardware value)
{
SelHardware = value;
}
internal void SetSelHardwareFromId(string sId)
{
if (m_HardwareList.Count == 0)
@@ -871,10 +970,10 @@ namespace WebWindowComplex.Models
private string m_CurrShape = "";
private List<Hardware> m_HardwareList = new List<Hardware>();
private List<AGBOption> m_HwdOptionList = new List<AGBOption>();
private Dictionary<string, string> m_SelHwdOptionList = new Dictionary<string, string>();
private List<AGBOption> m_HwOptionList = new List<AGBOption>();
private Dictionary<string, string> m_SelHwOptionList = new Dictionary<string, string>();
private List<Joint> m_JointList = new List<Joint>();
//private List<Joint> m_JointList = new List<Joint>();
private int m_nSashBottomRailQty;
@@ -886,9 +985,10 @@ namespace WebWindowComplex.Models
private List<SashDimension> m_SashList = new List<SashDimension>();
private SashTypes m_SashType;
private string m_SelFamilyHardware;
private string m_SelFamilyHardware = "";
private Hardware m_SelHardware;
private OrientationSash m_SelOrientationSashType;
//private SashArcElement m_SashArcElement;
#endregion Private Fields
+96
View File
@@ -0,0 +1,96 @@
using System;
using System.Collections;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Text.RegularExpressions;
using System.Threading.Tasks;
using WebWindowComplex.Json;
using static WebWindowComplex.Json.WindowConst;
namespace WebWindowComplex.Models
{
public class SashArcElement
{
#region Public Constructors
public SashArcElement() { }
public SashArcElement(Area ParentArea, Window ParentWindow, double nSection, bool bCutEdge)
{
m_ParentArea = ParentArea;
m_ParentWindow = ParentWindow;
m_nSection = nSection;
m_bCutEdge = bCutEdge;
}
#endregion Public Constructors
#region Public Properties
public int nQty
{
get
{
return m_nQty;
}
set
{
m_nQty = value;
}
}
public double nSection
{
get
{
return m_nSection;
}
set
{
m_nSection = value;
}
}
public bool bCutEdge
{
get
{
return m_bCutEdge;
}
set
{
m_bCutEdge = value;
}
}
#endregion Public Properties
#region Internal Methods
//internal JsonSashArcElement Serialize()
//{
// JsonSashArcElement jArcElement = new JsonSashArcElement(nSection, bCutEdge);
// return jArcElement;
//}
#endregion Internal Methods
#region Protected Fields
protected Area m_ParentArea;
protected Window m_ParentWindow;
#endregion Protected Fields
#region Private Fields
private double m_nSection;
private int m_nQty;
private bool m_bCutEdge = false;
#endregion Private Fields
}
}
+474 -165
View File
@@ -1,4 +1,6 @@
using WebWindowComplex.Json;
using System.Runtime.InteropServices;
using System.Security.Principal;
using WebWindowComplex.Json;
using static WebWindowComplex.Json.WindowConst;
namespace WebWindowComplex.Models
@@ -101,7 +103,18 @@ namespace WebWindowComplex.Models
set
{
m_bHasHandle = value;
//m_Parent.ParentWindow.OnUpdatePreview(m_Parent.ParentWindow.sSerialized());
}
}
public List<Joint> JointList
{
get
{
return m_JointList;
}
set
{
m_JointList = value;
}
}
@@ -113,150 +126,159 @@ namespace WebWindowComplex.Models
}
set
{
double valMax = 0;
double widthTot = CalculateWidthSashGroup(m_Parent.ParentWindow.AreaList.FirstOrDefault(), m_Parent.ParentWindow.AreaList.FirstOrDefault().DimensionList.Where(x => x.sName == "Width").First().dValue);
double valMinAbsolute = 200;
double valMaxAbsolute = widthTot - valMinAbsolute * (m_Parent.SashList.Count - 1);
bool valueAccept = false;
switch (MeasureType)
{
case MeasureTypes.ABSOLUT:
case MeasureTypes.ABSOLUTE:
{
valMax = m_Parent.SashList.Sum(x => x.dDimension);
valueAccept = (value < valMax && value > 0) ? true: false;
valueAccept = (value < valMaxAbsolute && value > valMinAbsolute) ? true : false;
break;
}
case MeasureTypes.PROPORTIONAL:
{
valMax = m_Parent.SashList.Sum(x => x.dDimension);
valMaxAbsolute = 20;
valueAccept = (value >= 1) ? true : false;
break;
}
case MeasureTypes.PERCENTAGE:
{
valMax = 100;
valueAccept = (value < valMax && value > 0) ? true : false;
valMaxAbsolute = valMaxAbsolute / widthTot * 100;
valMinAbsolute = valMinAbsolute / widthTot * 100;
valueAccept = (value < valMaxAbsolute && value > valMinAbsolute) ? true : false;
break;
}
}
if (!MeasureType.Equals(MeasureTypes.PROPORTIONAL))
if (valueAccept)
{
if (valueAccept)
List<SashDimension> dimensions = m_Parent.SashList;
List<double> absoluteValList = new List<double>();
foreach (var item in m_Parent.SashList)
{
// verifico se ci sono altri in percentuale
List<SashDimension> DimList = m_Parent.SashList.Where(x => x.MeasureType.Equals(MeasureType)).ToList();
if (DimList.Count > 0)
absoluteValList.Add(item.CalculateAbsoluteValue(widthTot));
}
int nIndex = dimensions.IndexOf(this);
int proportionalCount = dimensions.Where(x => x.MeasureType.Equals(MeasureTypes.PROPORTIONAL)).ToList().Count;
int percentageCount = dimensions.Where(x => x.MeasureType.Equals(MeasureTypes.PERCENTAGE)).ToList().Count;
// Le dimensioni sono solo in proporzionale
if (proportionalCount == absoluteValList.Count || SelMeasureType.Equals(MeasureTypes.PROPORTIONAL) ||
(SelMeasureType.Equals(MeasureTypes.ABSOLUTE) && proportionalCount == absoluteValList.Count -1))
{
m_dDimension = value;
}
// Le dimensioni sono solo in percentuale
else if (percentageCount == dimensions.Count)
{
if (value < dDimension)
{
int nIndex = DimList.IndexOf(this);
// se diminuisce dimensione
if (value < m_dDimension)
{
if (nIndex < DimList.Count - 1)
DimList[nIndex + 1].SetDimension(DimList[nIndex + 1].dDimension + (m_dDimension - value));
else if (DimList.Count > 1)
DimList[nIndex - 1].SetDimension(DimList[nIndex - 1].dDimension + (m_dDimension - value));
else
{
m_dDimension = valMax;
return;
}
}
// se aumenta dimensione
// L'anta modificata non è l'ultima
if (nIndex < dimensions.Count - 1)
dimensions[nIndex + 1].SetDimension(dimensions[nIndex + 1].dDimension + (m_dDimension - value));
else if (dimensions.Count > 1)
dimensions[nIndex - 1].SetDimension(dimensions[nIndex - 1].dDimension + (m_dDimension - value));
else
{
double dRes = value;
// se non ultima anta
if (nIndex < DimList.Count - 1)
m_dDimension = 100;
return;
}
}
else
{
double dRes = value;
// se non ultima anta
if (nIndex < dimensions.Count - 1)
{
for (var nInd = 0; nInd <= nIndex - 1; nInd++)
dRes += dimensions[nInd].dDimension;
dRes = (100 - dRes) / (dimensions.Count - nIndex - 1);
for (var Ind = nIndex + 1; Ind <= dimensions.Count - 1; Ind++)
dimensions[Ind].SetDimension(dRes);
}
// se ultima anta
else if (dimensions.Count > 1)
{
if (dimensions.Count > 2)
{
for (var nInd = 0; nInd <= nIndex - 1; nInd++)
dRes += DimList[nInd].dDimension;
dRes = (100 - dRes) / (DimList.Count - nIndex - 1);
for (var Ind = nIndex + 1; Ind <= DimList.Count - 1; Ind++)
DimList[Ind].SetDimension(dRes);
}
// se ultima anta
else if (DimList.Count > 1)
{
if (DimList.Count > 2)
{
for (var Ind = 0; Ind <= nIndex - 2; Ind++)
dRes += DimList[Ind].dDimension;
}
dRes = (valMax - dRes);
DimList[nIndex - 1].SetDimension(dRes);
}
else
{
m_dDimension = valMax;
return;
for (var Ind = 0; Ind <= nIndex - 2; Ind++)
dRes += dimensions[Ind].dDimension;
}
dRes = (100 - dRes);
dimensions[nIndex - 1].SetDimension(dRes);
}
else
{
m_dDimension = 100;
return;
}
}
m_dDimension = value;
m_Parent.ParentWindow.OnUpdatePreview(m_Parent.ParentWindow.sSerialized());
}
// Le dimensioni sono miste o solo in assoluto
else
{
double valueInAbsolute = 0;
switch (MeasureType)
{
case MeasureTypes.ABSOLUTE:
{
valueInAbsolute = value;
break;
}
case MeasureTypes.PROPORTIONAL:
{
var pesi = value + dimensions
.Where(x => x.MeasureType.Equals(MeasureTypes.PROPORTIONAL) && !x.Equals(this))
.Sum(x => x.m_dDimension);
valueInAbsolute = widthTot / pesi * value;
break;
}
case MeasureTypes.PERCENTAGE:
{
valueInAbsolute = (value / 100) * widthTot;
break;
}
}
if (value < dDimension)
{
// L'anta modificata non è l'ultima
if (nIndex < absoluteValList.Count - 1)
{
absoluteValList[nIndex + 1] = absoluteValList[nIndex + 1] + (absoluteValList[nIndex] - valueInAbsolute);
absoluteValList[nIndex] = valueInAbsolute;
}
// L'anta modificata è l'ultima
else if (dimensions.Count > 1)
{
absoluteValList[nIndex - 1] = absoluteValList[nIndex - 1] + (absoluteValList[nIndex] - valueInAbsolute);
absoluteValList[nIndex] = valueInAbsolute;
}
}
else
{
// L'anta modificata non è l'ultima
if (nIndex < absoluteValList.Count - 1)
{
absoluteValList[nIndex + 1] = absoluteValList[nIndex + 1] - (valueInAbsolute - absoluteValList[nIndex]);
absoluteValList[nIndex] = valueInAbsolute;
}
// L'anta modificata è l'ultima
else if (dimensions.Count > 1)
{
absoluteValList[nIndex - 1] = absoluteValList[nIndex - 1] - (valueInAbsolute - absoluteValList[nIndex]);
absoluteValList[nIndex] = valueInAbsolute;
}
}
if (MeasureType.Equals(MeasureTypes.PROPORTIONAL))
m_dDimension = value;
for (int i = 0; i < absoluteValList.Count; i++)
{
var item = m_Parent.SashList.ElementAt(i);
item.SetDimension(ConvertIn(absoluteValList[i], (MeasureTypes)item.SelMeasureTypeIndex, widthTot));
}
}
}
else
{
m_dDimension = value;
m_Parent.ParentWindow.OnUpdatePreview(m_Parent.ParentWindow.sSerialized());
}
//// se sono in percentuale
//if (m_MeasureType.Equals(MeasureTypes.PERCENTAGE))
//{
// // Controllo che il valore inserito sia compreso tra 0 e 100
// if (value > 0 && value < 100)
// {
// // verifico se ci sono altri in percentuale
// List<SashDimension> RelativeDimList = m_Parent.SashList.Where(x => x.MeasureType.Equals(MeasureTypes.PERCENTAGE)).ToList();
// if (RelativeDimList.Count > 0)
// {
// int nIndex = RelativeDimList.IndexOf(this);
// // se diminuisce dimensione
// if (value < m_dDimension)
// {
// if (nIndex < RelativeDimList.Count - 1)
// RelativeDimList[nIndex + 1].SetDimension(RelativeDimList[nIndex + 1].dDimension + (m_dDimension - value));
// else if (RelativeDimList.Count > 1)
// RelativeDimList[nIndex - 1].SetDimension(RelativeDimList[nIndex - 1].dDimension + (m_dDimension - value));
// else
// {
// m_dDimension = 100;
// return;
// }
// }
// // se aumenta dimensione
// else
// {
// double dRes = value;
// // se non ultima anta
// if (nIndex < RelativeDimList.Count - 1)
// {
// for (var nInd = 0; nInd <= nIndex - 1; nInd++)
// dRes += RelativeDimList[nInd].dDimension;
// dRes = (100 - dRes) / (RelativeDimList.Count - nIndex - 1);
// for (var Ind = nIndex + 1; Ind <= RelativeDimList.Count - 1; Ind++)
// RelativeDimList[Ind].SetDimension(dRes);
// }
// // se ultima anta
// else if (RelativeDimList.Count > 1)
// {
// if (RelativeDimList.Count > 2)
// {
// for (var Ind = 0; Ind <= nIndex - 2; Ind++)
// dRes += RelativeDimList[Ind].dDimension;
// }
// dRes = (100 - dRes);
// RelativeDimList[nIndex - 1].SetDimension(dRes);
// }
// else
// {
// m_dDimension = 100;
// return;
// }
// }
// }
// }
// m_dDimension = value;
// m_Parent.ParentWindow.OnUpdatePreview(m_Parent.ParentWindow.sSerialized());
//}
}
}
@@ -293,8 +315,7 @@ namespace WebWindowComplex.Models
set
{
m_SelOpeningType = value;
m_Parent.ReqRefreshShape();
m_Parent.RefreshHardwareOptionList();
m_Parent.ClearHardwareOptionList();
m_Parent.SetFirstHardware();
}
}
@@ -303,22 +324,19 @@ namespace WebWindowComplex.Models
{
get
{
//return IdNameStruct.IndFromId((int)m_SelOpeningType, m_OpeningTypeList);
return (int)m_SelOpeningType;
}
set
{
//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.ClearHardwareOptionList();
m_Parent.RefreshHardwareList();
m_Parent.SetFirstHardware();
m_Parent.ParentWindow.OnUpdatePreview(m_Parent.ParentWindow.sSerialized());
}
}
}
@@ -359,7 +377,13 @@ namespace WebWindowComplex.Models
}
set
{
m_SelMeasureType = (MeasureTypes)value;
if(m_SelMeasureType != (MeasureTypes)value)
{
MeasureTypes newType = (MeasureTypes)value;
double widthTot = CalculateWidthSashGroup(m_Parent.ParentWindow.AreaList.FirstOrDefault(), m_Parent.ParentWindow.AreaList.FirstOrDefault().DimensionList.Where(x => x.sName == "Width").First().dValue);
m_dDimension = ConvertDimension(m_SelMeasureType, newType, widthTot);
m_SelMeasureType = (MeasureTypes)value;
}
}
}
@@ -367,12 +391,72 @@ namespace WebWindowComplex.Models
#region Public Methods
/// <summary>
/// Metodo per convertire la dimensione dal vecchio tipo al nuovo tipo
/// </summary>
/// <param name="oldType"> Vecchio tipo </param>
/// <param name="newType"> Nuovo tipo </param>
/// <returns></returns>
public double ConvertDimension(MeasureTypes oldType, MeasureTypes newType, double widthTot)
{
switch (oldType)
{
case MeasureTypes.ABSOLUTE:
{
if (newType.Equals(MeasureTypes.PERCENTAGE))
{
//return Double.Round((m_dDimension / m_Parent.Width) * 100, 1);
return (m_dDimension / widthTot) * 100;
}
else
{
return CalculatePropVal(widthTot);
}
}
case MeasureTypes.PROPORTIONAL:
{
if (newType.Equals(MeasureTypes.ABSOLUTE))
{
//return Double.Round(ConvertFromPropVal(newType), 2);
return ConvertFromPropVal(newType, widthTot);
}
else
{
//return Double.Round(ConvertFromPropVal(newType), 1);
return ConvertFromPropVal(newType, widthTot);
}
}
case MeasureTypes.PERCENTAGE:
{
if (newType.Equals(MeasureTypes.ABSOLUTE))
{
//return Double.Round((m_dDimension * m_Parent.Width) / 100, 2);
return (m_dDimension * widthTot) / 100;
}
else
{
return CalculatePropVal(widthTot);
}
}
}
return -1;
}
/// <summary>
/// Metodo per copiare l'intero oggetto
/// </summary>
/// <returns></returns>
public SashDimension Copy()
{
SashDimension newSashDim = new SashDimension(dDimension, MeasureType, m_Parent, m_nSashId);
newSashDim.SetMeasureType(MeasureType);
newSashDim.SetOpeningType(SelOpeningType);
newSashDim.SetHasHandle(bHasHandle);
foreach (var item in JointList)
{
Joint newJoint = item.Copy();
newSashDim.JointList.Add(newJoint);
}
return newSashDim;
}
@@ -380,9 +464,257 @@ namespace WebWindowComplex.Models
#region Internal Methods
/// <summary>
/// Metodo per calcolare larghezza intera sash group
/// </summary>
/// <param name="area"> area di partenza </param>
/// <param name="width"> larghezza di partenza </param>
/// <returns></returns>
internal double CalculateWidthSashGroup(Area area, double width)
{
for(int i = 0; i < area.AreaList.Count; i++)
{
double risultato = -1;
if (area.Equals(m_Parent))
return width;
Area item = area.AreaList[i];
if (area is Split)
{
Split split = (Split)area;
if (split.SplitVertList.Count > 0)
{
switch (split.SplitVertList.ElementAt(i).SelMeasureType)
{
case MeasureTypes.ABSOLUTE:
{
risultato = CalculateWidthSashGroup(item, split.SplitVertList.ElementAt(i).dDimension);
break;
}
case MeasureTypes.PROPORTIONAL:
{
//risultato = CalculateWidthSashGroup(item, split.SplitVertList.ElementAt(i).dDimension);
break;
}
case MeasureTypes.PERCENTAGE:
{
risultato = CalculateWidthSashGroup(item, split.SplitVertList.ElementAt(i).dDimension * width / 100);
break;
}
}
if (risultato != -1)
return risultato;
}
else
{
risultato = CalculateWidthSashGroup(item, width);
}
}
else if (area is Sash)
{
Sash sash = (Sash)area;
switch (sash.SashList.ElementAt(i).SelMeasureType)
{
case MeasureTypes.ABSOLUTE:
{
risultato = CalculateWidthSashGroup(item, sash.SashList.ElementAt(i).dDimension);
break;
}
case MeasureTypes.PROPORTIONAL:
{
//risultato = CalculateWidthSashGroup(item, sash.SashList.ElementAt(i).dDimension);
break;
}
case MeasureTypes.PERCENTAGE:
{
risultato = CalculateWidthSashGroup(item, sash.SashList.ElementAt(i).dDimension * width / 100);
break;
}
}
if (risultato != -1)
return risultato;
}
else
{
risultato = CalculateWidthSashGroup(item, width);
if (risultato != -1)
return risultato;
}
}
return width;
}
/// <summary>
/// Calcolo MCD
/// </summary>
/// <param name="a"></param>
/// <param name="b"></param>
/// <returns></returns>
internal static double CalculateMCD(double a, double b)
{
while (b >= 0.01)
{
double temp = b;
b = a % b;
a = temp;
}
//return Double.Round(a,2);
return a;
}
/// <summary>
/// Metodo per ricalcolare i valori proporzionali a causa della modifica di uno
/// </summary>
/// <returns></returns>
internal double CalculatePropVal(double widthTot)
{
if (m_Parent.SashList.Where(m => m.MeasureType.Equals(MeasureTypes.PROPORTIONAL)).ToList().Count == 0)
{
return 1;
}
List<double> absoluteValue = new List<double>();
foreach (var item in m_Parent.SashList)
{
absoluteValue.Add(item.CalculateAbsoluteValue(widthTot));
}
for (int i = 0; i < m_Parent.SashList.Count; i++)
{
if (!m_Parent.SashList.ElementAt(i).Equals(this) &&
m_Parent.SashList.ElementAt(i).MeasureType.Equals(MeasureTypes.PROPORTIONAL))
{
int nIndex = m_Parent.SashList.IndexOf(this);
if (absoluteValue.ElementAt(nIndex) <= absoluteValue.ElementAt(i))
{
var mcd = CalculateMCD(absoluteValue.ElementAt(nIndex), absoluteValue.ElementAt(i));
m_Parent.SashList.ElementAt(i).m_dDimension = absoluteValue.ElementAt(i) / mcd;
m_dDimension = absoluteValue.ElementAt(nIndex) / mcd;
}
else
{
var mcd = CalculateMCD(absoluteValue.ElementAt(nIndex), absoluteValue.ElementAt(i));
m_Parent.SashList.ElementAt(i).m_dDimension = absoluteValue.ElementAt(i) / mcd;
m_dDimension = absoluteValue.ElementAt(nIndex) / mcd;
}
break;
}
}
return m_dDimension;
}
/// <summary>
/// Metodo per trasformare una dimensione in valore assoluto rispetto alla larghezza totale
/// </summary>
/// <param name="widthTot"> Larghezza totale </param>
/// <returns></returns>
internal double CalculateAbsoluteValue(double widthTot)
{
switch (MeasureType)
{
case MeasureTypes.ABSOLUTE:
{
//return Double.Round(dDimension, 2);
return dDimension;
}
case MeasureTypes.PROPORTIONAL:
{
//return Double.Round(Proportional2AbsolutVal(), 2);
return ProportionalFromAbsoluteVal(widthTot);
}
case MeasureTypes.PERCENTAGE:
{
//return Double.Round((dDimension / 100) * widthTot, 1);
return (dDimension / 100) * widthTot;
}
}
return 0;
}
/// <summary>
/// Metodo per convertire una dimensione da un valore assoluto al suo rispettivo tipo
/// </summary>
/// <param name="absoluteVal"> Valore assoluto </param>
/// <param name="type"> Tipo di misura della dimensione </param>
/// <param name="widthTot"> Larghezza totale </param>
/// <returns></returns>
internal double ConvertIn(double absoluteVal, MeasureTypes type, double widthTot)
{
switch (type)
{
case MeasureTypes.ABSOLUTE:
{
return absoluteVal;
}
case MeasureTypes.PROPORTIONAL:
{
return ProportionalFromAbsoluteVal(widthTot);
}
case MeasureTypes.PERCENTAGE:
{
return (absoluteVal / widthTot) * 100;
}
}
return -1;
}
/// <summary>
/// Metodo per convertire da misura proporzionale a misura assoluta o percentuale
/// </summary>
/// <param name="newType"></param>
/// <returns></returns>
internal double ConvertFromPropVal(MeasureTypes newType, double widthTot)
{
double tot = widthTot;
//Somma misura non proporzionali
double sumNotProp = m_Parent.SashList
.Where(m => m.MeasureType != MeasureTypes.PROPORTIONAL && !m.Equals(this))
.Sum(m => m.CalculateAbsoluteValue(tot));
//Calcolo residuo
double res = tot - sumNotProp;
if (res < 0) res = 0;
//Misure proporzionali
var proportionalList = m_Parent.SashList
.Where(m => m.SelMeasureType == MeasureTypes.PROPORTIONAL)
.ToList();
double sumPesi = proportionalList.Sum(p => p.dDimension);
if (sumPesi == 0) sumPesi = 1;
if (newType.Equals(MeasureTypes.ABSOLUTE))
{
return res / sumPesi * dDimension;
}
else
{
return (res / sumPesi * dDimension) / tot * 100;
}
}
/// <summary>
/// Metodo per trasformare il valore proporzionale in assoluto
/// </summary>
/// <returns></returns>
internal double ProportionalFromAbsoluteVal(double widthTot)
{
double tot = widthTot;
//Somma misura non proporzionali
double sumNotProp = m_Parent.SashList
.Where(m => m.MeasureType != MeasureTypes.PROPORTIONAL)
.Sum(m => m.CalculateAbsoluteValue(tot));
//Calcolo residuo
double res = tot - sumNotProp;
if (res < 0) res = 0;
//Misure proporzionali
var proportionalList = m_Parent.SashList
.Where(m => m.SelMeasureType == MeasureTypes.PROPORTIONAL)
.ToList();
double sumPesi = proportionalList.Sum(p => p.dDimension);
if (sumPesi == 0) sumPesi = 1;
return res / sumPesi * dDimension;
}
internal JsonSashDimension Serialize()
{
JsonSashDimension JsonSashDimension = new JsonSashDimension(OpeningType, m_bHasHandle, m_dDimension, m_nSashId);
JsonSashDimension JsonSashDimension = new JsonSashDimension(OpeningType, MeasureType, m_bHasHandle, m_dDimension, m_nSashId);
foreach (var Joint in JointList)
JsonSashDimension.JointList.Add(Joint.Serialize());
return JsonSashDimension;
}
@@ -406,6 +738,17 @@ namespace WebWindowComplex.Models
m_SelMeasureType = value;
}
internal void SetSelMeasureType(MeasureTypes value)
{
if (m_SelMeasureType != (MeasureTypes)value)
{
MeasureTypes newType = (MeasureTypes)value;
double widthTot = CalculateWidthSashGroup(m_Parent.ParentWindow.AreaList.FirstOrDefault(), m_Parent.ParentWindow.AreaList.FirstOrDefault().DimensionList.Where(x => x.sName == "Width").First().dValue);
m_dDimension = ConvertDimension(m_SelMeasureType, newType, widthTot);
m_SelMeasureType = (MeasureTypes)value;
}
}
#endregion Internal Methods
#region Private Fields
@@ -447,7 +790,7 @@ namespace WebWindowComplex.Models
private List<IdNameStruct> m_MeasureTypeList = new List<IdNameStruct>
{
new IdNameStruct((int)MeasureTypes.ABSOLUT, "Absolut"),
new IdNameStruct((int)MeasureTypes.ABSOLUTE, "Absolute"),
new IdNameStruct((int)MeasureTypes.PROPORTIONAL, "Proportional"),
new IdNameStruct((int)MeasureTypes.PERCENTAGE, "Percentage"),
};
@@ -455,47 +798,13 @@ namespace WebWindowComplex.Models
// reference
private Sash m_Parent;
private List<Joint> m_JointList = new List<Joint>();
private Openings m_SelOpeningType;
private MeasureTypes m_SelMeasureType;
#endregion Private Fields
#region Private Methods
/// <summary>
/// Recupero della larghezza del frame
/// </summary>
/// <returns></returns>
private double GetWidth()
{
double width = 0;
int indexSash = 0;
if (m_Parent.ParentArea != null && m_Parent.ParentArea.ParentArea != null && m_Parent.ParentArea.ParentArea is Split)
{
Split splitParent = (Split)m_Parent.ParentArea.ParentArea;
if(splitParent.SplitVertList.Count > 0)
{
for(int i = 0; i < splitParent.AreaList.Count; i++)
{
if (splitParent.AreaList[i].AreaList[0].Equals(this))
{
indexSash = i;
}
}
}
//int indexSash = splitParent.AreaList.Where(x => x.AreaList[0].Equals(this));
}
else
{
Frame a = m_Parent.ParentWindow.AreaList[0];
FrameDimension? fd = a.DimensionList.Where(x => x.sName == "Width").SingleOrDefault();
width = fd.dValue;
}
return width;
}
#endregion Private Methods
}
}
+183 -145
View File
@@ -20,13 +20,13 @@ namespace WebWindowComplex.Models
#region Public Properties
public bool bIsPercentage
{
get
{
return m_bIsPercentage;
}
}
//public bool bIsPercentage
//{
// get
// {
// return m_bIsPercentage;
// }
//}
public bool bSplitStartVert
{
@@ -37,7 +37,6 @@ namespace WebWindowComplex.Models
set
{
m_bSplitStartVert = value;
m_ParentWindow.OnUpdatePreview(m_ParentWindow.sSerialized());
}
}
@@ -49,81 +48,87 @@ namespace WebWindowComplex.Models
}
set
{
if (value == 0)
if(value >= 0 && value < 6)
{
for (var SplitIndex = m_SplitHorizList.Count - 1; SplitIndex >= value; SplitIndex += -1)
m_SplitHorizList.RemoveAt(SplitIndex);
if (nSplitQtyVert == 0)
if (value == 0)
{
ParentArea.AreaList.Remove(this);
Fill newFill = Fill.CreateFill(ParentArea, FillTypes.GLASS);
newFill.SetAreaType(AreaTypes.FILL);
ParentArea.AreaList.Add(newFill);
}
else
SetSplitShape(SplitShapes.VERTICAL);
}
else
{
// Ricalcolo dimensioni aggiungendo split
if (value > m_SplitHorizList.Count - 1)
{
// recupero larghezza ultimo
double dLastDimension = 100;
double dNewDimension = 100;
if (m_SplitHorizList.Count > 0)
for (var SplitIndex = m_SplitHorizList.Count - 1; SplitIndex >= value; SplitIndex += -1)
m_SplitHorizList.RemoveAt(SplitIndex);
if (nSplitQtyVert == 0)
{
dLastDimension = m_SplitHorizList[m_SplitHorizList.Count - 1].dDimension;
dNewDimension = dLastDimension / (value + 1 - nSplitQtyHoriz);
m_SplitHorizList[m_SplitHorizList.Count - 1].SetDimension(dNewDimension);
ParentArea.AreaList.Remove(this);
Fill newFill = Fill.CreateFill(ParentArea, FillTypes.GLASS);
newFill.SetAreaType(AreaTypes.FILL);
ParentArea.AreaList.Add(newFill);
}
else
dNewDimension = dLastDimension / (value + 1 - nSplitQtyHoriz);
// aggiungo area Split di default
for (var SplitIndex = m_SplitHorizList.Count; SplitIndex <= value; SplitIndex++)
m_SplitHorizList.Add(new SplitDimension(dNewDimension, true, this, false));
SetSplitShape(SplitShapes.VERTICAL);
}
// Ricalcolo dimensioni rimuovendo split
else
{
double dLastDimension = 0;
for (var SplitIndex = m_SplitHorizList.Count - 1; SplitIndex >= value + 1; SplitIndex += -1)
double heightTot = CalculateHeightArea(ParentWindow.AreaList.First(), HeightFrame());
// Ricalcolo dimensioni aggiungendo split
if (value > m_SplitHorizList.Count - 1)
{
dLastDimension += m_SplitHorizList[SplitIndex].dDimension;
m_SplitHorizList.RemoveAt(SplitIndex);
// recupero larghezza ultimo
double dLastDimension = heightTot;
double dNewDimension = heightTot;
if (m_SplitHorizList.Count > 0)
{
dLastDimension = m_SplitHorizList[m_SplitHorizList.Count - 1].dDimension;
dNewDimension = dLastDimension / (value + 1 - nSplitQtyHoriz);
if (m_SplitHorizList[m_SplitHorizList.Count - 1].MeasureType.Equals(MeasureTypes.PROPORTIONAL))
dNewDimension = 1;
m_SplitHorizList[m_SplitHorizList.Count - 1].SetDimension(dNewDimension);
}
else
dNewDimension = dLastDimension / (value + 1 - nSplitQtyHoriz);
// aggiungo area Split di default
for (var SplitIndex = m_SplitHorizList.Count; SplitIndex <= value; SplitIndex++)
m_SplitHorizList.Add(new SplitDimension(dNewDimension, m_SplitHorizList[m_SplitHorizList.Count - 1].MeasureType, true, this, false));
}
dLastDimension += m_SplitHorizList[m_SplitHorizList.Count - 1].dDimension;
m_SplitHorizList[m_SplitHorizList.Count - 1].SetDimension(dLastDimension);
}
// Controllo quanti split verticali ci sono
int nVert = m_SplitVertList.Count > 0 ? m_SplitVertList.Count : 1;
// Se aggiungo split devo aggiungere vetro nell'area splitted aggiunta
for (var SplitIndex = AreaList.Count; SplitIndex <= (m_SplitHorizList.Count * nVert) - 1; SplitIndex++)
{
AreaList.Add(Splitted.CreateSplitted(this));
Fill newFill = Fill.CreateFill(AreaList[SplitIndex], FillTypes.GLASS);
newFill.SetAreaType(AreaTypes.FILL);
AreaList[AreaList.Count - 1].AreaList.Add(newFill);
}
// Se ho più di uno split, elimino l'ultimo
if (AreaList.Count > 2)
{
int nAreaList = AreaList.Count - 1;
for (var SplitIndex = (m_SplitHorizList.Count * nVert); SplitIndex <= nAreaList; SplitIndex++)
// Ricalcolo dimensioni rimuovendo split
else
{
AreaList.Remove(AreaList[AreaList.Count - 1]);
double dLastDimension = 0;
for (var SplitIndex = m_SplitHorizList.Count - 1; SplitIndex >= value + 1; SplitIndex += -1)
{
dLastDimension += m_SplitHorizList[SplitIndex].dDimension;
m_SplitHorizList.RemoveAt(SplitIndex);
}
dLastDimension += m_SplitHorizList[m_SplitHorizList.Count - 1].dDimension;
m_SplitHorizList[m_SplitHorizList.Count - 1].SetDimension(dLastDimension);
}
// Controllo quanti split verticali ci sono
int nVert = m_SplitVertList.Count > 0 ? m_SplitVertList.Count : 1;
// Se aggiungo split devo aggiungere vetro nell'area splitted aggiunta
for (var SplitIndex = AreaList.Count; SplitIndex <= (m_SplitHorizList.Count * nVert) - 1; SplitIndex++)
{
AreaList.Add(Splitted.CreateSplitted(this));
Fill newFill = Fill.CreateFill(AreaList[SplitIndex], FillTypes.GLASS);
newFill.SetAreaType(AreaTypes.FILL);
AreaList[AreaList.Count - 1].AreaList.Add(newFill);
}
// Se ho più di uno split, elimino l'ultimo
if (AreaList.Count > 2)
{
int nAreaList = AreaList.Count - 1;
for (var SplitIndex = (m_SplitHorizList.Count * nVert); SplitIndex <= nAreaList; SplitIndex++)
{
AreaList.Remove(AreaList[AreaList.Count - 1]);
}
}
// Se elimino l'unico split presente
else
{
Splitted s = (Splitted)AreaList[0];
s.SetParentArea(ParentArea);
ParentArea.AreaList.Add(s);
ParentArea.AreaList.Remove(this);
}
}
// Se elimino l'unico split presente
else
{
Splitted s = (Splitted)AreaList[0];
s.SetParentArea(ParentArea);
ParentArea.AreaList.Add(s);
ParentArea.AreaList.Remove(this);
}
//m_ParentWindow.OnUpdatePreview(m_ParentWindow.sSerialized());
}
m_ParentWindow.OnUpdatePreview(m_ParentWindow.sSerialized());
}
}
@@ -135,86 +140,91 @@ namespace WebWindowComplex.Models
}
set
{
if (value == 0)
if (value >= 0 && value < 6)
{
for (var SplitIndex = m_SplitVertList.Count - 1; SplitIndex >= value; SplitIndex += -1)
m_SplitVertList.RemoveAt(SplitIndex);
if (nSplitQtyHoriz == 0)
if (value == 0)
{
ParentArea.AreaList.Remove(this);
Fill newFill = Fill.CreateFill(ParentArea, FillTypes.GLASS);
newFill.SetAreaType(AreaTypes.FILL);
ParentArea.AreaList.Add(newFill);
}
else
SetSplitShape(SplitShapes.HORIZONTAL);
}
else
{
// Ricalcolo dimensioni aggiungendo split
if (value > m_SplitVertList.Count - 1)
{
// recupero larghezza ultimo
double dLastDimension = 100;
double dNewDimension = 100;
if (m_SplitVertList.Count > 0)
for (var SplitIndex = m_SplitVertList.Count - 1; SplitIndex >= value; SplitIndex += -1)
m_SplitVertList.RemoveAt(SplitIndex);
if (nSplitQtyHoriz == 0)
{
dLastDimension = m_SplitVertList[m_SplitVertList.Count - 1].dDimension;
dNewDimension = dLastDimension / (value + 1 - nSplitQtyVert);
m_SplitVertList[m_SplitVertList.Count - 1].SetDimension(dNewDimension);
ParentArea.AreaList.Remove(this);
Fill newFill = Fill.CreateFill(ParentArea, FillTypes.GLASS);
newFill.SetAreaType(AreaTypes.FILL);
ParentArea.AreaList.Add(newFill);
}
else
dNewDimension = dLastDimension / (value + 1 - nSplitQtyVert);
// aggiungo area Split di default
for (var SplitIndex = m_SplitVertList.Count; SplitIndex <= value; SplitIndex++)
m_SplitVertList.Add(new SplitDimension(dNewDimension, true, this, true));
SetSplitShape(SplitShapes.HORIZONTAL);
}
else if (value == 0)
{
m_SplitVertList.RemoveAt(1);
m_SplitVertList.RemoveAt(0);
}
// Ricalcolo dimensioni rimuovendo split
else
{
double dLastDimension = 0;
for (var SplitIndex = m_SplitVertList.Count - 1; SplitIndex >= value + 1; SplitIndex += -1)
double widthTot = CalculateWidthArea(ParentWindow.AreaList.First(), ParentWindow.AreaList.FirstOrDefault().DimensionList.Where(x => x.sName == "Width").First().dValue);
// Ricalcolo dimensioni aggiungendo split
if (value > m_SplitVertList.Count - 1)
{
dLastDimension += m_SplitVertList[SplitIndex].dDimension;
m_SplitVertList.RemoveAt(SplitIndex);
// recupero larghezza ultimo
double dLastDimension = widthTot;
double dNewDimension = widthTot;
if (m_SplitVertList.Count > 0)
{
dLastDimension = m_SplitVertList[m_SplitVertList.Count - 1].dDimension;
dNewDimension = dLastDimension / (value + 1 - nSplitQtyVert);
if (m_SplitVertList[m_SplitVertList.Count - 1].MeasureType.Equals(MeasureTypes.PROPORTIONAL))
dNewDimension = 1;
m_SplitVertList[m_SplitVertList.Count - 1].SetDimension(dNewDimension);
}
else
dNewDimension = dLastDimension / (value + 1 - nSplitQtyVert);
// aggiungo area Split di default
for (var SplitIndex = m_SplitVertList.Count; SplitIndex <= value; SplitIndex++)
m_SplitVertList.Add(new SplitDimension(dNewDimension, m_SplitVertList[m_SplitVertList.Count - 1].MeasureType, true, this, true));
}
dLastDimension += m_SplitVertList[m_SplitVertList.Count - 1].dDimension;
m_SplitVertList[m_SplitVertList.Count - 1].SetDimension(dLastDimension);
}
// Controllo quanti split orizzontali ci sono
int nHoriz = m_SplitHorizList.Count > 0 ? m_SplitHorizList.Count : 1;
// Se aggiungo split devo aggiungere vetro nell'area splitted aggiunta
for (var SplitIndex = AreaList.Count; SplitIndex <= (m_SplitVertList.Count * nHoriz) - 1; SplitIndex++)
{
AreaList.Add(Splitted.CreateSplitted(this));
Fill newFill = Fill.CreateFill(AreaList[SplitIndex], FillTypes.GLASS);
newFill.SetAreaType(AreaTypes.FILL);
AreaList[AreaList.Count - 1].AreaList.Add(newFill);
}
// Se ho più di uno split, elimino l'ultimo
if (AreaList.Count > 2)
{
int nAreaList = AreaList.Count - 1;
for (var SplitIndex = (m_SplitVertList.Count * nHoriz); SplitIndex <= nAreaList; SplitIndex++)
else if (value == 0)
{
AreaList.Remove(AreaList[AreaList.Count - 1]);
m_SplitVertList.RemoveAt(1);
m_SplitVertList.RemoveAt(0);
}
// Ricalcolo dimensioni rimuovendo split
else
{
double dLastDimension = 0;
for (var SplitIndex = m_SplitVertList.Count - 1; SplitIndex >= value + 1; SplitIndex += -1)
{
dLastDimension += m_SplitVertList[SplitIndex].dDimension;
m_SplitVertList.RemoveAt(SplitIndex);
}
dLastDimension += m_SplitVertList[m_SplitVertList.Count - 1].dDimension;
m_SplitVertList[m_SplitVertList.Count - 1].SetDimension(dLastDimension);
}
// Controllo quanti split orizzontali ci sono
int nHoriz = m_SplitHorizList.Count > 0 ? m_SplitHorizList.Count : 1;
// Se aggiungo split devo aggiungere vetro nell'area splitted aggiunta
for (var SplitIndex = AreaList.Count; SplitIndex <= (m_SplitVertList.Count * nHoriz) - 1; SplitIndex++)
{
AreaList.Add(Splitted.CreateSplitted(this));
Fill newFill = Fill.CreateFill(AreaList[SplitIndex], FillTypes.GLASS);
newFill.SetAreaType(AreaTypes.FILL);
AreaList[AreaList.Count - 1].AreaList.Add(newFill);
}
// Se ho più di uno split, elimino l'ultimo
if (AreaList.Count > 2)
{
int nAreaList = AreaList.Count - 1;
for (var SplitIndex = (m_SplitVertList.Count * nHoriz); SplitIndex <= nAreaList; SplitIndex++)
{
AreaList.Remove(AreaList[AreaList.Count - 1]);
}
}
// Se elimino l'unico split presente
else
{
Splitted s = (Splitted)AreaList[0];
s.SetParentArea(ParentArea);
ParentArea.AreaList.Add(s);
ParentArea.AreaList.Remove(this);
}
}
// Se elimino l'unico split presente
else
{
Splitted s = (Splitted)AreaList[0];
s.SetParentArea(ParentArea);
ParentArea.AreaList.Add(s);
ParentArea.AreaList.Remove(this);
}
}
m_ParentWindow.OnUpdatePreview(m_ParentWindow.sSerialized());
}
}
@@ -222,12 +232,10 @@ namespace WebWindowComplex.Models
{
get
{
//return IdNameStruct.IndFromId((int)m_SelSplitShape, m_SplitShapeList);
return (int)m_SelSplitShape;
}
set
{
//m_SelSplitShape = (SplitShapes)IdNameStruct.IdFromInd(value, m_SplitShapeList);
m_SelSplitShape = (SplitShapes)value;
// Cancello elementi nello split e azzero quantità orizzontale e verticale
AreaList.Clear();
@@ -262,7 +270,6 @@ namespace WebWindowComplex.Models
newFill.SetAreaType(AreaTypes.FILL);
AreaList[SplitIndex].AreaList.Add(newFill);
}
m_ParentWindow.OnUpdatePreview(m_ParentWindow.sSerialized());
}
}
@@ -320,12 +327,16 @@ namespace WebWindowComplex.Models
AddCounterGroup();
newSplit.SetGroupId(nCounterGroup);
newSplit.SetSplitStartVert(bSplitStartVert);
newSplit.SetSplitQtyVert(nSplitQtyVert);
for (int i = 0; i < SplitVertList.Count; i++)
newSplit.SplitVertList.ElementAt(i).SetDimension(SplitVertList.ElementAt(i).dDimension);
newSplit.SetSplitQtyHoriz(nSplitQtyHoriz);
newSplit.SplitVertList.Add(SplitVertList[i].Copy());
for (int i = 0; i < SplitHorizList.Count; i++)
newSplit.SplitHorizList.ElementAt(i).SetDimension(SplitHorizList.ElementAt(i).dDimension);
newSplit.SplitHorizList.Add(SplitHorizList[i].Copy());
//newSplit.SetSplitQtyVert(nSplitQtyVert);
//for (int i = 0; i < SplitVertList.Count; i++)
// newSplit.SplitVertList.ElementAt(i).SetDimension(SplitVertList.ElementAt(i).dDimension);
//newSplit.SetSplitQtyHoriz(nSplitQtyHoriz);
//for (int i = 0; i < SplitHorizList.Count; i++)
// newSplit.SplitHorizList.ElementAt(i).SetDimension(SplitHorizList.ElementAt(i).dDimension);
newSplit.SetSplitShape(SelSplitShape);
newSplit.SetAreaType(AreaType);
foreach (var item in AreaList)
@@ -342,7 +353,7 @@ namespace WebWindowComplex.Models
Fill newFill = Fill.CreateFill(ParentArea, FillTypes.GLASS);
newFill.SetAreaType(AreaTypes.FILL);
ParentArea.AreaList.Add(newFill);
m_ParentWindow.OnUpdatePreview(m_ParentWindow.sSerialized());
//m_ParentWindow.OnUpdatePreview(m_ParentWindow.sSerialized());
}
#endregion Public Methods
@@ -405,7 +416,7 @@ namespace WebWindowComplex.Models
dNewDimension = dLastDimension / (QtyHoriz + 1 - nSplitQtyHoriz);
// aggiungo area Split di default
for (var SplitIndex = m_SplitHorizList.Count; SplitIndex <= QtyHoriz; SplitIndex++)
m_SplitHorizList.Add(new SplitDimension(dNewDimension, true, this, false));
m_SplitHorizList.Add(new SplitDimension(dNewDimension, MeasureTypes.PERCENTAGE, true, this, false));
}
else if (QtyHoriz < m_SplitHorizList.Count)
{
@@ -431,7 +442,7 @@ namespace WebWindowComplex.Models
dNewDimension = dLastDimension / (QtyVert + 1 - nSplitQtyVert);
// aggiungo area Split di default
for (var SplitIndex = m_SplitVertList.Count; SplitIndex <= QtyVert; SplitIndex++)
m_SplitVertList.Add(new SplitDimension(dNewDimension, true, this, true));
m_SplitVertList.Add(new SplitDimension(dNewDimension, MeasureTypes.PERCENTAGE, true, this, true));
}
else if (QtyVert < m_SplitVertList.Count)
{
@@ -450,6 +461,31 @@ namespace WebWindowComplex.Models
m_bSplitStartVert = SplitStartVert;
}
internal double HeightFrame()
{
switch (ParentWindow.AreaList.First().SelShapeIndex)
{
case (int)Shapes.RECTANGLE:
case (int)Shapes.TRIANGLE:
case (int)Shapes.ARC_FULL:
{
return ParentWindow.AreaList.FirstOrDefault().DimensionList.Where(x => x.sName == "Height").First().dValue;
}
case (int)Shapes.RIGHTCHAMFER:
{
return ParentWindow.AreaList.FirstOrDefault().DimensionList.Where(x => x.sName == "Left Height").First().dValue;
}
case (int)Shapes.LEFTCHAMFER:
{
return ParentWindow.AreaList.FirstOrDefault().DimensionList.Where(x => x.sName == "Right Height").First().dValue;
}
default:
{
return ParentWindow.AreaList.FirstOrDefault().DimensionList.Where(x => x.sName == "Full Height").First().dValue;
}
}
}
#endregion Internal Methods
#region Private Fields
@@ -472,6 +508,8 @@ namespace WebWindowComplex.Models
private List<SplitDimension> m_SplitVertList = new List<SplitDimension>();
//private double m_Width = 0;
#endregion Private Fields
}
}
+700 -65
View File
@@ -4,6 +4,7 @@ using System.Linq;
using System.Text;
using System.Threading.Tasks;
using WebWindowComplex.Json;
using static WebWindowComplex.Json.WindowConst;
namespace WebWindowComplex.Models
{
@@ -11,9 +12,10 @@ namespace WebWindowComplex.Models
{
#region Public Constructors
public SplitDimension(double dDimension, bool bIsRelative, Split Parent, bool IsVertList)
public SplitDimension(double dDimension, MeasureTypes MeasureType, bool bIsRelative, Split Parent, bool IsVertList)
{
m_dDimension = dDimension;
m_SelMeasureType = MeasureType;
m_bIsRelative = bIsRelative;
m_Parent = Parent;
m_bIsVertListDim = IsVertList;
@@ -47,80 +49,243 @@ namespace WebWindowComplex.Models
}
set
{
// Controllo che il valore inserito sia compreso tra 0 e 100
if (value > 0 && value < 100)
double dimensionTot = 0;
List<SplitDimension> dimensions = null;
if (bIsVertListDim)
{
// se sono in percentuale
if (m_bIsRelative)
{
List<SplitDimension> RelativeDimList = new List<SplitDimension>();
if (bIsVertListDim)
RelativeDimList = m_Parent.SplitVertList.Where(x => x.bIsRelative).ToList();
else
RelativeDimList = m_Parent.SplitHorizList.Where(x => x.bIsRelative).ToList();
// verifico se ci sono assoluti
//List<SplitDimension> RelativeDimList = m_Parent.SplitPositionList.Where(x => x.bIsRelative).ToList();
if (RelativeDimList.Count > 0)
dimensions = m_Parent.SplitVertList;
dimensionTot = CalculateWidthSplitGroup(m_Parent.ParentWindow.AreaList.FirstOrDefault(), m_Parent.ParentWindow.AreaList.FirstOrDefault().DimensionList.Where(x => x.sName == "Width").First().dValue);
}
else
{
dimensions = m_Parent.SplitHorizList;
dimensionTot = CalculateHeightSplitGroup(m_Parent.ParentWindow.AreaList.FirstOrDefault(), HeightTot());
}
double valMinAbsolute = 100;
double valMaxAbsolute = dimensionTot - valMinAbsolute * (dimensions.Count - 1);
bool valueAccept = false;
switch (MeasureType)
{
case MeasureTypes.ABSOLUTE:
{
if (m_Parent.bIsPercentage)
valueAccept = (value < valMaxAbsolute && value > valMinAbsolute) ? true : false;
break;
}
case MeasureTypes.PROPORTIONAL:
{
valMaxAbsolute = 20;
valueAccept = (value >= 1) ? true : false;
break;
}
case MeasureTypes.PERCENTAGE:
{
valMaxAbsolute = valMaxAbsolute / dimensionTot * 100;
valMinAbsolute = valMinAbsolute / dimensionTot * 100;
valueAccept = (value < valMaxAbsolute && value > valMinAbsolute) ? true : false;
break;
}
}
if (valueAccept)
{
List<double> absoluteValList = new List<double>();
foreach (var item in dimensions)
{
absoluteValList.Add(item.CalculateAbsoluteValue(dimensionTot, dimensions));
}
int nIndex = dimensions.IndexOf(this);
int proportionalCount = dimensions.Where(x => x.MeasureType.Equals(MeasureTypes.PROPORTIONAL)).ToList().Count;
int percentageCount = dimensions.Where(x => x.MeasureType.Equals(MeasureTypes.PERCENTAGE)).ToList().Count;
// Le dimensioni sono solo in proporzionale
if (proportionalCount == absoluteValList.Count)
{
m_dDimension = value;
}
// Le dimensioni sono solo in percentuale
else if (percentageCount == dimensions.Count)
{
if (value < dDimension)
{
// L'anta modificata non è l'ultima
if (nIndex < dimensions.Count - 1)
dimensions[nIndex + 1].SetDimension(dimensions[nIndex + 1].dDimension + (m_dDimension - value));
else if (dimensions.Count > 1)
dimensions[nIndex - 1].SetDimension(dimensions[nIndex - 1].dDimension + (m_dDimension - value));
else
{
int nIndex = RelativeDimList.IndexOf(this);
if (value < m_dDimension)
m_dDimension = 100;
return;
}
}
else
{
double dRes = value;
// se non ultima anta
if (nIndex < dimensions.Count - 1)
{
for (var nInd = 0; nInd <= nIndex - 1; nInd++)
dRes += dimensions[nInd].dDimension;
dRes = (100 - dRes) / (dimensions.Count - nIndex - 1);
for (var Ind = nIndex + 1; Ind <= dimensions.Count - 1; Ind++)
dimensions[Ind].SetDimension(dRes);
}
// se ultima anta
else if (dimensions.Count > 1)
{
if (dimensions.Count > 2)
{
if (nIndex < RelativeDimList.Count - 1)
RelativeDimList[nIndex + 1].SetDimension(RelativeDimList[nIndex + 1].dDimension + (m_dDimension - value));
else if (RelativeDimList.Count > 1)
RelativeDimList[nIndex - 1].SetDimension(RelativeDimList[nIndex - 1].dDimension + (m_dDimension - value));
else
{
m_dDimension = 100;
return;
}
}
else
{
double dRes = value;
if (nIndex < RelativeDimList.Count - 1)
{
for (var nInd = 0; nInd <= nIndex - 1; nInd++)
dRes += RelativeDimList[nInd].dDimension;
dRes = (100 - dRes) / (RelativeDimList.Count - nIndex - 1);
if (dRes != 0)
{
for (var Ind = nIndex + 1; Ind <= RelativeDimList.Count - 1; Ind++)
RelativeDimList[Ind].SetDimension(dRes);
}
else
return;
}
else if (RelativeDimList.Count > 1)
{
if (RelativeDimList.Count > 2)
{
for (var Ind = 0; Ind <= nIndex - 2; Ind++)
dRes += RelativeDimList[Ind].dDimension;
}
dRes = (100 - dRes);
if (dRes != 0)
RelativeDimList[nIndex - 1].SetDimension(dRes);
else
return;
}
else
{
m_dDimension = 100;
return;
}
for (var Ind = 0; Ind <= nIndex - 2; Ind++)
dRes += dimensions[Ind].dDimension;
}
dRes = (100 - dRes);
dimensions[nIndex - 1].SetDimension(dRes);
}
else
{
m_dDimension = 100;
return;
}
}
m_dDimension = value;
}
m_dDimension = value;
m_Parent.ParentWindow.OnUpdatePreview(m_Parent.ParentWindow.sSerialized());
// Le dimensioni sono miste o solo in assoluto
else
{
double valueInAbsolute = 0;
switch (MeasureType)
{
case MeasureTypes.ABSOLUTE:
{
valueInAbsolute = value;
break;
}
case MeasureTypes.PROPORTIONAL:
{
var pesi = value + dimensions
.Where(x => x.MeasureType.Equals(MeasureTypes.PROPORTIONAL) && !x.Equals(this))
.Sum(x => x.m_dDimension);
valueInAbsolute = dimensionTot / pesi * value;
break;
}
case MeasureTypes.PERCENTAGE:
{
valueInAbsolute = (value / 100) * dimensionTot;
break;
}
}
if (value < dDimension)
{
// L'anta modificata non è l'ultima
if (nIndex < absoluteValList.Count - 1)
{
absoluteValList[nIndex + 1] = absoluteValList[nIndex + 1] + (absoluteValList[nIndex] - valueInAbsolute);
absoluteValList[nIndex] = valueInAbsolute;
}
// L'anta modificata è l'ultima
else if (dimensions.Count > 1)
{
absoluteValList[nIndex - 1] = absoluteValList[nIndex - 1] + (absoluteValList[nIndex] - valueInAbsolute);
absoluteValList[nIndex] = valueInAbsolute;
}
}
else
{
// L'anta modificata non è l'ultima
if (nIndex < absoluteValList.Count - 1)
{
absoluteValList[nIndex + 1] = absoluteValList[nIndex + 1] - (valueInAbsolute - absoluteValList[nIndex]);
absoluteValList[nIndex] = valueInAbsolute;
}
// L'anta modificata è l'ultima
else if (dimensions.Count > 1)
{
absoluteValList[nIndex - 1] = absoluteValList[nIndex - 1] - (valueInAbsolute - absoluteValList[nIndex]);
absoluteValList[nIndex] = valueInAbsolute;
}
}
if (MeasureType.Equals(MeasureTypes.PROPORTIONAL))
m_dDimension = value;
for (int i = 0; i < absoluteValList.Count; i++)
{
var item = dimensions.ElementAt(i);
item.SetDimension(ConvertIn(absoluteValList[i], (MeasureTypes)item.SelMeasureTypeIndex, dimensionTot, dimensions));
}
}
//m_Parent.ParentWindow.OnUpdatePreview(m_Parent.ParentWindow.sSerialized());
}
//// Controllo che il valore inserito sia compreso tra 0 e 100
//if (value > 0 && value < 100)
//{
// // se sono in percentuale
// if (m_bIsRelative)
// {
// List<SplitDimension> RelativeDimList = new List<SplitDimension>();
// if (bIsVertListDim)
// RelativeDimList = m_Parent.SplitVertList.Where(x => x.bIsRelative).ToList();
// else
// RelativeDimList = m_Parent.SplitHorizList.Where(x => x.bIsRelative).ToList();
// // verifico se ci sono assoluti
// //List<SplitDimension> RelativeDimList = m_Parent.SplitPositionList.Where(x => x.bIsRelative).ToList();
// if (RelativeDimList.Count > 0)
// {
// if (m_Parent.bIsPercentage)
// {
// int nIndex = RelativeDimList.IndexOf(this);
// if (value < m_dDimension)
// {
// if (nIndex < RelativeDimList.Count - 1)
// RelativeDimList[nIndex + 1].SetDimension(RelativeDimList[nIndex + 1].dDimension + (m_dDimension - value));
// else if (RelativeDimList.Count > 1)
// RelativeDimList[nIndex - 1].SetDimension(RelativeDimList[nIndex - 1].dDimension + (m_dDimension - value));
// else
// {
// m_dDimension = 100;
// return;
// }
// }
// else
// {
// double dRes = value;
// if (nIndex < RelativeDimList.Count - 1)
// {
// for (var nInd = 0; nInd <= nIndex - 1; nInd++)
// dRes += RelativeDimList[nInd].dDimension;
// dRes = (100 - dRes) / (RelativeDimList.Count - nIndex - 1);
// if (dRes != 0)
// {
// for (var Ind = nIndex + 1; Ind <= RelativeDimList.Count - 1; Ind++)
// RelativeDimList[Ind].SetDimension(dRes);
// }
// else
// return;
// }
// else if (RelativeDimList.Count > 1)
// {
// if (RelativeDimList.Count > 2)
// {
// for (var Ind = 0; Ind <= nIndex - 2; Ind++)
// dRes += RelativeDimList[Ind].dDimension;
// }
// dRes = (100 - dRes);
// if (dRes != 0)
// RelativeDimList[nIndex - 1].SetDimension(dRes);
// else
// return;
// }
// else
// {
// m_dDimension = 100;
// return;
// }
// }
// }
// else
// {
// }
// }
// }
// m_dDimension = value;
// m_Parent.ParentWindow.OnUpdatePreview(m_Parent.ParentWindow.sSerialized());
//}
}
}
@@ -136,13 +301,122 @@ namespace WebWindowComplex.Models
}
}
public MeasureTypes MeasureType
{
get
{
return m_SelMeasureType;
}
}
public List<IdNameStruct> MeasureTypeList
{
get
{
return m_MeasureTypeList;
}
}
public MeasureTypes SelMeasureType
{
get
{
return m_SelMeasureType;
}
set
{
m_SelMeasureType = value;
}
}
public int SelMeasureTypeIndex
{
get
{
return (int)m_SelMeasureType;
}
set
{
if (m_SelMeasureType != (MeasureTypes)value)
{
MeasureTypes newType = (MeasureTypes)value;
List<SplitDimension> splitList = null;
double tot = 0;
if (bIsVertListDim)
{
splitList = m_Parent.SplitVertList;
tot = CalculateWidthSplitGroup(m_Parent.ParentWindow.AreaList.FirstOrDefault(), m_Parent.ParentWindow.AreaList.FirstOrDefault().DimensionList.Where(x => x.sName == "Width").First().dValue);
}
else
{
splitList = m_Parent.SplitHorizList;
tot = CalculateHeightSplitGroup(m_Parent.ParentWindow.AreaList.FirstOrDefault(), HeightTot());
}
m_dDimension = ConvertDimension(m_SelMeasureType, newType, tot, splitList);
m_SelMeasureType = (MeasureTypes)value;
//m_Parent.ParentWindow.OnUpdatePreview(m_Parent.ParentWindow.sSerialized());
}
}
}
#endregion Public Properties
#region Public Methods
/// <summary>
/// Metodo per convertire la dimensione dal vecchio tipo al nuovo tipo
/// </summary>
/// <param name="oldType"> Vecchio tipo </param>
/// <param name="newType"> Nuovo tipo </param>
/// <returns></returns>
public double ConvertDimension(MeasureTypes oldType, MeasureTypes newType, double widthTot, List<SplitDimension> splitList)
{
switch (oldType)
{
case MeasureTypes.ABSOLUTE:
{
if (newType.Equals(MeasureTypes.PERCENTAGE))
{
//return Double.Round((m_dDimension / m_Parent.Width) * 100, 1);
return (m_dDimension / widthTot) * 100;
}
else
{
return CalculatePropVal(widthTot, splitList);
}
}
case MeasureTypes.PROPORTIONAL:
{
if (newType.Equals(MeasureTypes.ABSOLUTE))
{
//return Double.Round(ConvertFromPropVal(newType), 2);
return ConvertFromPropVal(newType, widthTot, splitList);
}
else
{
//return Double.Round(ConvertFromPropVal(newType), 1);
return ConvertFromPropVal(newType, widthTot, splitList);
}
}
case MeasureTypes.PERCENTAGE:
{
if (newType.Equals(MeasureTypes.ABSOLUTE))
{
//return Double.Round((m_dDimension * m_Parent.Width) / 100, 2);
return (m_dDimension * widthTot) / 100;
}
else
{
return CalculatePropVal(widthTot, splitList);
}
}
}
return -1;
}
public SplitDimension Copy()
{
SplitDimension newSplitDim = new SplitDimension(dDimension, bIsRelative, m_Parent, bIsVertListDim);
SplitDimension newSplitDim = new SplitDimension(dDimension, MeasureType, bIsRelative, m_Parent, bIsVertListDim);
return newSplitDim;
}
@@ -150,9 +424,310 @@ namespace WebWindowComplex.Models
#region Internal Methods
/// <summary>
/// Metodo per calcolare larghezza intero split group
/// </summary>
/// <param name="area"> area di partenza </param>
/// <param name="width"> larghezza di partenza </param>
/// <returns></returns>
internal double CalculateWidthSplitGroup(Area area, double width)
{
for (int i = 0; i < area.AreaList.Count; i++)
{
double risultato = -1;
if (area.Equals(m_Parent))
return width;
Area item = area.AreaList[i];
if (area is Split)
{
Split split = (Split)area;
if(split.SplitVertList.Count > 0)
{
switch (split.SplitVertList.ElementAt(i).SelMeasureType)
{
case MeasureTypes.ABSOLUTE:
{
risultato = CalculateWidthSplitGroup(item, split.SplitVertList.ElementAt(i).dDimension);
break;
}
case MeasureTypes.PROPORTIONAL:
{
//risultato = CalculateWidthSplitGroup(item, split.SplitVertList.ElementAt(i).dDimension);
break;
}
case MeasureTypes.PERCENTAGE:
{
risultato = CalculateWidthSplitGroup(item, split.SplitVertList.ElementAt(i).dDimension * width / 100);
break;
}
}
if (risultato != -1)
return risultato;
}
else
{
risultato = CalculateWidthSplitGroup(item, width);
}
}
else if (area is Sash)
{
Sash sash = (Sash)area;
switch (sash.SashList.ElementAt(i).SelMeasureType)
{
case MeasureTypes.ABSOLUTE:
{
risultato = CalculateWidthSplitGroup(item, sash.SashList.ElementAt(i).dDimension);
break;
}
case MeasureTypes.PROPORTIONAL:
{
//risultato = CalculateWidthSplitGroup(item, sash.SashList.ElementAt(i).dDimension);
break;
}
case MeasureTypes.PERCENTAGE:
{
risultato = CalculateWidthSplitGroup(item, sash.SashList.ElementAt(i).dDimension * width / 100);
break;
}
}
if (risultato != -1)
return risultato;
}
else
{
risultato = CalculateWidthSplitGroup(item, width);
if (risultato != -1)
return risultato;
}
}
return width;
}
/// <summary>
/// Metodo per calcolare altezza intero split group
/// </summary>
/// <param name="area"> area di partenza </param>
/// <param name="height"> altezza di partenza </param>
/// <returns></returns>
internal double CalculateHeightSplitGroup(Area area, double height)
{
for (int i = 0; i < area.AreaList.Count; i++)
{
double risultato = -1;
if (area.Equals(m_Parent))
return height;
Area item = area.AreaList[i];
if (area is Split)
{
Split split = (Split)area;
if (split.SplitHorizList.Count > 0)
{
switch (split.SplitHorizList.ElementAt(i).SelMeasureType)
{
case MeasureTypes.ABSOLUTE:
{
risultato = CalculateHeightSplitGroup(item, split.SplitHorizList.ElementAt(i).dDimension);
break;
}
case MeasureTypes.PROPORTIONAL:
{
//risultato = CalculateHeightSplitGroup(item, split.SplitVertList.ElementAt(i).dDimension);
break;
}
case MeasureTypes.PERCENTAGE:
{
risultato = CalculateHeightSplitGroup(item, split.SplitHorizList.ElementAt(i).dDimension * height / 100);
break;
}
}
if (risultato != -1)
return risultato;
}
else
{
risultato = CalculateHeightSplitGroup(item, height);
}
}
else
{
risultato = CalculateHeightSplitGroup(item, height);
if (risultato != -1)
return risultato;
}
}
return height;
}
/// <summary>
/// Calcolo MCD
/// </summary>
/// <param name="a"></param>
/// <param name="b"></param>
/// <returns></returns>
internal static double CalculateMCD(double a, double b)
{
while (b >= 0.01)
{
double temp = b;
b = a % b;
a = temp;
}
//return Double.Round(a,2);
return a;
}
/// <summary>
/// Metodo per ricalcolare i valori proporzionali a causa della modifica di uno
/// </summary>
/// <returns></returns>
internal double CalculatePropVal(double widthTot, List<SplitDimension> splitList)
{
if (splitList.Where(m => m.MeasureType.Equals(MeasureTypes.PROPORTIONAL)).ToList().Count == 0)
{
return 1;
}
List<double> absoluteValue = new List<double>();
foreach (var item in splitList)
{
absoluteValue.Add(item.CalculateAbsoluteValue(widthTot, splitList));
}
for (int i = 0; i < splitList.Count; i++)
{
if (!splitList.ElementAt(i).Equals(this) &&
splitList.ElementAt(i).MeasureType.Equals(MeasureTypes.PROPORTIONAL))
{
int nIndex = splitList.IndexOf(this);
if (absoluteValue.ElementAt(nIndex) <= absoluteValue.ElementAt(i))
{
var mcd = CalculateMCD(absoluteValue.ElementAt(nIndex), absoluteValue.ElementAt(i));
splitList.ElementAt(i).m_dDimension = absoluteValue.ElementAt(i) / mcd;
m_dDimension = absoluteValue.ElementAt(nIndex) / mcd;
}
else
{
var mcd = CalculateMCD(absoluteValue.ElementAt(nIndex), absoluteValue.ElementAt(i));
splitList.ElementAt(i).m_dDimension = absoluteValue.ElementAt(i) / mcd;
m_dDimension = absoluteValue.ElementAt(nIndex) / mcd;
}
break;
}
}
return m_dDimension;
}
/// <summary>
/// Metodo per trasformare una dimensione in valore assoluto rispetto alla larghezza totale
/// </summary>
/// <param name="widthTot"> Larghezza totale </param>
/// <returns></returns>
internal double CalculateAbsoluteValue(double widthTot, List<SplitDimension> splitList)
{
switch (MeasureType)
{
case MeasureTypes.ABSOLUTE:
{
//return Double.Round(dDimension, 2);
return dDimension;
}
case MeasureTypes.PROPORTIONAL:
{
//return Double.Round(Proportional2AbsolutVal(), 2);
return Proportional2AbsoluteVal(widthTot, splitList);
}
case MeasureTypes.PERCENTAGE:
{
//return Double.Round((dDimension / 100) * widthTot, 1);
return (dDimension / 100) * widthTot;
}
}
return 0;
}
/// <summary>
/// Metodo per convertire una dimensione da un valore assoluto al suo rispettivo tipo
/// </summary>
/// <param name="absoluteVal"> Valore assoluto </param>
/// <param name="type"> Tipo di misura della dimensione </param>
/// <param name="widthTot"> Larghezza totale </param>
/// <returns></returns>
internal double ConvertIn(double absoluteVal, MeasureTypes type, double widthTot, List<SplitDimension> splitList)
{
switch (type)
{
case MeasureTypes.ABSOLUTE:
{
return absoluteVal;
}
case MeasureTypes.PROPORTIONAL:
{
return Proportional2AbsoluteVal(widthTot, splitList);
}
case MeasureTypes.PERCENTAGE:
{
return (absoluteVal / widthTot) * 100;
}
}
return -1;
}
/// <summary>
/// Metodo per convertire da misura proporzionale a misura assoluta o percentuale
/// </summary>
/// <param name="newType"></param>
/// <returns></returns>
internal double ConvertFromPropVal(MeasureTypes newType, double widthTot, List<SplitDimension> splitList)
{
double tot = widthTot;
//Somma misura non proporzionali
double sumNotProp = splitList
.Where(m => m.MeasureType != MeasureTypes.PROPORTIONAL && !m.Equals(this))
.Sum(m => m.CalculateAbsoluteValue(tot, splitList));
//Calcolo residuo
double res = tot - sumNotProp;
if (res < 0) res = 0;
//Misure proporzionali
var proportionalList = splitList
.Where(m => m.SelMeasureType == MeasureTypes.PROPORTIONAL)
.ToList();
double sumPesi = proportionalList.Sum(p => p.dDimension);
if (sumPesi == 0) sumPesi = 1;
if (newType.Equals(MeasureTypes.ABSOLUTE))
{
return res / sumPesi * dDimension;
}
else
{
return (res / sumPesi * dDimension) / tot * 100;
}
}
/// <summary>
/// Metodo per trasformare il valore proporzionale in assoluto
/// </summary>
/// <returns></returns>
internal double Proportional2AbsoluteVal(double widthTot, List<SplitDimension> splitList)
{
double tot = widthTot;
//Somma misura non proporzionali
double sumNotProp = splitList
.Where(m => m.MeasureType != MeasureTypes.PROPORTIONAL)
.Sum(m => m.CalculateAbsoluteValue(tot, splitList));
//Calcolo residuo
double res = tot - sumNotProp;
if (res < 0) res = 0;
//Misure proporzionali
var proportionalList = splitList
.Where(m => m.SelMeasureType == MeasureTypes.PROPORTIONAL)
.ToList();
double sumPesi = proportionalList.Sum(p => p.dDimension);
if (sumPesi == 0) sumPesi = 1;
return res / sumPesi * dDimension;
}
internal JsonSplitDimension Serialize()
{
JsonSplitDimension JsonSplitDimension = new JsonSplitDimension(m_bIsRelative, m_dDimension);
JsonSplitDimension JsonSplitDimension = new JsonSplitDimension(m_bIsRelative, m_dDimension, MeasureType);
return JsonSplitDimension;
}
@@ -171,6 +746,57 @@ namespace WebWindowComplex.Models
m_bIsVertListDim = value;
}
internal void SetMeasureType(MeasureTypes value)
{
m_SelMeasureType = value;
}
internal void SetSelMeasureType(MeasureTypes value)
{
if (m_SelMeasureType != (MeasureTypes)value)
{
MeasureTypes newType = (MeasureTypes)value;
double tot = 0;
if (bIsVertListDim)
{
tot = CalculateWidthSplitGroup(m_Parent.ParentWindow.AreaList.FirstOrDefault(), m_Parent.ParentWindow.AreaList.FirstOrDefault().DimensionList.Where(x => x.sName == "Width").First().dValue);
m_dDimension = ConvertDimension(m_SelMeasureType, newType, tot, m_Parent.SplitVertList);
}
else
{
tot = CalculateHeightSplitGroup(m_Parent.ParentWindow.AreaList.FirstOrDefault(), HeightTot());
m_dDimension = ConvertDimension(m_SelMeasureType, newType, tot, m_Parent.SplitHorizList);
}
m_SelMeasureType = (MeasureTypes)value;
//m_Parent.ParentWindow.OnUpdatePreview(m_Parent.ParentWindow.sSerialized());
}
}
internal double HeightTot()
{
switch (m_Parent.ParentWindow.AreaList.First().SelShapeIndex)
{
case (int)Shapes.RECTANGLE:
case (int)Shapes.TRIANGLE:
case (int)Shapes.ARC_FULL:
{
return CalculateHeightSplitGroup(m_Parent.ParentWindow.AreaList.FirstOrDefault(), m_Parent.ParentWindow.AreaList.FirstOrDefault().DimensionList.Where(x => x.sName == "Height").First().dValue);
}
case (int)Shapes.RIGHTCHAMFER:
{
return CalculateHeightSplitGroup(m_Parent.ParentWindow.AreaList.FirstOrDefault(), m_Parent.ParentWindow.AreaList.FirstOrDefault().DimensionList.Where(x => x.sName == "Left Height").First().dValue);
}
case (int)Shapes.LEFTCHAMFER:
{
return CalculateHeightSplitGroup(m_Parent.ParentWindow.AreaList.FirstOrDefault(), m_Parent.ParentWindow.AreaList.FirstOrDefault().DimensionList.Where(x => x.sName == "Right Height").First().dValue);
}
default:
{
return CalculateHeightSplitGroup(m_Parent.ParentWindow.AreaList.FirstOrDefault(), m_Parent.ParentWindow.AreaList.FirstOrDefault().DimensionList.Where(x => x.sName == "Full Height").First().dValue);
}
}
}
#endregion Internal Methods
#region Private Fields
@@ -181,6 +807,15 @@ namespace WebWindowComplex.Models
private double m_dDimension;
private List<IdNameStruct> m_MeasureTypeList = new List<IdNameStruct>
{
new IdNameStruct((int)MeasureTypes.ABSOLUTE, "Absolute"),
new IdNameStruct((int)MeasureTypes.PROPORTIONAL, "Proportional"),
new IdNameStruct((int)MeasureTypes.PERCENTAGE, "Percentage"),
};
private MeasureTypes m_SelMeasureType;
// reference
private Split m_Parent;
+31 -35
View File
@@ -11,7 +11,7 @@ using System.Xml.Linq;
using System.Xml.Serialization;
using WebWindowComplex.Json;
using static WebWindowComplex.Json.WindowConst;
using static WebWindowComplex.ParametriOpzioni;
using static WebWindowComplex.Models.ParametriOpzioni;
namespace WebWindowComplex.Models
{
@@ -19,9 +19,9 @@ namespace WebWindowComplex.Models
{
#region Public Events
public event EventHandler<OnPreviewEventArgs> OnPreview = delegate { };
public event EventHandler<OnReqShapeEventArgs> OnReqShape = delegate { };
public event EventHandler<OnReqHwOptEventArgs> OnReqHwOption = delegate { };
//public event EventHandler<OnPreviewEventArgs> OnPreview = delegate { };
//public event EventHandler<OnReqShapeEventArgs> OnReqShape = delegate { };
//public event EventHandler<OnReqHwOptEventArgs> OnReqHwOption = delegate { };
#endregion Public Events
@@ -48,7 +48,6 @@ namespace WebWindowComplex.Models
set
{
m_sColorMaterial = value;
OnUpdatePreview(sSerialized());
}
}
@@ -61,7 +60,6 @@ namespace WebWindowComplex.Models
set
{
m_sGlass = value;
OnUpdatePreview(sSerialized());
}
}
@@ -74,7 +72,6 @@ namespace WebWindowComplex.Models
set
{
m_sMaterial = value;
OnUpdatePreview(sSerialized());
}
}
@@ -87,7 +84,6 @@ namespace WebWindowComplex.Models
set
{
m_sProfilePath = value;
OnUpdatePreview(sSerialized());
}
}
@@ -95,35 +91,35 @@ namespace WebWindowComplex.Models
#region Internal Methods
internal void OnUpdatePreview(string sJwd)
{
OnPreviewEventArgs e = new OnPreviewEventArgs(sJwd);
EventHandler<OnPreviewEventArgs> handler = OnPreview;
if (handler != null)
{
handler(this, e);
}
}
//internal void OnUpdatePreview(string sJwd)
//{
// OnPreviewEventArgs e = new OnPreviewEventArgs(sJwd);
// EventHandler<OnPreviewEventArgs> handler = OnPreview;
// if (handler != null)
// {
// handler(this, e);
// }
//}
internal void OnReqShapePreview(string sJwd, int groupId)
{
OnReqShapeEventArgs e = new OnReqShapeEventArgs(sJwd, groupId);
EventHandler<OnReqShapeEventArgs> handler = OnReqShape;
if (handler != null)
{
handler(this, e);
}
}
//internal void OnReqShapePreview(string sJwd, int groupId)
//{
// OnReqShapeEventArgs e = new OnReqShapeEventArgs(sJwd, groupId);
// EventHandler<OnReqShapeEventArgs> handler = OnReqShape;
// if (handler != null)
// {
// handler(this, e);
// }
//}
internal void OnReqHwOptionPreview(string sJwd, int groupId)
{
OnReqHwOptEventArgs e = new OnReqHwOptEventArgs(sJwd, groupId);
EventHandler<OnReqHwOptEventArgs> handler = OnReqHwOption;
if (handler != null)
{
handler(this, e);
}
}
//internal void OnReqHwOptionPreview(string sJwd, int groupId)
//{
// OnReqHwOptEventArgs e = new OnReqHwOptEventArgs(sJwd, groupId);
// EventHandler<OnReqHwOptEventArgs> handler = OnReqHwOption;
// if (handler != null)
// {
// handler(this, e);
// }
//}
/// <summary>
/// Serializzazione dell'oggetto windows
+90 -52
View File
@@ -21,7 +21,7 @@
</div>
</div>
}
else if (listErrLink != null && listErrLink.Count > 0)
@* else if (listErrLink != null && listErrLink.Count > 0)
{
<div class="alert alert-danger">
<div class="fs-3">Errore configurazione:</div>
@@ -34,7 +34,7 @@
</ul>
</div>
</div>
}
} *@
else
{
<div class="col-md-12 col-lg-6 d-flex flex-column">
@@ -49,6 +49,15 @@
<li class="nav-item m-1">
<button data-target="#General" class="@tabNavCss(CompileStep.General)" @onclick="() => NextStep(CompileStep.General)">General</button>
</li>
@* @if (FrameWindow.Shape == Json.WindowConst.Shapes.ARC ||
FrameWindow.Shape == Json.WindowConst.Shapes.ARC_FULL ||
FrameWindow.Shape == Json.WindowConst.Shapes.DOUBLEARC ||
FrameWindow.Shape == Json.WindowConst.Shapes.THREECENTERARC)
{
<li class="nav-item m-1">
<button data-target="#ArcElement" class="@tabNavCss(CompileStep.ArcElement)" @onclick="() => NextStep(CompileStep.ArcElement)">Arc Elem</button>
</li>
} *@
</ul>
</div>
<div class="col-md-12 col-lg-6 d-grid gap-1 d-md-flex justify-content-md-end align-items-center flex-wrap">
@@ -78,96 +87,125 @@
{
m_PreviousWindow = m_CurrWindow;
}
<CardFrame FrameWindow="m_Frame"
SashList="m_SashList"
SplitList="m_SplitList"
EC_ChangeAllJoints="ChangeAllJoints"
EC_AddSash="() => AddSashToFrame(FrameWindow!)"
EC_AddSplit="() => AddSplitToFrame(FrameWindow!)"
EC_ReqClose="ReturnTree"
EC_ReqResetDictShape="ReqResetDict"
EC_UpdateShape="UpdateShape"
EC_UpdateFrame="UpdateFrame">
</CardFrame>
<CascadingValue Value="FrameWindow" Name="CurrFrameWindow">
<CascadingValue Value="m_SashList" Name="SashList">
<CascadingValue Value="m_SplitList" Name="SplitList">
<CardFrame EC_ReqClose="ReturnTree"
EC_ReqResetDictShape="ReqResetDict"
EC_ReqOptionHw="UpdateHwOptionsFrame"
EC_UpdatePreview="UpdatePreviewFrame">
</CardFrame>
</CascadingValue>
</CascadingValue>
</CascadingValue>
}
else if (currStep == CompileStep.Split)
{
@if (currSplit >= SplitList.Count || currSplit == -1)
@if (currSplitIndex >= SplitList.Count || currSplitIndex == -1)
{
currStep = CompileStep.Tree;
}
else
{
<CardSplit SashList="m_SashList"
SplitList="m_SplitList"
CurrIndex="currSplit"
CurrItem="SplitList[currSplit]"
EC_SwapTwoAree="SwapTwoAree"
EC_RemoveArea="RemoveArea"
<CardSplit CurrSplit="SplitList[currSplitIndex]"
SashList="SashList"
SplitList="SplitList"
FrameWindow="FrameWindow"
EC_UpdateFrame="UpdatePreviewFrame"
EC_ReqResetDictShape="ReqResetDict"
EC_ChangeStartVert="changeStartVert"
EC_ReqResetDictHwOpt="ReqResetDict"
EC_UpdatePreview="UpdatePreviewSplit"
EC_ReqClose="ReturnTree">
</CardSplit>
}
}
else if (currStep == CompileStep.Sash)
{
@if (currSash >= SashList.Count || currSash == -1)
@if (currSashIndex >= SashList.Count || currSashIndex == -1)
{
currStep = CompileStep.Tree;
}
else
{
<CascadingValue Value="currLoading" Name="IsLoading">
<CardSashGroup CurrIndex="currSash"
CurrItem="SashList[currSash]"
SashList="SashList"
EC_ChangeAllJoints="ChangeAllJoints"
EC_ChangeHandle="ChangeHandle"
EC_CopyContentSash="CopyContentSash"
EC_RemoveArea="RemoveArea"
EC_UpdateSash="UpdateSash"
EC_UpdateSashHardware="UpdateHwOptions"
EC_CallFirstHwOpt="CallFirstHwOpt"
EC_ReqResetDictShape="ReqResetDict"
EC_ReqClose="ReturnTree">
</CardSashGroup>
<CascadingValue Value="SashList[currSashIndex]" Name="CurrSashGroup">
<CascadingValue Value="SashList" Name="SashList">
<CardSashGroup FrameWindow="FrameWindow"
EC_UpdateFrame="UpdatePreviewFrame"
EC_UpdatePreview="UpdatePreviewSashGroup"
EC_ReqResetDictShape="ReqResetDict"
EC_ReqResetDictHwOpt="ReqResetDict"
EC_ReqOptionHw="UpdateHwOptionsSash"
EC_ReqFirstOptionHw="ReqFirstOptionHw"
EC_ReqClose="ReturnTree">
</CardSashGroup>
</CascadingValue>
</CascadingValue>
</CascadingValue>
}
}
}
else if (currStep == CompileStep.Fill)
{
@if (currFill >= FillList.Count || currFill == -1)
@if (currFillIndex >= FillList.Count || currFillIndex == -1)
{
currStep = CompileStep.Tree;
}
else
{
<CardFill CurrIndex="currFill"
CurrItem="FillList[currFill]"
FillList="m_FillList"
SashList="m_SashList"
SplittedList="m_SplittedList"
EC_ChangeAllType="ChangeAllFill"
EC_ChangeType="ChangeOneFill"
EC_AddSash="AddSashIntoSplit"
EC_CopySash="CopySash"
EC_ReqClose="ReturnTree">
<CardFill CurrIndex="currFillIndex"
CurrFill="FillList[currFillIndex]"
EC_UpdatePreviewFill="UpdatePreviewFill"
EC_ReqClose="ReturnTree">
</CardFill>
<div class="card shadow-sm rounded mb-2">
<div class="card-body py-2">
<div class="d-flex justify-content-between align-items-center">
<div class="col-4 d-flex justify-content-left">
<h5 class="text-center text-nowrap">All fill</h5>
</div>
<div class="input-group mb-2 justify-content-center">
<button class="btn btn-outline-secondary btn-sm" @onclick="() => ChangeAllFill(WebWindowComplex.Json.WindowConst.FillTypes.GLASS)">All glass</button>
</div>
<div class="input-group mb-2 justify-content-center">
<button class="btn btn-outline-secondary btn-sm" @onclick="() => ChangeAllFill(WebWindowComplex.Json.WindowConst.FillTypes.WOOD)">All wood</button>
</div>
</div>
</div>
</div>
Splitted currSplitted = SplittedList.Where(x => x.AreaList.First().Equals(FillList[currFillIndex])).FirstOrDefault();
@if (currSplitted != null) {
<AreaSplit SashList="SashList"
SplittedList="SplittedList"
CurrSplitted="currSplitted"
EC_UpdateSplitted="UpdatePreviewSplitted">
</AreaSplit>
}
@* @foreach (var currSplitted in m_SplittedList)
{
@if (currSplitted.AreaList.First().Equals(FillList[currFillIndex]))
{
}
} *@
}
}
else if (currStep == CompileStep.General)
{
<General CurrWindow="@m_CurrWindow"
<General CurrWindow="m_CurrWindow"
ListPayload="ListPayload"
ListWarnings="listWarnings"
EC_SelColor="SelectColor"
EC_SelGlass="SelectGlass"
EC_SelWindMat="SelectMat"
EC_SelProfile="SelectProfile"
EC_UpdateGeneral="UpdatePreviewGeneral"
EC_ReqClose="ReturnTree">
</General>
}
@* else if (currStep == CompileStep.ArcElement)
{
<CardArcElement CurrFrame="FrameWindow"
SashList="m_SashList"
EC_UpdatePreview="UpdatePreviewFrame"
EC_ReqClose="ReturnTree">
</CardArcElement>
} *@
</div>
</div>
</div>
+312 -450
View File
@@ -1,13 +1,13 @@
using Egw.Window.Data;
using Microsoft.AspNetCore.Components;
using Newtonsoft.Json;
using System.Reflection.Metadata;
using System.Threading.Tasks;
using WebWindowComplex.Compo;
using WebWindowComplex.DTO;
using WebWindowComplex.Json;
using WebWindowComplex.Models;
using static WebWindowComplex.LayoutConst;
using static WebWindowComplex.Json.WindowConst;
using static WebWindowComplex.LayoutConst;
namespace WebWindowComplex
{
@@ -15,23 +15,6 @@ namespace WebWindowComplex
{
#region Public Enums
public enum DataAction
{
/// <summary>
/// Nessuna richiesta
/// </summary>
None = 0,
/// <summary>
/// Reset dizionario shape
/// </summary>
ResetDictShape,
/// <summary>
/// Reset dizionario HwOptions
/// </summary>
ResetHwOpt
}
public enum DataReq
{
/// <summary>
@@ -117,9 +100,6 @@ 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;
}
}
@@ -173,6 +153,11 @@ namespace WebWindowComplex
get => m_SashList;
}
protected List<Splitted> SplittedList
{
get => m_SplittedList;
}
protected string SelColorMaterial { get; set; } = "";
protected string SelFamilyHardware { get; set; } = "";
protected string SelGlass { get; set; } = "";
@@ -188,78 +173,6 @@ namespace WebWindowComplex
#region Protected Methods
/// <summary>
/// Metodo per la scelta della maniglia univoca
/// </summary>
/// <param name="sashDim"> anta su cui si seleziona la maniglia </param>
/// <returns></returns>
protected void ChangeHandle(DataChangeHandle Args)
{
SashDimension sashDim = Args.currSashDimension;
Sash currSash = Args.currItem;
// Cerco la Sash che si sta considerando nella lista Sash
var s = SashList.Where(x => x.GroupId == currSash.GroupId).FirstOrDefault();
if (s != null)
{
// Setto la presenza o meno della maniglia per ogni anta
foreach (SashDimension item in s.SashList)
{
if (item.Equals(sashDim))
{
item.bHasHandle = true;
}
else
{
if (item.bHasHandle)
{
switch (item.SelOpeningType)
{
case Openings.TILTTURN_LEFT:
{
item.SetOpeningType(Openings.TURNONLY_LEFT);
break;
}
case Openings.TILTTURN_RIGHT:
{
item.SetOpeningType(Openings.TURNONLY_RIGHT);
break;
}
default:
{
break;
}
}
}
item.bHasHandle = false;
}
}
}
// Per ogni anta della Sash setto HasHandle
currSash.RefreshHardwareList();
currSash.SetFirstHardware();
_ = DoPreviewSvg();
}
/// <summary>
/// Metodo per la scelta dello split intero nella modalità griglia
/// </summary>
/// <param name="currSplit"> split su cui si sceglie </param>
/// <returns></returns>
protected async Task changeStartVert(DataChangeStartVert Args)
{
ChangeEventArgs e = Args.eventArg;
Split currSplit = Args.currItem;
// Cerco la Sash che si sta considerando nella lista Sash
foreach (Split s in SplitList)
{
if (s.Equals(currSplit))
{
s.SetSplitStartVert((bool)e.Value);
}
}
await DoPreviewSvg();
}
/// <summary>
/// Metodo per riempire la lista ItemTable in modo da poter rappresentarla come tabella
/// </summary>
@@ -503,7 +416,7 @@ namespace WebWindowComplex
}
/// <summary>
/// Richiesta calcolo Options HW da JWD
/// Richiesta calcolo Options HW
/// </summary>
/// <param name="groupIdList">Lista degli ID numerici dei gruppi da valutare</param>
/// <returns></returns>
@@ -649,6 +562,39 @@ namespace WebWindowComplex
catch (Exception ex)
{
listErrLink.Add("Window", $"Deserializing Error:{Environment.NewLine}{ex}");
// uso un oggetto "basico" per non fermarmi
//string jwd = "{\r\n \"ProfilePath\": \"Profilo78\",\r\n \"Material\": \"Pino\",\r\n \"ColorMaterial\": \"Black\",\r\n \"Glass\": \"Vetro BE 2S 4T/16/4T\",\r\n \"AreaList\": [\r\n {\r\n \"Shape\": \"RECTANGLE\",\r\n \"DimensionList\": [\r\n {\r\n \"Index\": 1,\r\n \"Name\": \"Width\",\r\n \"Value\": 800.0\r\n },\r\n {\r\n \"Index\": 2,\r\n \"Name\": \"Height\",\r\n \"Value\": 1200.0\r\n }\r\n ],\r\n \"JointList\": [\r\n {\r\n \"Index\": 1,\r\n \"JointType\": \"FULL_H\"\r\n },\r\n {\r\n \"Index\": 2,\r\n \"JointType\": \"FULL_H\"\r\n },\r\n {\r\n \"Index\": 3,\r\n \"JointType\": \"FULL_H\"\r\n },\r\n {\r\n \"Index\": 4,\r\n \"JointType\": \"FULL_H\"\r\n }\r\n ],\r\n \"BottomRail\": false,\r\n \"BottomRailQty\": 0,\r\n \"GroupId\": 1,\r\n \"AreaList\": [\r\n {\r\n \"FillType\": \"GLASS\",\r\n \"GroupId\": 7,\r\n \"AreaList\": [],\r\n \"AreaType\": \"FILL\"\r\n }\r\n ],\r\n \"AreaType\": \"FRAME\"\r\n }\r\n ]\r\n}";
//WindowFromJson = JsonConvert.DeserializeObject<JsonWindow>(jwd, new PolymorphicJsonConverter()) ?? new JsonWindow("", "", "", "");
//setCurrWindow(WindowFromJson);
//await DoPreviewSvg(true);
Window window = new Window();
Frame frame = new Frame(null, window);
List<FrameDimension> DimensionList = new List<FrameDimension>
{
new FrameDimension(frame, 1, "Width", 800, false),
new FrameDimension(frame, 1, "Height", 1200, true)
};
List<Joint> JointList = new List<Joint>
{
new Joint(frame, 1, Joints.FULL_H),
new Joint(frame, 2, Joints.FULL_H),
new Joint(frame, 3, Joints.FULL_H),
new Joint(frame, 4, Joints.FULL_H)
};
//FrameArcElement ae = new FrameArcElement(frame, window, 10, true, true);
JsonWindow jsonWindow = new JsonWindow("Profilo78", "Pino", "Black", "Vetro BE 2S 4T/16/4T");
JsonFrame jsonFrame = new JsonFrame(Shapes.RECTANGLE, false, 0, 1);
jsonWindow.AreaList.Add(jsonFrame);
//jsonFrame.ArcElement = ae.Serialize();
foreach (var Dimension in DimensionList)
jsonFrame.DimensionList.Add(Dimension.Serialize());
foreach (var Joint in JointList)
jsonFrame.JointList.Add(Joint.Serialize());
jsonFrame.AreaList.Add(Fill.CreateFill(frame, FillTypes.GLASS).Serialize(true));
string jwd = JsonConvert.SerializeObject(jsonWindow);
WindowFromJson = JsonConvert.DeserializeObject<JsonWindow>(jwd, new PolymorphicJsonConverter()) ?? new JsonWindow("", "", "", "");
setCurrWindow(WindowFromJson);
await DoPreviewSvg(true);
}
}
else
@@ -660,12 +606,12 @@ namespace WebWindowComplex
checkWarnings();
if (SashList.Count > 0)
{
currAnta = 0;
currAntaIndex = 0;
}
if (updRequested)
{
// se mancasse dizionario forme chiamo quello
if (LiveData.DictShape.Count == 0)
if (LiveData.DictShape.Count == 0 && listErrLink.Count == 0)
{
if (firstDisplay && isRendered)
{
@@ -676,13 +622,21 @@ namespace WebWindowComplex
List<int> reqList = SashList.Select(x => x.GroupId).ToList();
if (reqList.Count > 0)
{
//prevReq = (int)DataReq.ReqShape;
await DoReqShape(reqList);
}
}
else
{
// chiedo SVG
await DoPreviewSvg(true);
//prevReq = (int)DataReq.ReqSvg;
if(prevReq != (int)DataReq.ReqSvg || !prevLiveData.JwdEqual(LiveData.CurrJwd))
{
if(prevReq != (int)DataReq.ReqHwOpt)
await DoPreviewSvg(true);
else if (LiveData.DictOptionsXml.Count > 0)
await DoPreviewSvg(true);
}
}
}
}
@@ -702,22 +656,24 @@ 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;
}
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
FrameWindow = m_CurrWindow.AreaList[0];
if (m_PreviousWindow != null)
{
for (int i = 0; i < 2; i++)
m_CurrWindow.AreaList.First().DimensionList[i] = m_PreviousWindow.AreaList.First().DimensionList[i];
for (int i = 0; i < 4; i++)
m_CurrWindow.AreaList.First().JointList[i] = m_PreviousWindow.AreaList.First().JointList[i];
m_CurrWindow.AreaList.First().DimensionList[i].dValue = m_PreviousWindow.AreaList.First().DimensionList[i].dValue;
if(m_CurrWindow.AreaList.First().Shape == Shapes.TRIANGLE)
{
for (int i = 0; i < 2; i++)
m_CurrWindow.AreaList.First().JointList[i].SetSelJointType(m_PreviousWindow.AreaList.First().JointList[i].SelJointType);
}
else
{
for (int i = 0; i < 4; i++)
m_CurrWindow.AreaList.First().JointList[i].SetSelJointType(m_PreviousWindow.AreaList.First().JointList[i].SelJointType);
}
}
if (m_CurrWindow != null)
{
@@ -725,10 +681,7 @@ namespace WebWindowComplex
UpdateLists();
}
if (SashList.Count > 0)
currAnta = 0;
#if false
_ = InvokeAsync(StateHasChanged);
#endif
currAntaIndex = 0;
// Aggiorno window con dati shape e hw option
UpdateDict();
}
@@ -744,10 +697,17 @@ namespace WebWindowComplex
// Inserisco le forme ricevuto nei sash group
foreach (var item in LiveData.DictShape)
{
Sash sashFromGroupId = SashList.Where(x => x.GroupId == item.Key).First();
Sash sashFromGroupId = SashList.First(x => x.GroupId == item.Key);
sashFromGroupId.SashShape = item.Value;
sashFromGroupId.UpdateShape(item.Value);
}
if(prevReq == (int)DataReq.ReqShape){
if(reqHwOpt > 0)
{
List<int> reqList = SashList.Select(x => x.GroupId).ToList();
_=DoReqOptHardware(reqList);
}
}
}
// se ho le opzioni hw le aggiungo
if (LiveData.DictOptionsXml.Count > 0)
@@ -800,13 +760,13 @@ namespace WebWindowComplex
#region Private Fields
private int currAnta = 0;
private int currAntaIndex = 0;
private int currFill = -1;
private int currFillIndex = -1;
private int currSash = -1;
private int currSashIndex = -1;
private int currSplit = -1;
private int currSplitIndex = -1;
private CompileStep currStep;
@@ -860,8 +820,6 @@ namespace WebWindowComplex
private Window? m_PreviousWindow { get; set; } = null;
private string m_SelFamilyHardware { get; set; } = "";
/// <summary>
/// Salvataggio JWD precedente x evitare loop su update (aggiornato dopo chiamate redis)
/// </summary>
@@ -871,51 +829,12 @@ namespace WebWindowComplex
/// Salvataggio tipo di domanda precedente
/// </summary>
private int prevReq { get; set; } = 0;
private int reqHwOpt { get; set; } = 0;
#endregion Private Properties
#region Private Methods
/// <summary>
/// Metodo per aggiungere una Sash
/// </summary>
/// <param name="Args"></param>
/// <returns></returns>
private void AddSashIntoSplit(DataAreaSplitted Args)
{
Splitted currSplitted = Args.splitted;
currSplitted.AddFirstSash();
// ricalcolo liste
UpdateLists();
// richiedo update shape
List<int> reqList = SashList.Select(x => x.GroupId).ToList();
_ = DoReqShape(reqList);
//_ = DoReqOptHardware(reqList);
}
/// <summary>
/// Metodo per aggiungere una sash di default al Frame
/// </summary>
/// <param name="f"></param>
private void AddSashToFrame(Frame f)
{
f.AddFirstSash();
// ricalcolo liste
UpdateLists();
// richiedo update shape
List<int> reqList = SashList.Select(x => x.GroupId).ToList();
_ = DoReqShape(reqList);
}
/// <summary>
/// Metodo per aggiungere uno split di default al Frame
/// </summary>
/// <param name="f"></param>
private void AddSplitToFrame(Frame f)
{
f.AddSplit();
}
/// <summary>
/// Metodo per andare allo step successivo
/// </summary>
@@ -923,74 +842,9 @@ namespace WebWindowComplex
private void AdvStep(CompileStep newStep)
{
currStep = newStep;
currSash = -1;
currFill = -1;
currSplit = -1;
}
/// <summary>
/// Prima chiamata alle opzioni hardware
/// </summary>
/// <param name="groupId"> Group Id del sash group di cui si vuole Hw option </param>
/// <returns></returns>
private async Task CallFirstHwOpt(int groupId)
{
bool isFirst = true;
List<int> reqList = new List<int>() { groupId };
await DoReqOptHardware(reqList, isFirst);
}
/// <summary>
/// Metodo per settare tutti i Fill in contemporanea
/// </summary>
/// <param name="type"> tipo di riempimento (GLASS o WOOD) </param>
/// <returns></returns>
private async Task ChangeAllFill(FillTypes type)
{
foreach (Fill currFill in FillList)
{
currFill.SetSelFillType(type);
}
await DoPreviewSvg();
}
/// <summary>
/// Metodo per settare tutti i Joints di Frame o Sash come ANGLED o FULL_H o FULL_V
/// </summary>
/// <param name="Args"></param>
/// <returns></returns>
private async Task ChangeAllJoints(DataChangeJoints Args)
{
WindowConst.Joints type = Args.currJointType;
Area area = Args.currArea;
if (area is Frame)
{
foreach (Joint joint in FrameWindow.JointList)
{
joint.SetSelJointType(type);
}
}
else
{
Sash a = (Sash)area;
foreach (Joint joint in a.JointList)
{
joint.SetSelJointType(type);
}
}
await DoPreviewSvg();
}
/// <summary>
/// Metodo per settare tutti i Fill in contemporanea
/// </summary>
/// <param name="type"> tipo di riempimento (GLASS o WOOD) </param>
/// <returns></returns>
private async Task ChangeOneFill(FillTypes type)
{
Fill fillChange = FillList.ElementAt(currFill);
fillChange.SetSelFillType(type);
await DoPreviewSvg();
currSashIndex = -1;
currFillIndex = -1;
currSplitIndex = -1;
}
/// <summary>
@@ -1059,46 +913,6 @@ namespace WebWindowComplex
}
}
/// <summary>
/// Metodo per copiare contenuto di un'anta in un'altra anta
/// </summary>
/// <param name="Args"></param>
private async Task CopyContentSash(DataCopyContentSash Args)
{
Sash sashItem = Args.currItem;
int IndexCopy = Args.indexCopy;
int IndexModify = Args.indexModify;
// Anta selezionata
Area sashSplitted = sashItem.AreaList[IndexModify];
// Rimuovo riempimento da anta selezionata
sashSplitted.AreaList.RemoveAt(0);
// Creo la copia dell'anta scelta
Area a = sashItem.AreaList[IndexCopy].AreaList.First().Copy(sashSplitted);
// Aggiungo copia all'anta selezionata
sashItem.AreaList[IndexModify].AreaList.Add(a);
await DoPreviewSvg();
}
/// <summary>
/// Metodo per copiare una Sash intera
/// </summary>
/// <param name="Args"></param>
/// <returns></returns>
private async Task CopySash(DataAreaSplit Args)
{
Splitted currSplitted = Args.splitted;
int numSash = Args.index;
//Rimuovo contenuto di Splitted e rimuovo area da conteggio gruppi
currSplitted.AreaList.RemoveAll(i => i != null);
//Area.DelCounterGroup();
// Copio sash
Area a = SashList[numSash].Copy(currSplitted);
a.SetParentArea(currSplitted);
// Aggiungo copia a Splitted
currSplitted.AreaList.Add(a);
await DoPreviewSvg();
}
/// <summary>
/// Helper aggiunta elemento a lista caricamento
/// </summary>
@@ -1123,41 +937,6 @@ namespace WebWindowComplex
}
}
private void M_CurrWindow_OnHwOption(object? sender, OnReqHwOptEventArgs e)
{
// chiamo reset dizionario
ReqResetHwOpt(true);
// setto che sto chiedendo update opzioni
loadListAdd("LoadHwOpt");
_ = InvokeAsync(StateHasChanged);
Dictionary<string, string> Args = new Dictionary<string, string>();
Args.Add("Mode", $"{(int)Enums.QuestionModes.HARDWARE}");
Args.Add("SubMode", $"{(int)Enums.QuestionHwSubModes.HARDWAREOPTIONS}");
Args.Add("SerializedData", e.sJwd);
string listGroupId = JsonConvert.SerializeObject(new List<int> { e.nGroupId });
Args.Add("GroupId", listGroupId);
_ = EC_DoUpdate.InvokeAsync(Args);
}
private void M_CurrWindow_OnPreview(object? sender, OnPreviewEventArgs e)
{
Dictionary<string, string> Args = new Dictionary<string, string>();
Args.Add("Mode", $"{(int)Enums.QuestionModes.PREVIEW}");
Args.Add("SerializedData", e.sJwd);
_ = EC_DoUpdate.InvokeAsync(Args);
}
private void M_CurrWindow_OnShape(object? sender, OnReqShapeEventArgs e)
{
Dictionary<string, string> Args = new Dictionary<string, string>();
Args.Add("Mode", $"{(int)Enums.QuestionModes.HARDWARE}");
Args.Add("SubMode", $"{(int)Enums.QuestionHwSubModes.SASHSHAPE}");
Args.Add("SerializedData", e.sJwd);
string listGroupId = JsonConvert.SerializeObject(new List<int> { e.groupId });
Args.Add("GroupId", listGroupId);
_ = EC_DoUpdate.InvokeAsync(Args);
}
/// <summary>
/// Metodo per cambiare step
/// </summary>
@@ -1170,23 +949,23 @@ namespace WebWindowComplex
{
case CompileStep.Sash:
{
currSash = Index;
currFill = -1;
currSplit = -1;
currSashIndex = Index;
currFillIndex = -1;
currSplitIndex = -1;
break;
}
case CompileStep.Fill:
{
currFill = Index;
currSash = -1;
currSplit = -1;
currFillIndex = Index;
currSashIndex = -1;
currSplitIndex = -1;
break;
}
case CompileStep.Split:
{
currSplit = Index;
currSash = -1;
currFill = -1;
currSplitIndex = Index;
currSashIndex = -1;
currFillIndex = -1;
break;
}
}
@@ -1203,38 +982,13 @@ namespace WebWindowComplex
NextStep(newStep, Index);
}
/// <summary>
/// Metodo per eliminare Split o Sash
/// </summary>
/// <param name="currArea"> Area corrente </param>
/// <returns></returns>
private void RemoveArea(Area currArea)
{
if (currArea is Split)
((Split)currArea).Remove();
else if (currArea is Sash)
{
((Sash)currArea).Remove();
}
currStep = CompileStep.Tree;
}
/// <summary>
/// Richiesta reset dizionario Shape con action
/// </summary>
/// <param name="args"></param>
private void ReqResetDict(bool args)
private async Task ReqResetDict(DataUpdateRes args)
{
_ = EC_ActionReq.InvokeAsync(DataAction.ResetDictShape);
}
/// <summary>
/// Richiesta reset dizionario options con action
/// </summary>
/// <param name="args"></param>
private void ReqResetHwOpt(bool args)
{
_ = EC_ActionReq.InvokeAsync(DataAction.ResetHwOpt);
_ = EC_ActionReq.InvokeAsync(args.req);
}
/// <summary>
@@ -1246,23 +1000,15 @@ namespace WebWindowComplex
AdvStep(CompileStep.Tree);
}
/// <summary>
/// Cerca e aggiorna la sash
/// </summary>
/// <param name="currentArea"> area corrente che si sta valutando </param>
/// <param name="idSearch"> id della sash che si sta cercando </param>
/// <param name="newSash"> nuova sash </param>
/// <returns></returns>
private Area SearchSash(Area currentArea, int idSearch, Sash newSash)
{
if (currentArea.GroupId == idSearch && currentArea.AreaType.Equals(AreaTypes.SASH))
private Area SearchArea(Area currentArea, int idSearch, Area itemSearch)
{
if (currentArea.GroupId == idSearch && currentArea.AreaType.Equals(itemSearch.AreaType))
{
currentArea = newSash;
return currentArea;
}
foreach (Area child in currentArea.AreaList)
{
Area found = SearchSash(child, idSearch, newSash);
Area found = SearchArea(child, idSearch, itemSearch);
if (found != null)
{
return found;
@@ -1272,70 +1018,26 @@ namespace WebWindowComplex
}
/// <summary>
/// Selezione del colore
/// Metodo per aggiornare valori della sezione General
/// </summary>
/// <param name="newVal"></param>
private void SelectColor(string newVal)
private void UpdatePreviewGeneral(DataUpdateGeneral args)
{
string Color = args.Color;
string Glass = args.Glass;
string Material = args.Material;
string Profile = args.Profile;
if (m_CurrWindow != null)
{
m_CurrWindow.sColorMaterial = newVal;
}
}
/// <summary>
/// Selezione del vetro
/// </summary>
/// <param name="newVal"></param>
private void SelectGlass(string newVal)
{
if (m_CurrWindow != null)
{
m_CurrWindow.sGlass = newVal;
}
}
/// <summary>
/// Selezione del materiale
/// </summary>
/// <param name="newVal"></param>
private void SelectMat(string newVal)
{
if (m_CurrWindow != null)
{
m_CurrWindow.sMaterial = newVal;
}
}
/// <summary>
/// Selezione del profilo
/// </summary>
/// <param name="newVal"></param>
private void SelectProfile(string newVal)
{
if (m_CurrWindow != null)
{
m_CurrWindow.sProfilePath = newVal;
}
}
/// <summary>
/// Metodo per scambiare due aree di uno split
/// </summary>
/// <param name="currArea"> Area corrente </param>
/// <returns></returns>
private async Task SwapTwoAree(Area currArea)
{
currArea.SwapAree();
await DoPreviewSvg(true, true);
if (currArea is Split)
{
List<int> reqShape = new List<int>();
if (currArea.AreaList[0].AreaList.Where(x => x.AreaType == AreaTypes.SASH).ToList().Count() > 0)
reqShape.Add(currArea.AreaList[0].AreaList.Where(x => x.AreaType == AreaTypes.SASH).Select(x => x.GroupId).FirstOrDefault());
if (currArea.AreaList[1].AreaList.Where(x => x.AreaType == AreaTypes.SASH).ToList().Count() > 0)
reqShape.Add(currArea.AreaList[1].AreaList.Where(x => x.AreaType == AreaTypes.SASH).Select(x => x.GroupId).FirstOrDefault());
await DoReqShape(reqShape);
if (!string.IsNullOrEmpty(Color))
m_CurrWindow.sColorMaterial = Color;
else if (!string.IsNullOrEmpty(Glass))
m_CurrWindow.sGlass = Glass;
else if (!string.IsNullOrEmpty(Material))
m_CurrWindow.sMaterial = Material;
else if(!string.IsNullOrEmpty(Profile))
m_CurrWindow.sProfilePath = Profile;
_ = DoPreviewSvg();
}
}
@@ -1348,21 +1050,21 @@ namespace WebWindowComplex
{
if (testStep == CompileStep.Sash)
{
if ((currSash == 0 && Index == 0) || (currSash == 1 && Index == 1))
if ((currSashIndex == 0 && Index == 0) || (currSashIndex == 1 && Index == 1))
return "nav-link active fw-bold";
else
return "nav-link text-secondary";
}
else if (testStep == CompileStep.Fill)
{
if ((currFill == 0 && Index == 0) || (currFill == 1 && Index == 1))
if ((currFillIndex == 0 && Index == 0) || (currFillIndex == 1 && Index == 1))
return "nav-link active fw-bold";
else
return "nav-link text-secondary";
}
else if (testStep == CompileStep.Split)
{
if ((currSplit == 0 && Index == 0) || (currSplit == 1 && Index == 1))
if ((currSplitIndex == 0 && Index == 0) || (currSplitIndex == 1 && Index == 1))
return "nav-link active fw-bold";
else
return "nav-link text-secondary";
@@ -1370,15 +1072,190 @@ namespace WebWindowComplex
return (testStep == currStep) ? "nav-link active fw-bold" : "nav-link text-secondary";
}
/// <summary>
/// Metodo per cambiare tutti i Fill e richiedere aggiornamento SVG
/// </summary>
/// <param name="reqFillType"> tipo di fill richiesto </param>
/// <returns></returns>
protected async Task ChangeAllFill(FillTypes reqFillType)
{
updateAllFill(FrameWindow, reqFillType);
await DoPreviewSvg();
}
/// <summary>
/// Metodo per aggiornare tutti i Fill al nuovo tipo
/// </summary>
/// <param name="area"> area corrente</param>
/// <param name="type"> tipo a cui aggiornare</param>
private void updateAllFill(Area area, FillTypes type)
{
if (area.AreaType.Equals(AreaTypes.FILL))
{
Fill fill = (Fill)area;
fill.SetSelFillType(type);
return;
}
foreach (Area child in area.AreaList)
{
updateAllFill(child, type);
}
}
/// <summary>
/// Aggiornamento Fill
/// </summary>
/// <param name="newFill"> Fill da aggiornare</param>
/// <returns></returns>
private async Task UpdatePreviewFill(Fill newFill)
{
if (newFill != null)
{
// cerco il record
var currRec = (Fill)SearchArea(FrameWindow, newFill.GroupId, newFill);
// lo aggiorno
currRec = newFill;
await DoPreviewSvg();
}
}
/// <summary>
/// Aggiornamento Frame
/// </summary>
/// <param name="newFrame"></param>
/// <param name="newFrame"> nuovo frame</param>
/// <returns></returns>
private async Task UpdateFrame(Frame newFrame)
private async Task UpdatePreviewFrame(DataUpdateFrame args)
{
FrameWindow = newFrame;
await DoPreviewSvg();
Frame newFrame = args.currFrame;
bool forceSvgNoHw = args.svgNoHw;
if (newFrame != null)
{
// cerco il record
var currRec = m_CurrWindow.AreaList.FirstOrDefault(x => x.GroupId == newFrame.GroupId);
// lo aggiorno
currRec = newFrame;
if(forceSvgNoHw)
await DoPreviewSvg(true,true);
else
await DoPreviewSvg();
}
}
/// <summary>
/// Aggiornamento opzioni dato nuovo frame
/// </summary>
/// <param name="newFrame"> nuovo frame </param>
/// <returns></returns>
private async Task UpdateHwOptionsFrame(Frame newFrame)
{
if (newFrame != null)
{
// cerco il record
var currRec = m_CurrWindow.AreaList.FirstOrDefault(x => x.GroupId == newFrame.GroupId);
// lo aggiorno
currRec = newFrame;
// resetto hw lst
await EC_ActionReq.InvokeAsync(DataAction.ResetHwOpt);
reqHwOpt++;
if (prevReq == (int)DataReq.ReqShape)
{
// richiesta calcolo opzioni hardware per la singola sash group
List<int> reqList = SashList.Select(x => x.GroupId).ToList();
// chiamo con gruppo della nuova sash
await DoReqOptHardware(reqList);
}
}
}
/// <summary>
/// Aggiornamento opzioni data nuova sash group
/// </summary>
/// <param name="newSash"> nuovo frame </param>
/// <returns></returns>
private async Task UpdateHwOptionsSash(Sash newSash)
{
if (newSash != null)
{
// cerco il record
var currRec = SearchArea(FrameWindow, newSash.GroupId, newSash);
// lo aggiorno
currRec = newSash;
// resetto hw lst
await EC_ActionReq.InvokeAsync(DataAction.ResetHwOpt);
//reqHwOpt++;
//if(prevReq == (int)DataReq.ReqShape)
//{
// richiesta calcolo opzioni hardware per la singola sash group
List<int> reqList = SashList.Select(x => x.GroupId).ToList();
// chiamo con gruppo della nuova sash
await DoReqOptHardware(reqList);
//}
}
}
/// <summary>
/// Richiesta opzioni hardware per la prima volta
/// </summary>
/// <param name="newSash"> nuovo frame </param>
/// <returns></returns>
private async Task ReqFirstOptionHw(Sash newSash)
{
if (newSash != null)
{
// cerco il record
var currRec = SearchArea(FrameWindow, newSash.GroupId, newSash);
// lo aggiorno
currRec = newSash;
// resetto hw lst
await EC_ActionReq.InvokeAsync(DataAction.ResetHwOpt);
// richiesta calcolo opzioni hardware per la singola sash group
List<int> reqList = SashList.Select(x => x.GroupId).ToList();
// chiamo con gruppo della nuova sash
await DoReqOptHardware(reqList);
}
}
/// <summary>
/// Aggiornamento Frame
/// </summary>
/// <param name="newFrame"> nuovo frame</param>
/// <returns></returns>
private async Task UpdatePreviewSplit(DataUpdateSplit args)
{
Split newSplit = args.currSplit;
bool forceSvgNoHw = args.svgNoHw;
if (newSplit != null)
{
// cerco il record
var currRec = SearchArea(FrameWindow, newSplit.GroupId, newSplit);
// lo aggiorno
currRec = newSplit;
if(forceSvgNoHw)
await DoPreviewSvg(true,true);
else
await DoPreviewSvg();
}
}
/// <summary>
/// Metodo per aggiornare Splitted
/// </summary>
/// <param name="currSplitted"> Splitted da aggiornare</param>
/// <returns></returns>
private async Task UpdatePreviewSplitted(Splitted currSplitted)
{
if (currSplitted != null)
{
var item = SearchArea(FrameWindow, currSplitted.GroupId, currSplitted);
item = currSplitted;
// ricalcolo liste
UpdateLists();
// richiedo update shape
List<int> reqList = SashList.Select(x => x.GroupId).ToList();
await DoPreviewSvg();
await DoReqShape(reqList);
}
}
/// <summary>
@@ -1386,42 +1263,27 @@ namespace WebWindowComplex
/// </summary>
/// <param name="newSash"> nuova sash </param>
/// <returns></returns>
private async Task UpdateHwOptions(Sash newSash)
private async Task UpdatePreviewSashGroup(DataUpdateSash args)
{
// resetto hw lst
await EC_ActionReq.InvokeAsync(DataAction.ResetHwOpt);
// richiesta calcolo opzioni hardware per la singola sash group
//string req = newSash.SelHardware.Id;
List<int> reqList = new List<int>() { newSash.GroupId };
// chiamo con gruppo della nuova sash
await DoReqOptHardware(reqList);
//ReqResetHwOpt();
}
/// <summary>
/// Aggiornamento Sash e Frame
/// </summary>
/// <param name="newSash"> nuova sash </param>
/// <returns></returns>
private async Task UpdateSash(Sash newSash)
{
SearchSash(FrameWindow, newSash.GroupId, newSash);
await DoPreviewSvg();
}
/// <summary>
/// Aggiornamento Shape x ogni Group di Sash della finestra
/// </summary>
/// <param name="newFrame"></param>
/// <returns></returns>
private async Task UpdateShape(Frame newFrame)
{
FrameWindow = newFrame;
if (SashList.Count > 0)
Sash newSash = args.currSash;
bool svgNoHw = args.svgNoHw;
if (svgNoHw)
{
// ciclo x ogni group della mia frame
List<int> reqList = SashList.Select(x => x.GroupId).ToList();
await DoReqShape(reqList);
Sash item = (Sash)SearchArea(FrameWindow, newSash.GroupId, newSash);
if (newSash != null && item != null)
{
item = newSash;
await DoPreviewSvg(true, true);
}
}
else
{
Sash item = (Sash)SearchArea(FrameWindow, newSash.GroupId, newSash);
if (newSash != null && item != null)
{
item = newSash;
await DoPreviewSvg();
}
}
}
+188 -1
View File
@@ -6,7 +6,7 @@
<TargetFramework>net8.0</TargetFramework>
<Nullable>enable</Nullable>
<ImplicitUsings>enable</ImplicitUsings>
<Version>2.7.11.1109</Version>
<Version>2.7.12.515</Version>
<Authors>Annamaria Sassi</Authors>
<Company>Egalware</Company>
<Description>Componente gestione Configurazioni avanzate Window per LUX</Description>
@@ -49,6 +49,193 @@
@@ -6,7 +6,7 @@
<TargetFramework>net8.0</TargetFramework>
<Nullable>enable</Nullable>
<ImplicitUsings>enable</ImplicitUsings>
<Version>2.7.11.1109</Version>
<Version>2.7.12.515</Version>
<Authors>Annamaria Sassi</Authors>
<Company>Egalware</Company>
<Description>Componente gestione JWD per LUX</Description>
@@ -69,6 +69,321 @@
+4 -106
View File
@@ -1011,114 +1011,12 @@ namespace WebWindowConfigurator
}
}
//private Hardware m_SelHardware;
//public Hardware SelHardware
//{
// get
// {
// return m_SelHardware;
// }
// set
// {
// m_SelHardware = value;
// if (m_SelHardware != null && m_SelHardware.sId != "000000")
// {
// string sHwdOptPath = "";
// var gf = EgtLuaCreateGlobTable("WDG");
// var tft = EgtLuaSetGlobIntVar("WDG.AREAID", m_nAreaId);
// var tfy = EgtLuaSetGlobStringVar("WDG.HDWFAVOURITE", value.sId);
// SashDimension HandleSash = m_SashList.FirstOrDefault(x => x.bHasHandle);
// string sHandle = "Dx";
// switch (GetOpeningSide(HandleSash.OpeningType))
// {
// case object _ when OpeningSides.LEFT:
// {
// sHandle = "Sx";
// break;
// }
// case object _ when OpeningSides.RIGHT:
// {
// sHandle = "Dx";
// break;
// }
// }
// var tfd = EgtLuaSetGlobStringVar("WDG.HDWHANDLE", sHandle);
// var tlt = EgtLuaCallFunction("WinCreate_GetHardwareOptionPath");
// var tltf = EgtLuaGetGlobStringVar("WDG.HWDOPTPATH", sHwdOptPath);
// if (!string.IsNullOrWhiteSpace(sHwdOptPath))
// {
// XmlSerializer serializer = new XmlSerializer(typeof(ParametriOpzioni));
// ParametriOpzioni HwdOptions = null/* TODO Change to default(_) if this is not a reference type */;
// string sHdwOptPath = Path.ChangeExtension(sHwdOptPath, ".opt");
// bool bHdwOptFound = false;
// for (var WaitIndex = 0; WaitIndex <= 100; WaitIndex++)
// {
// if (File.Exists(sHdwOptPath))
// {
// bHdwOptFound = true;
// break;
// }
// System.Threading.Thread.Sleep(100);
// }
// if (bHdwOptFound)
// {
// string sHwdOptText = "";
// try
// {
// sHwdOptText = File.ReadAllText(sHdwOptPath);
// }
// catch (Exception ex)
// {
// EgtOutLog("Hardware file opt not found or read!");
// }
// if (!string.IsNullOrWhiteSpace(sHwdOptText))
// {
// using (TextReader reader = new StringReader(sHwdOptText))
// {
// HwdOptions = serializer.Deserialize(reader);
// }
// if (!IsNothing(HwdOptions))
// {
// m_HwdOptionList.Clear();
// foreach (var HdwOption in HwdOptions.Items)
// m_HwdOptionList.Add(new AGBOption(HdwOption));
// NotifyPropertyChanged(nameof(HwdOptionList));
// }
// }
// }
// var ud = EgtLuaResetGlobVar("WDG");
// }
// }
// }
//}
//internal void SetSelHardware(Hardware value)
//{
// m_SelHardware = value;
//}
//internal void SetSelHardwareFromId(string sId)
//{
// m_SelHardware = m_HardwareList.FirstOrDefault(x => x.sId == sId);
// if (IsNothing(m_SelHardware))
// m_SelHardware = m_HardwareList(0);
//}
//internal void SetFirstHardware()
//{
// if (m_HardwareList.Count > 0)
// {
// m_SelHardware = m_HardwareList(0);
// }
//}
private ObservableCollection<AGBOption> m_HwdOptionList = new ObservableCollection<AGBOption>();
public ObservableCollection<AGBOption> HwdOptionList
private ObservableCollection<AGBOption> m_HwOptionList = new ObservableCollection<AGBOption>();
public ObservableCollection<AGBOption> HwOptionList
{
get
{
return m_HwdOptionList;
return m_HwOptionList;
}
}
@@ -1248,7 +1146,7 @@ namespace WebWindowConfigurator
internal void RefreshHardwareOptionList()
{
m_HwdOptionList.Clear();
m_HwOptionList.Clear();
}
internal OpeningSides GetOpeningSide(Openings OpeningType)
+8 -8
View File
@@ -78,7 +78,7 @@ namespace WebWindowTest.Models
{
get
{
return m_HwdOptionList;
return m_HwOptionList;
}
}
@@ -86,7 +86,7 @@ namespace WebWindowTest.Models
{
get
{
return m_SelHwdOptionList;
return m_SelHwOptionList;
}
}
@@ -652,7 +652,7 @@ namespace WebWindowTest.Models
internal void RefreshHardwareOptionList()
{
m_HwdOptionList.Clear();
m_HwOptionList.Clear();
//ReqRefreshHwOption();
}
@@ -718,19 +718,19 @@ namespace WebWindowTest.Models
HwOptions = (ParametriOpzioni)serializer.Deserialize(reader);
if (HwOptions.Items != null)
{
m_HwdOptionList.Clear();
m_HwOptionList.Clear();
foreach (var HwOption in HwOptions.Items)
{
switch (HwOption.Tipo)
{
case "Text":
{
m_HwdOptionList.Add(new AGBOptionText(HwOption));
m_HwOptionList.Add(new AGBOptionText(HwOption));
break;
}
case "List":
{
m_HwdOptionList.Add(new AGBOptionCombo(HwOption));
m_HwOptionList.Add(new AGBOptionCombo(HwOption));
break;
}
}
@@ -873,8 +873,8 @@ namespace WebWindowTest.Models
private string m_CurrShape = "";
private List<Hardware> m_HardwareList = new List<Hardware>();
private List<AGBOption> m_HwdOptionList = new List<AGBOption>();
private Dictionary<string, string> m_SelHwdOptionList = new Dictionary<string, string>();
private List<AGBOption> m_HwOptionList = new List<AGBOption>();
private Dictionary<string, string> m_SelHwOptionList = new Dictionary<string, string>();
private List<Joint> m_JointList = new List<Joint>();