- modificata funzionalità bottone save

- aggiunti nuovi esempi JWD
- aggiunto SVG
- modificati titoli tabs
- modificata tabs Frame
- aggiunti metodi deserialize
This commit is contained in:
Annamaria Sassi
2025-07-16 19:06:10 +02:00
parent f3e82c300f
commit 7eaeca2bce
11 changed files with 1051 additions and 246 deletions
@@ -8,9 +8,9 @@ namespace WebWindowConfigurator.DTO
{
public class TemplateSelectDTO
{
public int Index { get; set; } = 0;
public string Description { get; set; } = "";
public string TemplFile { get; set; } = "";
public string TemplSVG { get; set; } = "";
}
}
+87 -62
View File
@@ -276,34 +276,40 @@ namespace WebWindowConfigurator.Json
{
}
public JsonSash(bool bIsSashVertical, SashTypes SashType, string Hardware) : base(AreaTypes.SASH)
public JsonSash(bool bIsSashVertical, SashTypes SashType/*, string Hardware*/) : base(AreaTypes.SASH)
{
m_bIsSashVertical = bIsSashVertical;
m_SashType = SashType;
m_Hardware = Hardware;
}
//internal override Area Deserialize(Area ParentArea)
//{
// Sash Sash = new Sash(ParentArea);
// Sash.SetAreaType(AreaTypes.SASH);
// Sash.SetSashQty(m_SashList.Count);
// Sash.SetIsSashVertical(m_bIsSashVertical);
// Sash.AppliedDone();
// for (var SashIndex = 0; SashIndex <= m_SashList.Count - 1; SashIndex++)
// {
// Sash.SashList(SashIndex).SetOpeningType(m_SashList[SashIndex].OpeningType);
// Sash.SashList(SashIndex).SetHasHandle(m_SashList[SashIndex].bHasHandle);
// Sash.SashList(SashIndex).SetDimension(m_SashList[SashIndex].dDimension);
// }
// foreach (var Joint in m_JointList)
// Sash.JointList.Add(Joint.Deserialize());
// Sash.RefreshHardwareList();
// Sash.SetSelHardwareFromId(Hardware);
// foreach (var Area in JsonArea.AreaList)
// Sash.AreaList.Add(Area.Deserialize(Sash));
// return Sash;
//}
internal override Area Deserialize(Area ParentArea)
{
Sash Sash = new Sash(ParentArea);
Sash.SetAreaType(AreaTypes.SASH);
Sash.SetSashQty(m_SashList.Count);
Sash.SetIsSashVertical(m_bIsSashVertical);
//Sash.AppliedDone();
for (var SashIndex = 0; SashIndex <= m_SashList.Count - 1; SashIndex++)
{
Sash.SashList[SashIndex].SetOpeningType(m_SashList[SashIndex].OpeningType);
Sash.SashList[SashIndex].SetHasHandle(m_SashList[SashIndex].bHasHandle);
Sash.SashList[SashIndex].SetDimension(m_SashList[SashIndex].dDimension);
}
foreach (var Joint in m_JointList)
Sash.JointList.Add(Joint.Deserialize());
//Sash.RefreshHardwareList();
//Sash.SetSelHardwareFromId(Hardware);
foreach (var Area in AreaList)
{
var AreaDeserealized = Area.Deserialize(Sash);
if (AreaDeserealized != null)
{
Sash.AreaList.Add(AreaDeserealized);
}
}
return Sash;
}
}
public class JsonSplit : JsonArea
@@ -346,22 +352,28 @@ namespace WebWindowConfigurator.Json
m_SplitShape = SplitShape;
}
//internal override Area Deserialize(Area ParentArea)
//{
// Split Split = new Split(ParentArea);
// Split.SetAreaType(AreaTypes.SPLIT);
// Split.SetSplitShape(m_SplitShape, true);
// Split.SetSplitQty(m_SplitPositionList.Count - 1, true);
// Split.AppliedDone();
// for (var SplitIndex = 0; SplitIndex <= m_SplitPositionList.Count - 1; SplitIndex++)
// {
// Split.SplitPositionList(SplitIndex).SetIsRelative(m_SplitPositionList[SplitIndex].bIsRelative);
// Split.SplitPositionList(SplitIndex).SetDimension(m_SplitPositionList[SplitIndex].dDimension);
// }
// foreach (var Area in JsonArea.AreaList)
// Split.AreaList.Add(Area.Deserialize(Split));
// return Split;
//}
internal override Area Deserialize(Area ParentArea)
{
Split Split = new Split(ParentArea);
Split.SetAreaType(AreaTypes.SPLIT);
Split.SetSplitShape(m_SplitShape, true);
Split.SetSplitQty(m_SplitPositionList.Count - 1, true);
//Split.AppliedDone();
for (var SplitIndex = 0; SplitIndex <= m_SplitPositionList.Count - 1; SplitIndex++)
{
Split.SplitPositionList[SplitIndex].SetIsRelative(m_SplitPositionList[SplitIndex].bIsRelative);
Split.SplitPositionList[SplitIndex].SetDimension(m_SplitPositionList[SplitIndex].dDimension);
}
foreach (var Area in AreaList)
{
var AreaDeserealized = Area.Deserialize(Split);
if (AreaDeserealized != null)
{
Split.AreaList.Add(AreaDeserealized);
}
}
return Split;
}
}
public class JsonSplitted : JsonArea
@@ -370,15 +382,22 @@ namespace WebWindowConfigurator.Json
{
}
//internal override Area Deserialize(Area ParentArea)
//{
// Splitted Split = new Splitted(ParentArea);
// Split.SetAreaType(AreaTypes.SPLITTED);
// Split.AppliedDone();
// foreach (var Area in JsonArea.AreaList)
// Split.AreaList.Add(Area.Deserialize(Split));
// return Split;
//}
internal override Area Deserialize(Area ParentArea)
{
Splitted Split = new Splitted(ParentArea);
Split.SetAreaType(AreaTypes.SPLITTED);
//Split.AppliedDone();
foreach (var Area in AreaList)
{
var AreaDeserealized = Area.Deserialize(Split);
if (AreaDeserealized != null)
{
Split.AreaList.Add(AreaDeserealized);
}
}
return Split;
}
}
public class JsonFill : JsonArea
@@ -407,16 +426,22 @@ namespace WebWindowConfigurator.Json
m_FillType = FillType;
}
//internal override Area Deserialize(Area ParentArea)
//{
// Fill Fill = new Fill(ParentArea);
// Fill.SetAreaType(AreaTypes.FILL);
// Fill.SetFillType(m_FillType);
// Fill.AppliedDone();
// foreach (var Area in JsonArea.AreaList)
// Fill.AreaList.Add(Area.Deserialize(Fill));
// return Fill;
//}
internal override Area Deserialize(Area ParentArea)
{
Fill Fill = new Fill(ParentArea);
Fill.SetAreaType(AreaTypes.FILL);
Fill.SetFillType(m_FillType);
//Fill.AppliedDone();
foreach (var Area in AreaList)
{
var AreaDeserealized = Area.Deserialize(Fill);
if (AreaDeserealized != null)
{
Fill.AreaList.Add(AreaDeserealized);
}
}
return Fill;
}
}
public class JsonJoint
@@ -452,11 +477,11 @@ namespace WebWindowConfigurator.Json
m_JointType = JointType;
}
//internal Joint Deserialize()
//{
// Joint Joint = new Joint(m_nIndex, m_JointType);
// return Joint;
//}
internal Joint Deserialize()
{
Joint Joint = new Joint(m_nIndex, m_JointType);
return Joint;
}
}
public class JsonCurve
+12 -2
View File
@@ -28,11 +28,21 @@ namespace WebWindowConfigurator
}
}
public Template(int nIndex, string sDescription, string JWDTemplate)
private string m_SVG;
public string SVG
{
get
{
return m_SVG;
}
}
public Template(int nIndex, string sDescription, string JWD, string SVG)
{
m_nIndex = nIndex;
this.sDescription = sDescription;
m_JWD = JWDTemplate;
m_JWD = JWD;
m_SVG = SVG;
}
}
}
+100 -65
View File
@@ -1,59 +1,69 @@
<div class="card text-center">
<div class="card-header">
<div class="card-header" style="background-color: #d5f1f2;">
<ul class="nav nav-tabs card-header-tabs">
<li class="nav-item">
@if(currStep == CompileStep.General)
@if (currStep == CompileStep.Template)
{
<a href="#" data-target="#General" class="nav-link active" aria-current="true" @onclick="() => AdvStep(CompileStep.General)">General</a>
<a href="#" data-target="#Template" class="nav-link active fw-bold" aria-current="true" @onclick="() => AdvStep(CompileStep.Template)">Template</a>
}
else
{
<a href="#" data-target="#General" class="nav-link" @onclick="() => AdvStep(CompileStep.General)">General</a>
<a href="#" data-target="#Template" class="nav-link text-secondary" @onclick="() => AdvStep(CompileStep.Template)">Template</a>
}
</li>
<li class="nav-item">
@if (currStep == CompileStep.Sash)
@if (currStep == CompileStep.Frame)
{
<a href="#" data-target="#Sash" class="nav-link active" aria-current="true" @onclick="() => AdvStep(CompileStep.Sash)">Sash</a>
<a href="#" data-target="#Frame" class="nav-link active fw-bold" aria-current="true" @onclick="() => AdvStep(CompileStep.Frame)">Frame</a>
}
else
{
<a href="#" data-target="#Sash" class="nav-link" @onclick="() => AdvStep(CompileStep.Sash)">Sash</a>
<a href="#" data-target="#Frame" class="nav-link text-secondary" @onclick="() => AdvStep(CompileStep.Frame)">Frame</a>
}
</li>
<li class="nav-item">
@if (currStep == CompileStep.Split)
{
<a href="#" data-target="#Split" class="nav-link active" aria-current="true" @onclick="() => AdvStep(CompileStep.Split)">Split</a>
<a href="#" data-target="#Split" class="nav-link active fw-bold" aria-current="true" @onclick="() => AdvStep(CompileStep.Split)">Split</a>
}
else
{
<a href="#" data-target="#Split" class="nav-link" @onclick="() => AdvStep(CompileStep.Split)">Split</a>
<a href="#" data-target="#Split" class="nav-link text-secondary" @onclick="() => AdvStep(CompileStep.Split)">Split</a>
}
</li>
<li class="nav-item">
@if (currStep == CompileStep.Fill)
@if (currStep == CompileStep.Sash)
{
<a href="#" data-target="#Fill" class="nav-link active" aria-current="true" @onclick="() => AdvStep(CompileStep.Fill)">Fill</a>
<a href="#" data-target="#Sash" class="nav-link active fw-bold" aria-current="true" @onclick="() => AdvStep(CompileStep.Sash)">Sash</a>
}
else
{
<a href="#" data-target="#Fill" class="nav-link" @onclick="() => AdvStep(CompileStep.Fill)">Fill</a>
<a href="#" data-target="#Sash" class="nav-link text-secondary" @onclick="() => AdvStep(CompileStep.Sash)">Sash</a>
}
</li>
<li class="nav-item">
@if (currStep == CompileStep.Fill)
{
<a href="#" data-target="#Fill" class="nav-link active fw-bold" aria-current="true" @onclick="() => AdvStep(CompileStep.Fill)">Fill</a>
}
else
{
<a href="#" data-target="#Fill" class="nav-link text-secondary" @onclick="() => AdvStep(CompileStep.Fill)">Fill</a>
}
</li>
</ul>
</div>
<div class="card-body">
<div class="alert alert-light text-center display-4">
@if (currStep == CompileStep.General)
@if (currStep == CompileStep.Template)
{
<table class="table table-hover">
<thead class="table-light fs-5">
<tr>
<th scope="col">#</th>
<th scope="col">Image</th>
<th scope="col">Description</th>
<th scope="col" class="text-start">Description</th>
</tr>
</thead>
<tbody class="table-group-divider fs-5">
@@ -66,68 +76,86 @@
colorClass = "";
<tr class="@colorClass" @onclick="() => DoSelect(item)">
<td>@item.Index</td>
<td>...</td>
<td>@item.Description</td>
<td>@item.TemplSVG</td>
<td class="text-start">@item.Description</td>
</tr>
}
</tbody>
</table>
@*<button class="btn btn-sm btn-primary" title="Reset selezione" @onclick="DoReset"><i class="fa-solid fa-arrow-rotate-right"></i></button> *@
}
else if (currStep == CompileStep.Sash)
else if (currStep == CompileStep.Frame)
{
<div class="alert alert-light text-center display-4">
@foreach (FrameDimension dimension in m_frame.DimensionList)
{
<div class="input-group mb-3 w-25">
<span class="input-group-text" id="basic-addon1">@dimension.nIndex</span>
<span class="input-group-text" id="basic-addon1">@dimension.sName</span>
<input type="number" class="form-control" aria-label="@dimension.dValue" @bind="@dimension.dValue">
</div>
}
<div class="input-group mb-3 w-25">
<label class="input-group-text" for="inputGroupSelect01">Shape</label>
<select class="form-select" @bind="@m_frame.SelShapeIndex">
<option value="0">Rettangolo</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 class="input-group w-50">
@foreach (Joint joint in m_frame.JointList)
{
<div class="input-group mb-3 w-50">
<label class="input-group-text" for="inputGroupSelect02">Giunzioni telaio @joint.nIndex</label>
<select class="form-select" @bind="@joint.SelJointTypeIndex">
<option value="0">Angled</option>
<option value="1">Full H</option>
<option value="2">Full V</option>
</select>
<div class="container">
<div class="row">
<div class="col-6">
<div class="alert alert-light text-start p-1 display-4 w-50">
<div class="input-group mb-2">
<label class="input-group-text" for="inputGroupSelect01">Shape</label>
<select class="form-select" @bind="@m_frame.SelShapeIndex">
<option value="0">Rettangolo</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 class="border mb-2">
<div class="card-body py-2">
<h5 class="card-title">Dimensioni</h5>
@foreach (FrameDimension dimension in m_frame.DimensionList)
{
<div class="input-group mb-2">
<span class="input-group-text" id="basic-addon1">@dimension.nIndex</span>
<span class="input-group-text" id="basic-addon2">@dimension.sName</span>
<input type="number" class="form-control" aria-label="@dimension.dValue" @bind="@dimension.dValue">
</div>
}
</div>
</div>
<div class="border mb-2">
<div class="card-body py-2">
<h5 class="card-title">Giunzioni telaio</h5>
@foreach (Joint joint in m_frame.JointList)
{
<div class="input-group mb-2">
<label class="input-group-text" for="inputGroupSelect02">@joint.nIndex</label>
<select class="form-select" @bind="@joint.SelJointTypeIndex">
<option value="0">Angled</option>
<option value="1">Full H</option>
<option value="2">Full V</option>
</select>
</div>
}
</div>
</div>
<div class="border mb-2">
<div class="card-body py-2">
<h5 class="card-title">Bottom rail</h5>
<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="BottomRail" id="BottomRail" @bind="@m_frame.BottomRail">
</div>
<div class="px-2">
<label class="form-check-label fs-6 text-dark" for="checkDefault">BottomRail</label>
</div>
</div>
<div class="input-group mb-2">
<span class="input-group-text" id="basic-addon1">Quantità</span>
<input type="number" class="form-control" aria-label="BottomRailQty" @bind="@m_frame.BottomRailQty">
</div>
</div>
</div>
@* <button class="btn btn-sm btn-primary" title="Reset selezione" @onclick="DoReset"><i class="fa-solid fa-arrow-rotate-right"></i></button> *@
</div>
}
</div>
<div class="d-flex justify-content-start fs-5 mb-3 w-25">
<div class="p-2">
<input class="form-check-input ml-auto"
type="checkbox"
name="BottomRail"
id="BottomRail"
@bind="@m_frame.BottomRail">
</div>
<div class="p-2">
<label class="form-check-label" for="checkDefault">BottomRail</label>
<div class="col-6">
@m_SelSVG
</div>
</div>
<div class="input-group mb-3 w-25">
<span class="input-group-text" id="basic-addon1">BottomRailQty</span>
<input type="number" class="form-control" aria-label="BottomRailQty" @bind="@m_frame.BottomRailQty">
</div>
@* <button class="btn btn-sm btn-primary" title="Reset selezione" @onclick="DoReset"><i class="fa-solid fa-arrow-rotate-right"></i></button> *@
</div>
}
else if (currStep == CompileStep.Split)
@@ -137,6 +165,13 @@
@* <button class="btn btn-sm btn-primary" title="Reset selezione" @onclick="DoReset"><i class="fa-solid fa-arrow-rotate-right"></i></button> *@
</div>
}
else if (currStep == CompileStep.Sash)
{
<div class="alert alert-info text-center display-4">
aggiungi caratteristiche finestra
@* <button class="btn btn-sm btn-primary" title="Reset selezione" @onclick="DoReset"><i class="fa-solid fa-arrow-rotate-right"></i></button> *@
</div>
}
else if (currStep == CompileStep.Fill)
{
<div class="alert alert-info text-center display-4">
+13 -14
View File
@@ -1,5 +1,6 @@
using Microsoft.AspNetCore.Components;
using Newtonsoft.Json;
using System.Collections.ObjectModel;
using System.Reflection.Metadata;
using System.Runtime.Intrinsics.X86;
using System.Text.Json.Serialization;
@@ -28,38 +29,36 @@ namespace WebWindowConfigurator
[Parameter]
public Template IN_SelTemplate
{
get => mSelTemplate;
get => m_SelTemplate;
set {
if (value != null && !string.IsNullOrEmpty(value.JWD))
if (value != null && (m_SelTemplate == null || (m_SelTemplate != null && value.nIndex != m_SelTemplate.nIndex)) && !string.IsNullOrEmpty(value.JWD))
{
mSelTemplate = value;
JsonWindow WindowFromJson = JsonConvert.DeserializeObject<JsonWindow>(mSelTemplate.JWD, new PolymorphicJsonConverter());
m_SelTemplate = value;
JsonWindow WindowFromJson = JsonConvert.DeserializeObject<JsonWindow>(m_SelTemplate.JWD, new PolymorphicJsonConverter());
m_CurrWindow = WindowFromJson.Deserialize();
m_SelSVG = m_SelTemplate.SVG;
}
}
}
private Template mSelTemplate { get; set; } = null!;
private Template m_SelTemplate { get; set; } = null!;
public TemplateSelectDTO? SelTemplateDTO { get; set; } = null;
public Area m_SelArea { get; set; } = null!;
public string m_SelSVG { get; set; } = "";
#endregion Public Properties
#region Public Methods
#endregion Public Methods
#region Protected Enums
protected enum CompileStep
{
General = 0,
Sash = 1,
Template = 0,
Frame = 1,
Split,
Sash,
Fill
}
@@ -71,7 +70,7 @@ namespace WebWindowConfigurator
{
get => (Frame)m_CurrWindow.AreaList[0];
}
#endregion Protected Properties
#region Protected Methods
@@ -105,7 +104,7 @@ namespace WebWindowConfigurator
#region Private Fields
private CompileStep currStep = CompileStep.General;
private CompileStep currStep = CompileStep.Template;
#endregion Private Fields
+468 -100
View File
@@ -1,64 +1,17 @@
using Newtonsoft.Json.Linq;
using System.Collections;
using System.Collections.ObjectModel;
using System.ComponentModel;
using System.Drawing;
using System.Runtime.Intrinsics.Arm;
using System.Xml.Serialization;
using WebWindowConfigurator;
using WebWindowConfigurator.Json;
using static WebWindowConfigurator.Json.WindowConst;
namespace WebWindowConfigurator
{
public class FrameDimension
{
private bool m_bIsLen = false;
private int m_nIndex;
public int nIndex
{
get
{
return m_nIndex;
}
}
private string m_sName;
public string sName
{
get
{
return m_sName;
}
}
private double m_dValue;
public double dValue
{
get
{
return m_dValue;
}
set
{
m_dValue = value;
}
}
public FrameDimension(int nIndex, string sName, double dValue, bool bIsLen)
{
m_nIndex = nIndex;
m_sName = sName;
m_dValue = dValue;
m_bIsLen = bIsLen;
}
internal JsonFrameDimension Serialize()
{
JsonFrameDimension JsonFrameDimension = new JsonFrameDimension(m_nIndex, m_sName, m_dValue);
return JsonFrameDimension;
}
}
public class Window
{
private String m_sProfilePath;
@@ -1107,71 +1060,332 @@ namespace WebWindowConfigurator
}
}
public class Split : Area
{
public int nSplitQty
{
get
{
return m_SplitPositionList.Count > 0 ? m_SplitPositionList.Count - 1 : 0;
}
set
{
if (value > m_SplitPositionList.Count - 1)
{
// recupero larghezza ultimo
double dLastDimension = 100;
double dNewDimension = 100;
if (m_SplitPositionList.Count > 0)
{
dLastDimension = m_SplitPositionList[m_SplitPositionList.Count - 1].dDimension;
dNewDimension = dLastDimension / (value + 1 - nSplitQty);
m_SplitPositionList[m_SplitPositionList.Count - 1].SetDimension(dNewDimension);
}
else
dNewDimension = dLastDimension / (value + 1 - nSplitQty);
// aggiungo area Split di default
for (var SplitIndex = m_SplitPositionList.Count; SplitIndex <= value; SplitIndex++)
SplitPositionList.Add(new SplitDimension(dNewDimension, true, this));
}
else if (value < m_SplitPositionList.Count - 1)
{
double dLastDimension = 0;
for (var SplitIndex = m_SplitPositionList.Count - 1; SplitIndex >= value + 1; SplitIndex += -1)
{
dLastDimension += m_SplitPositionList[SplitIndex].dDimension;
SplitPositionList.RemoveAt(SplitIndex);
}
dLastDimension += m_SplitPositionList[SplitPositionList.Count - 1].dDimension;
SplitPositionList[SplitPositionList.Count - 1].SetDimension(dLastDimension);
}
}
}
internal void SetSplitQty(int Qty, bool NotifyProperty = false)
{
if (Qty > m_SplitPositionList.Count)
{
// recupero larghezza ultimo
double dLastDimension = 100;
double dNewDimension = 100;
if (m_SplitPositionList.Count > 0)
{
dLastDimension = m_SplitPositionList[m_SplitPositionList.Count - 1].dDimension;
dNewDimension = dLastDimension / (Qty + 1 - nSplitQty);
m_SplitPositionList[m_SplitPositionList.Count - 1].dDimension = dNewDimension;
}
else
dNewDimension = dLastDimension / (Qty + 1 - nSplitQty);
// aggiungo area Split di default
for (var SplitIndex = m_SplitPositionList.Count; SplitIndex <= Qty; SplitIndex++)
SplitPositionList.Add(new SplitDimension(dNewDimension, true, this));
}
else if (Qty < m_SplitPositionList.Count)
{
for (var SplitIndex = m_SplitPositionList.Count - 1; SplitIndex >= Qty; SplitIndex += -1)
SplitPositionList.RemoveAt(SplitIndex);
}
}
private ObservableCollection<IdNameStruct> m_SplitShapeList = new ObservableCollection<IdNameStruct>
{
new IdNameStruct((int)SplitShapes.VERTICAL, "Vertical"),
new IdNameStruct((int)SplitShapes.HORIZONTAL, "Horizontal"),
new IdNameStruct((int)SplitShapes.GRID, "Grid"),
new IdNameStruct((int)SplitShapes.CUSTOM, "Custom")
};
public ObservableCollection<IdNameStruct> SplitShapeList
{
get
{
return m_SplitShapeList;
}
}
private SplitShapes m_SelSplitShape;
public int SelSplitShapeIndex
{
get
{
return IdNameStruct.IndFromId((int)m_SelSplitShape, m_SplitShapeList);
}
set
{
m_SelSplitShape = (SplitShapes)IdNameStruct.IdFromInd(value, m_SplitShapeList);
}
}
internal void SetSplitShape(SplitShapes Value, bool NotifyProperty = false)
{
m_SelSplitShape = Value;
}
internal SplitShapes SelSplitShape
{
get
{
return m_SelSplitShape;
}
}
private bool m_bIsPercentage = true;
public bool bIsPercentage
{
get
{
return m_bIsPercentage;
}
}
private ObservableCollection<SplitDimension> m_SplitPositionList = new ObservableCollection<SplitDimension>();
public ObservableCollection<SplitDimension> SplitPositionList
{
get
{
return m_SplitPositionList;
}
set
{
m_SplitPositionList = value;
}
}
private Curve m_Split;
public Curve sSplit
{
get
{
return m_Split;
}
set
{
m_Split = value;
}
}
public Split(Area ParentArea) : base(ParentArea)
{
}
internal static Split CreateSplit(Area Area, SplitShapes SplitShape)
{
Split Split = new Split(Area);
Split.SetAreaType(AreaTypes.SPLIT);
Split.SetSplitShape(SplitShape, true);
return Split;
}
internal override JsonArea Serialize()
{
JsonSplit JsonSplit = new JsonSplit(m_SelSplitShape);
foreach (var SplitPosition in m_SplitPositionList)
JsonSplit.SplitPositionList.Add(SplitPosition.Serialize());
foreach (var Area in AreaList)
JsonSplit.AreaList.Add(Area.Serialize());
return JsonSplit;
}
}
public class Splitted : Area
{
public Splitted(Area ParentArea) : base(ParentArea)
{
}
internal static Splitted CreateSplitted(Area Area)
{
Splitted Splitted = new Splitted(Area);
Splitted.SetAreaType(AreaTypes.SPLITTED);
return Splitted;
}
internal override JsonArea Serialize()
{
JsonSplitted JsonSplitted = new JsonSplitted();
foreach (var Area in AreaList)
JsonSplitted.AreaList.Add(Area.Serialize());
return JsonSplitted;
}
}
public class Fill : Area
{
public FillTypes FillType
{
get
{
if (m_Fill_IsChecked[0])
return FillTypes.GLASS;
else
return FillTypes.WOOD;
}
}
internal void SetFillType(FillTypes FillType)
{
switch (FillType)
{
case FillTypes.GLASS:
{
bGlass_IsChecked = true;
break;
}
case FillTypes.WOOD:
{
bWood_IsChecked = true;
break;
}
}
}
private bool[] m_Fill_IsChecked = new[] { false, false };
public bool bGlass_IsChecked
{
get
{
return m_Fill_IsChecked[0];
}
set
{
m_Fill_IsChecked[0] = value;
}
}
public bool bWood_IsChecked
{
get
{
return m_Fill_IsChecked[1];
}
set
{
m_Fill_IsChecked[1] = value;
}
}
public Fill(Area ParentArea) : base(ParentArea)
{
}
internal static Fill CreateFill(Area Area, FillTypes FillType)
{
Fill Fill = new Fill(Area);
Fill.SetAreaType(AreaTypes.FILL);
Fill.SetFillType(FillType);
return Fill;
}
internal override JsonArea Serialize()
{
JsonFill JsonFill = new JsonFill(FillType);
foreach (var Area in AreaList)
JsonFill.AreaList.Add(Area.Serialize());
return JsonFill;
}
}
public class Joint
{
private int m_nIndex;
public int nIndex
{
get
private int m_nIndex;
public int nIndex
{
return m_nIndex;
get
{
return m_nIndex;
}
}
}
private List<IdNameStruct> m_JointTypeList = new List<IdNameStruct>
{
new IdNameStruct((int)Joints.ANGLED, "Angled"),
new IdNameStruct((int)Joints.FULL_H, "Full H"),
new IdNameStruct((int)Joints.FULL_V, "Full V")
};
public List<IdNameStruct> JointTypeList
private List<IdNameStruct> m_JointTypeList = new List<IdNameStruct>
{
get
new IdNameStruct((int)Joints.ANGLED, "Angled"),
new IdNameStruct((int)Joints.FULL_H, "Full H"),
new IdNameStruct((int)Joints.FULL_V, "Full V")
};
public List<IdNameStruct> JointTypeList
{
return m_JointTypeList;
get
{
return m_JointTypeList;
}
}
}
private Joints m_SelJointType;
public int SelJointTypeIndex
private Joints m_SelJointType;
public int SelJointTypeIndex
{
get
{
return IdNameStruct.IndFromId((int)m_SelJointType, m_JointTypeList);
}
set
{
m_SelJointType = (Joints)IdNameStruct.IdFromInd(value, m_JointTypeList);
}
}
public Joints SelJointType
{
get
{
return m_SelJointType;
}
set
{
m_SelJointType = value;
}
}
internal void SetSelJointType(Joints value)
{
get
{
return IdNameStruct.IndFromId((int)m_SelJointType, m_JointTypeList);
}
set
{
m_SelJointType = (Joints)IdNameStruct.IdFromInd(value, m_JointTypeList);
}
m_SelJointType = value;
//NotifyPropertyChanged(nameof(SelJointTypeIndex));
}
public Joints SelJointType
{
get
public Joint(int nIndex, Joints SelJointType)
{
return m_SelJointType;
m_nIndex = nIndex;
m_SelJointType = SelJointType;
}
set
{
m_SelJointType = value;
}
}
internal void SetSelJointType(Joints value)
{
m_SelJointType = value;
//NotifyPropertyChanged(nameof(SelJointTypeIndex));
}
public Joint(int nIndex, Joints SelJointType)
{
m_nIndex = nIndex;
m_SelJointType = SelJointType;
}
internal JsonJoint Serialize()
{
JsonJoint JsonJoint = new JsonJoint(m_nIndex, m_SelJointType);
return JsonJoint;
internal JsonJoint Serialize()
{
JsonJoint JsonJoint = new JsonJoint(m_nIndex, m_SelJointType);
return JsonJoint;
}
}
}
public class Curve
{
@@ -1393,6 +1607,56 @@ namespace WebWindowConfigurator
}
}
public class FrameDimension
{
private bool m_bIsLen = false;
private int m_nIndex;
public int nIndex
{
get
{
return m_nIndex;
}
}
private string m_sName;
public string sName
{
get
{
return m_sName;
}
}
private double m_dValue;
public double dValue
{
get
{
return m_dValue;
}
set
{
m_dValue = value;
}
}
public FrameDimension(int nIndex, string sName, double dValue, bool bIsLen)
{
m_nIndex = nIndex;
m_sName = sName;
m_dValue = dValue;
m_bIsLen = bIsLen;
}
internal JsonFrameDimension Serialize()
{
JsonFrameDimension JsonFrameDimension = new JsonFrameDimension(m_nIndex, m_sName, m_dValue);
return JsonFrameDimension;
}
}
public class SashDimension
{
// reference
@@ -1633,6 +1897,110 @@ namespace WebWindowConfigurator
}
}
public class SplitDimension
{
// reference
private Split m_Parent;
private bool m_bIsRelative = false;
public bool bIsRelative
{
get
{
return m_bIsRelative;
}
}
internal void SetIsRelative(bool value)
{
m_bIsRelative = value;
}
private double m_dDimension;
public double dDimension
{
get
{
return m_dDimension;
}
set
{
// se sono in percentuale
if (m_bIsRelative)
{
// 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);
for (var Ind = nIndex + 1; Ind <= RelativeDimList.Count - 1; Ind++)
RelativeDimList[Ind].SetDimension(dRes);
}
else if (RelativeDimList.Count > 1)
{
for (var Ind = nIndex + 1; Ind <= RelativeDimList.Count - 1; Ind++)
dRes += RelativeDimList[Ind].dDimension;
dRes = (100 - dRes) / (nIndex - 1);
for (var nInd = 0; nInd <= nIndex - 1; nInd++)
RelativeDimList[nInd].SetDimension(dRes);
}
else
{
m_dDimension = 100;
return;
}
}
}
else
{
}
}
}
m_dDimension = value;
}
}
internal void SetDimension(double dValue)
{
m_dDimension = dValue;
}
public SplitDimension(double dDimension, bool bIsRelative, Split Parent)
{
m_dDimension = dDimension;
m_bIsRelative = bIsRelative;
m_Parent = Parent;
}
internal JsonSplitDimension Serialize()
{
JsonSplitDimension JsonSplitDimension = new JsonSplitDimension(m_bIsRelative, m_dDimension);
return JsonSplitDimension;
}
}
public struct IdNameStruct
{
private int m_Id;