Aggiornato modo per sollevare gli eventi di Frame, Fill, Splitted, Joint

This commit is contained in:
Annamaria Sassi
2025-11-26 10:30:53 +01:00
parent f56ed1052d
commit 30e69bde86
20 changed files with 356 additions and 403 deletions
+3 -3
View File
@@ -1,12 +1,12 @@
<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">
<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">
@@ -14,7 +14,7 @@
{
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 @(SashList.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
@@ -11,32 +11,26 @@ namespace WebWindowComplex.Compo
/// <summary>
/// Lista delle sash
/// </summary>
[CascadingParameter(Name = "SashList")]
public List<Sash> SashList { get; set; } = null;
[Parameter]
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>
[CascadingParameter(Name = "SplittedList")]
public List<Splitted> SplittedList { 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
@@ -46,46 +40,28 @@ namespace WebWindowComplex.Compo
/// Sollevo evento richiesta copia 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
/// Sollevo evento richiesta aggiunta 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; }
}
}
+8 -8
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,16 +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 CurrSplitted="currSplitted"
EC_AddSash="AddSash"
EC_CopySash="CopySash">
</AreaSplit>
}
}
} *@
+5 -71
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,39 +32,10 @@ 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>
[CascadingParameter(Name = "SashList")]
public List<Sash> SashList { get; set; } = null!;
/// <summary>
/// Lista degli Splitted
/// </summary>
[CascadingParameter(Name = "SplittedList")]
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
/// </summary>
@@ -90,27 +43,8 @@ namespace WebWindowComplex.Compo
/// <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
@@ -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
+1 -1
View File
@@ -88,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="@CurrFrameWindow.BottomRailQty">
<input type="number" class="form-control" @bind="@FrameBottomRailQty">
</div>
</div>
}
+78 -39
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>
@@ -38,16 +20,16 @@ namespace WebWindowComplex.Compo
public EventCallback<bool> EC_ReqResetDictShape { get; set; }
/// <summary>
/// Evento per aggiornare info frame (es cambaire tutti i Joints)
/// Evento per richiedere reset dizionario Shape
/// </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
@@ -85,8 +67,36 @@ namespace WebWindowComplex.Compo
{
s.SelHardwareFromId = "000000";
}
_ = EC_UpdateFrame.InvokeAsync(CurrFrameWindow);
_ = EC_UpdateShape.InvokeAsync(CurrFrameWindow);
_ = EC_ReqOptionHw.InvokeAsync(CurrFrameWindow);
var args = new DataUpdateFrame()
{
currFrame = CurrFrameWindow,
svgNoHw = true
};
_ = EC_UpdatePreview.InvokeAsync(args);
//_ = EC_UpdateShape.InvokeAsync(CurrFrameWindow);
}
}
}
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);
}
}
}
@@ -101,8 +111,13 @@ namespace WebWindowComplex.Compo
/// <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>
@@ -111,7 +126,14 @@ namespace WebWindowComplex.Compo
/// <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_UpdatePreview.InvokeAsync(args);
}
/// <summary>
@@ -120,12 +142,19 @@ namespace WebWindowComplex.Compo
/// <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>
@@ -148,8 +177,13 @@ namespace WebWindowComplex.Compo
if (updRec != null)
{
currRec = updRec;
await EC_UpdateShape.InvokeAsync(CurrFrameWindow);
await EC_UpdateFrame.InvokeAsync(CurrFrameWindow);
var args = new DataUpdateFrame()
{
currFrame = CurrFrameWindow,
svgNoHw = true
};
await EC_ReqResetDictShape.InvokeAsync();
await EC_UpdatePreview.InvokeAsync(args);
}
}
@@ -166,7 +200,12 @@ namespace WebWindowComplex.Compo
if (updRec != null)
{
currRec = updRec;
await EC_UpdateFrame.InvokeAsync(CurrFrameWindow);
var args = new DataUpdateFrame()
{
currFrame = CurrFrameWindow,
svgNoHw = false
};
await EC_UpdatePreview.InvokeAsync(args);
}
}
@@ -184,14 +223,14 @@ namespace WebWindowComplex.Compo
}
/// <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
}
+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>
+1 -1
View File
@@ -17,7 +17,7 @@ namespace WebWindowComplex.Compo
#region Private Properties
private int CurrVal
private int CurrJoint
{
get => CurrRec.SelJointTypeIndex;
set
+1 -1
View File
@@ -251,7 +251,7 @@ namespace WebWindowComplex.Json
newFrame.SetBottomRailQty(m_nBottomRailQty);
//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)
+1 -1
View File
@@ -157,7 +157,7 @@ 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());
//ParentWindow.OnUpdatePreview(ParentWindow.sSerialized());
}
public abstract Area Copy(Area ParentArea);
-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)
{
-5
View File
@@ -29,7 +29,6 @@ namespace WebWindowComplex.Models
set
{
m_bBottomRail = value;
m_ParentWindow.OnUpdatePreview(m_ParentWindow.sSerialized());
}
}
@@ -53,7 +52,6 @@ namespace WebWindowComplex.Models
m_bBottomRail = false;
}
}
m_ParentWindow.OnUpdatePreview(m_ParentWindow.sSerialized());
}
}
@@ -79,12 +77,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)
{
@@ -213,7 +209,6 @@ namespace WebWindowComplex.Models
}
m_Shape = SelShape;
}
//m_ParentWindow.OnUpdatePreview(m_ParentWindow.sSerialized());
}
}
+22 -15
View File
@@ -33,18 +33,20 @@ namespace WebWindowComplex.Models
}
set
{
m_dValue = value;
if (value > MaxDim)
if(m_dValue != value)
{
m_dValue = MaxDim;
m_dValue = value;
if (value > MaxDim)
{
m_dValue = MaxDim;
}
else if (value < MinDim && !m_sName.Equals("Radius"))
{
m_dValue = MinDim;
}
if (ParentFrame.AreaList.Count > 0)
SearchAreaList(ParentFrame);
}
else if (value < MinDim && !m_sName.Equals("Radius"))
{
m_dValue = MinDim;
}
if (ParentFrame.AreaList.Count > 0)
SearchAreaList(ParentFrame);
m_ParentFrame.ParentWindow.OnUpdatePreview(m_ParentFrame.ParentWindow.sSerialized());
}
}
@@ -85,9 +87,9 @@ namespace WebWindowComplex.Models
if (node != null)
{
if (node.AreaType.Equals(AreaTypes.SASH))
calculateWidth((Sash)node);
updateDimSubArea((Sash)node);
else if (node.AreaType.Equals(AreaTypes.SPLIT))
calculateWidth((Split)node);
updateDimSubArea((Split)node);
foreach (var item in node.AreaList)
{
SearchAreaList(item);
@@ -95,17 +97,17 @@ namespace WebWindowComplex.Models
}
}
protected void calculateWidth(Area area)
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.ABSOLUT)).Count();
if(countAbsolute == sash.SashList.Count)
if (countAbsolute == sash.SashList.Count)
{
double sum = sash.SashList.Sum(x => x.dDimension);
double res = dValue - sum;
if(res > 0)
if (res > 0)
{
foreach (var sashDim in sash.SashList)
{
@@ -154,6 +156,11 @@ namespace WebWindowComplex.Models
}
}
internal void SetDimension(double dValue)
{
m_dValue = dValue;
}
internal JsonFrameDimension Serialize()
{
JsonFrameDimension JsonFrameDimension = new JsonFrameDimension(m_nIndex, m_sName, m_dValue);
+1 -3
View File
@@ -63,14 +63,12 @@ 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());
//m_ParentArea.ParentWindow.OnUpdatePreview(m_ParentArea.ParentWindow.sSerialized());
}
}
+1 -1
View File
@@ -356,7 +356,7 @@ namespace WebWindowComplex.Models
{
SelHwOptionList.Clear();
}
ReqRefreshHwOption();
//ReqRefreshHwOption();
//ParentWindow.OnUpdatePreview(ParentWindow.sSerialized());
}
}
+1 -1
View File
@@ -216,7 +216,7 @@ namespace WebWindowComplex.Models
m_dDimension = value;
}
// Le dimensioni sono miste o solo in assoluto
else
else
{
double valueInAbsolute = 0;
switch (MeasureType)
+46 -27
View File
@@ -81,13 +81,10 @@
<CascadingValue Value="FrameWindow" Name="CurrFrameWindow">
<CascadingValue Value="m_SashList" Name="SashList">
<CascadingValue Value="m_SplitList" Name="SplitList">
<CardFrame EC_ChangeAllJoints="ChangeAllJoints"
EC_AddSash="() => AddSashToFrame(FrameWindow!)"
EC_AddSplit="() => AddSplitToFrame(FrameWindow!)"
EC_ReqClose="ReturnTree"
<CardFrame EC_ReqClose="ReturnTree"
EC_ReqResetDictShape="ReqResetDict"
EC_UpdateShape="UpdateShape"
EC_UpdateFrame="UpdateFrame">
EC_ReqOptionHw="UpdateHwOptionsFrame"
EC_UpdatePreview="UpdatePreviewFrame">
</CardFrame>
</CascadingValue>
</CascadingValue>
@@ -95,7 +92,7 @@
}
else if (currStep == CompileStep.Split)
{
@if (currSplit >= SplitList.Count || currSplit == -1)
@if (currSplitIndex >= SplitList.Count || currSplitIndex == -1)
{
currStep = CompileStep.Tree;
}
@@ -103,8 +100,8 @@
{
<CascadingValue Value="m_SashList" Name="SashList">
<CascadingValue Value="m_SplitList" Name="SplitList">
<CardSplit CurrIndex="currSplit"
CurrItem="SplitList[currSplit]"
<CardSplit CurrIndex="currSplitIndex"
CurrItem="SplitList[currSplitIndex]"
EC_SwapTwoAree="SwapTwoAree"
EC_RemoveArea="RemoveArea"
EC_ReqResetDictShape="ReqResetDict"
@@ -118,15 +115,15 @@
}
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">
<CascadingValue Value="SashList[currSash]" Name="CurrSashGroup">
<CardSashGroup CurrIndex="currSash"
<CascadingValue Value="SashList[currSashIndex]" Name="CurrSashGroup">
<CardSashGroup CurrIndex="currSashIndex"
SashList="SashList"
EC_ChangeHandle="ChangeHandle"
EC_CopyContentSash="CopyContentSash"
@@ -143,30 +140,52 @@
}
else if (currStep == CompileStep.Fill)
{
@if (currFill >= FillList.Count || currFill == -1)
@if (currFillIndex >= FillList.Count || currFillIndex == -1)
{
currStep = CompileStep.Tree;
}
else
{
<CascadingValue Value="m_SashList" Name="SashList">
<CascadingValue Value="m_SplittedList" Name="SplittedList">
<CardFill CurrIndex="currFill"
CurrItem="FillList[currFill]"
FillList="m_FillList"
EC_ChangeAllType="ChangeAllFill"
EC_ChangeType="ChangeOneFill"
EC_AddSash="AddSashIntoSplit"
EC_CopySash="CopySash"
EC_ReqClose="ReturnTree">
</CardFill>
</CascadingValue>
</CascadingValue>
<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"
+151 -175
View File
@@ -1,6 +1,7 @@
using Egw.Window.Data;
using Microsoft.AspNetCore.Components;
using Newtonsoft.Json;
using System.Threading.Tasks;
using WebWindowComplex.Compo;
using WebWindowComplex.DTO;
using WebWindowComplex.Json;
@@ -172,6 +173,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; } = "";
@@ -776,7 +782,7 @@ namespace WebWindowComplex
checkWarnings();
if (SashList.Count > 0)
{
currAnta = 0;
currAntaIndex = 0;
}
if (updRequested)
{
@@ -824,6 +830,7 @@ namespace WebWindowComplex
m_CurrWindow = null;
}
m_CurrWindow = WindowFromJson.Deserialize();
FrameWindow = m_CurrWindow.AreaList[0];
m_CurrWindow.OnPreview += M_CurrWindow_OnPreview;
m_CurrWindow.OnReqHwOption += M_CurrWindow_OnHwOption;
m_CurrWindow.OnReqShape += M_CurrWindow_OnShape;
@@ -831,9 +838,9 @@ namespace WebWindowComplex
if (m_PreviousWindow != null)
{
for (int i = 0; i < 2; i++)
m_CurrWindow.AreaList.First().DimensionList[i] = m_PreviousWindow.AreaList.First().DimensionList[i];
m_CurrWindow.AreaList.First().DimensionList[i].dValue = m_PreviousWindow.AreaList.First().DimensionList[i].dValue;
for (int i = 0; i < 4; i++)
m_CurrWindow.AreaList.First().JointList[i] = m_PreviousWindow.AreaList.First().JointList[i];
m_CurrWindow.AreaList.First().JointList[i].SetSelJointType(m_PreviousWindow.AreaList.First().JointList[i].SelJointType);
}
if (m_CurrWindow != null)
{
@@ -841,7 +848,7 @@ namespace WebWindowComplex
UpdateLists();
}
if (SashList.Count > 0)
currAnta = 0;
currAntaIndex = 0;
// Aggiorno window con dati shape e hw option
UpdateDict();
}
@@ -913,13 +920,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;
@@ -973,8 +980,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>
@@ -989,46 +994,6 @@ namespace WebWindowComplex
#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>
@@ -1036,9 +1001,9 @@ namespace WebWindowComplex
private void AdvStep(CompileStep newStep)
{
currStep = newStep;
currSash = -1;
currFill = -1;
currSplit = -1;
currSashIndex = -1;
currFillIndex = -1;
currSplitIndex = -1;
}
/// <summary>
@@ -1053,39 +1018,6 @@ namespace WebWindowComplex
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);
}
}
await DoPreviewSvg();
}
/// <summary>
/// Metodo per settare tutti i Fill in contemporanea
/// </summary>
@@ -1093,7 +1025,7 @@ namespace WebWindowComplex
/// <returns></returns>
private async Task ChangeOneFill(FillTypes type)
{
Fill fillChange = FillList.ElementAt(currFill);
Fill fillChange = FillList.ElementAt(currFillIndex);
fillChange.SetSelFillType(type);
await DoPreviewSvg();
}
@@ -1184,31 +1116,6 @@ namespace WebWindowComplex
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);
// richiedo update shape della sash appena aggiunta
List<int> reqList = SashList.Select(x => x.GroupId).ToList();
reqList.Add(a.GroupId);
//List<int> reqList = new List<int> { currSplitted.AreaList.First().GroupId };
await DoReqShape(reqList);
await DoPreviewSvg();
}
/// <summary>
/// Helper aggiunta elemento a lista caricamento
/// </summary>
@@ -1280,23 +1187,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;
}
}
@@ -1356,41 +1263,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))
{
currentArea = newSash;
return currentArea;
}
foreach (Area child in currentArea.AreaList)
{
Area found = SearchSash(child, idSearch, newSash);
if (found != null)
{
return found;
}
}
return null;
}
private Area SearchSashSplit(Area currentArea, int idSearch, Area newItem)
private Area SearchArea(Area currentArea, int idSearch, Area itemSearch)
{
if (currentArea.GroupId == idSearch && currentArea.AreaType.Equals(newItem.AreaType))
if (currentArea.GroupId == idSearch && currentArea.AreaType.Equals(itemSearch.AreaType))
{
currentArea = newItem;
return currentArea;
}
foreach (Area child in currentArea.AreaList)
{
Area found = SearchSashSplit(child, idSearch, newItem);
Area found = SearchArea(child, idSearch, itemSearch);
if (found != null)
{
return found;
@@ -1477,21 +1358,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";
@@ -1500,16 +1381,119 @@ namespace WebWindowComplex
}
/// <summary>
/// Aggiornamento Frame
/// Metodo per cambiare tutti i Fill e richiedere aggiornamento SVG
/// </summary>
/// <param name="newFrame"></param>
/// <param name="reqFillType"> tipo di fill richiesto </param>
/// <returns></returns>
private async Task UpdateFrame(Frame newFrame)
protected async Task ChangeAllFill(FillTypes reqFillType)
{
FrameWindow = newFrame;
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"> nuovo frame</param>
/// <returns></returns>
private async Task UpdatePreviewFrame(DataUpdateFrame args)
{
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);
// 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>
/// 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 DoReqShape(reqList);
await DoPreviewSvg();
}
}
/// <summary>
/// Aggiornamento opzioni dato update sash
/// </summary>
@@ -1534,29 +1518,21 @@ namespace WebWindowComplex
/// <returns></returns>
private async Task UpdateSash(Sash newSash)
{
SearchSash(FrameWindow, newSash.GroupId, newSash);
await DoPreviewSvg();
if(newSash != null)
{
Sash item = (Sash)SearchArea(FrameWindow, newSash.GroupId, newSash);
item = newSash;
await DoPreviewSvg();
}
}
private async Task UpdateSplit(Split newSplit)
{
SearchSashSplit(FrameWindow, newSplit.GroupId, newSplit);
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)
if (newSplit != null)
{
// ciclo x ogni group della mia frame
List<int> reqList = SashList.Select(x => x.GroupId).ToList();
await DoReqShape(reqList);
Split item = (Split)SearchArea(FrameWindow, newSplit.GroupId, newSplit);
item = newSplit;
await DoPreviewSvg();
}
}
+2 -1
View File
@@ -6,7 +6,7 @@
<TargetFramework>net8.0</TargetFramework>
<Nullable>enable</Nullable>
<ImplicitUsings>enable</ImplicitUsings>
<Version>2.7.11.2509</Version>
<Version>2.7.11.2610</Version>
<Authors>Annamaria Sassi</Authors>
<Company>Egalware</Company>
<Description>Componente gestione Configurazioni avanzate Window per LUX</Description>
@@ -160,5 +160,6 @@