Aggiornato modo per sollevare gli eventi di Frame, Fill, Splitted, Joint
This commit is contained in:
+151
-175
@@ -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();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user