754 lines
26 KiB
C#
754 lines
26 KiB
C#
using Microsoft.AspNetCore.Components;
|
|
using Microsoft.AspNetCore.Components.Web;
|
|
using Newtonsoft.Json;
|
|
using Newtonsoft.Json.Linq;
|
|
using System.Reflection.Metadata;
|
|
using System.Runtime.InteropServices;
|
|
using WebWindow.Base;
|
|
using WebWindowComplex.DTO;
|
|
using WebWindowComplex.Json;
|
|
using static WebWindowComplex.Json.WindowConst;
|
|
|
|
namespace WebWindowComplex
|
|
{
|
|
public partial class TableComp : IDisposable
|
|
{
|
|
#region Public Properties
|
|
|
|
[Parameter]
|
|
public string CssSvg { get; set; } = "responsive-svg";
|
|
|
|
[Parameter]
|
|
public EventCallback<bool> EC_OnClose { get; set; }
|
|
|
|
[Parameter]
|
|
public EventCallback<TemplateSelectDTO> EC_OnSelectedTemplate { get; set; }
|
|
|
|
[Parameter]
|
|
public EventCallback<Dictionary<string, string>> EC_OnUpdate { get; set; }
|
|
|
|
[Parameter]
|
|
public Template IN_SelTemplate
|
|
{
|
|
get => m_SelTemplate;
|
|
set
|
|
{
|
|
// Se non ho ancora selezionato template oppure se cambio template di selezione
|
|
if (value != null && (m_SelTemplate == null || (m_SelTemplate != null && value.nIndex != m_SelTemplate.nIndex)) && !string.IsNullOrEmpty(value.JWD))
|
|
{
|
|
m_SelTemplate = value;
|
|
SelFamilyHardware = IN_SelFamilyHardware;
|
|
JsonWindow WindowFromJson = JsonConvert.DeserializeObject<JsonWindow>(m_SelTemplate.JWD, new PolymorphicJsonConverter()) ?? new JsonWindow("");
|
|
if (m_CurrWindow != null)
|
|
{
|
|
m_CurrWindow.OnPreview -= M_CurrWindow_OnPreview;
|
|
m_CurrWindow = null;
|
|
}
|
|
Sash.m_HardwareCompleteList = IN_HardwareList;
|
|
Sash.s_FamilyHardwareList = IN_FamilyHardwareList;
|
|
Sash.s_SelFamilyHW = IN_SelFamilyHardware;
|
|
m_CurrWindow = WindowFromJson.Deserialize();
|
|
m_CurrWindow.OnPreview += M_CurrWindow_OnPreview;
|
|
// recupero dimensioni Frame e Joint Frame della finestra precedente
|
|
if (m_PreviousWindow != null)
|
|
{
|
|
for (int i = 0; i < 2; i++)
|
|
m_CurrWindow.AreaList[0].DimensionList[i] = m_PreviousWindow.AreaList[0].DimensionList[i];
|
|
for (int i = 0; i < 4; i++)
|
|
m_CurrWindow.AreaList[0].JointList[i] = m_PreviousWindow.AreaList[0].JointList[i];
|
|
}
|
|
}
|
|
if (m_CurrWindow != null)
|
|
{
|
|
m_maxCol = 0;
|
|
m_maxRow = 0;
|
|
m_FillList = new List<Fill>();
|
|
m_SashList = new List<Sash>();
|
|
m_SplitList = new List<Split>();
|
|
m_SplitParentList = new List<SplitParent>();
|
|
m_SplittedList = new List<Splitted>();
|
|
m_ItemTableList = new List<ItemTable>();
|
|
CreateWindowsList(m_CurrWindow.AreaList[0], false);
|
|
CreateElementTable(m_CurrWindow.AreaList[0], 1, 1, 1, 1);
|
|
}
|
|
}
|
|
}
|
|
|
|
[Parameter]
|
|
public List<TemplateSelectDTO> IN_TemplateDTOList { get; set; } = null!;
|
|
|
|
[Parameter]
|
|
public List<string> IN_FamilyHardwareList { get; set; } = null!;
|
|
|
|
[Parameter]
|
|
public string? IN_SelFamilyHardware { get; set; } = null;
|
|
|
|
[Parameter]
|
|
public List<Hardware>? IN_HardwareList { get; set; } = null;
|
|
|
|
[Parameter]
|
|
public string LiveSVG
|
|
{
|
|
get => m_SelSVG;
|
|
set => m_SelSVG = value;
|
|
}
|
|
|
|
#endregion Public Properties
|
|
|
|
#region Public Methods
|
|
|
|
public void Dispose()
|
|
{
|
|
if (m_CurrWindow != null)
|
|
{
|
|
m_CurrWindow.OnPreview -= M_CurrWindow_OnPreview;
|
|
m_CurrWindow = null;
|
|
}
|
|
}
|
|
|
|
#endregion Public Methods
|
|
|
|
#region Protected Enums
|
|
|
|
protected enum CompileStep
|
|
{
|
|
Template = 0,
|
|
Gerarchia = 1,
|
|
Frame,
|
|
Split,
|
|
Sash,
|
|
Fill,
|
|
General
|
|
}
|
|
|
|
protected enum ColorWindow
|
|
{
|
|
Bianco = 0,
|
|
Grigio = 1,
|
|
Tortora,
|
|
Blu,
|
|
Verde,
|
|
Nero
|
|
}
|
|
|
|
protected enum positionJoints
|
|
{
|
|
BL = 0, // Bottom Left
|
|
BR = 1, // Bottom Right
|
|
TR, // Top Right
|
|
TL // Top Left
|
|
}
|
|
|
|
#endregion Protected Enums
|
|
|
|
#region Protected Properties
|
|
|
|
protected Frame FrameWindow
|
|
{
|
|
get => m_Frame;
|
|
set => m_Frame = value;
|
|
}
|
|
|
|
protected string m_SelSVG { get; set; } = "";
|
|
|
|
/// <summary>
|
|
/// Componente SVG da mostrare
|
|
/// </summary>
|
|
protected MarkupString outSvg
|
|
{
|
|
get
|
|
{
|
|
// aggiunta gestione classe svg per posizionamento con costraints
|
|
var newSvg = LiveSVG.Replace("<svg", $"<svg class=\"{CssSvg}\"");
|
|
return (MarkupString)newSvg;
|
|
}
|
|
}
|
|
|
|
protected List<Sash> SashList
|
|
{
|
|
get => m_SashList;
|
|
}
|
|
protected List<Split> SplitList
|
|
{
|
|
get => m_SplitList;
|
|
}
|
|
protected List<Fill> FillList
|
|
{
|
|
get => m_FillList;
|
|
}
|
|
protected List<Splitted> SplittedList
|
|
{
|
|
get => m_SplittedList;
|
|
}
|
|
protected List<SplitParent> SplitParentList
|
|
{
|
|
get => m_SplitParentList;
|
|
}
|
|
protected List<ItemTable> ItemTableList
|
|
{
|
|
get => m_ItemTableList;
|
|
}
|
|
|
|
protected TemplateSelectDTO? SelTemplateDTO { get; set; } = null;
|
|
|
|
protected string SelFamilyHardware
|
|
{
|
|
get
|
|
{
|
|
return m_SelFamilyHardware;
|
|
}
|
|
set
|
|
{
|
|
m_SelFamilyHardware = value;
|
|
Sash.s_SelFamilyHW = value;
|
|
for (int i = 0; i < SashList.Count; i++)
|
|
{
|
|
SashList[i].RefreshHardwareList();
|
|
SashList[i].RefreshHardwareOptionList();
|
|
SashList[i].SetFirstHardware();
|
|
}
|
|
if (m_CurrWindow != null)
|
|
{
|
|
m_CurrWindow.OnUpdatePreview(m_CurrWindow.sSerialized());
|
|
}
|
|
}
|
|
}
|
|
|
|
#endregion Protected Properties
|
|
|
|
#region Protected Methods
|
|
|
|
/// <summary>
|
|
/// Metodo per la scelta della maniglia univoca
|
|
/// </summary>
|
|
/// <param name="sashDim"></param>
|
|
/// <returns></returns>
|
|
protected async Task changeHandle(SashDimension sashDim)
|
|
{
|
|
//if(m_SashList[0].AreaList.Count < 3)
|
|
//{
|
|
foreach (SashDimension item in SashList[0].SashList)
|
|
{
|
|
if (item.Equals(sashDim))
|
|
{
|
|
item.bHasHandle = true;
|
|
}
|
|
else
|
|
{
|
|
item.bHasHandle = false;
|
|
}
|
|
}
|
|
//}
|
|
await Task.Delay(1);
|
|
}
|
|
|
|
// Ancora da fare...
|
|
protected async Task DoClose()
|
|
{
|
|
await EC_OnClose.InvokeAsync(true);
|
|
}
|
|
|
|
/// <summary>
|
|
/// Anteprima SVG
|
|
/// </summary>
|
|
/// <returns></returns>
|
|
protected async Task DoPreviewSvg()
|
|
{
|
|
if (m_CurrWindow != null)
|
|
{
|
|
var CurrJwd = JsonConvert.SerializeObject(m_CurrWindow.Serialize(), Formatting.Indented);
|
|
Dictionary<string, string> Args = new Dictionary<string, string>();
|
|
Args.Add("Jwd", CurrJwd);
|
|
Args.Add("Mode", 1.ToString());
|
|
await EC_OnUpdate.InvokeAsync(Args);
|
|
}
|
|
}
|
|
|
|
/// <summary>
|
|
/// Metodo di reset dei dati a quelli del template
|
|
/// </summary>
|
|
protected async Task DoReset()
|
|
{
|
|
SelFamilyHardware = IN_SelFamilyHardware;
|
|
JsonWindow WindowFromJson = JsonConvert.DeserializeObject<JsonWindow>(m_SelTemplate.JWD, new PolymorphicJsonConverter()) ?? new JsonWindow("");
|
|
if (m_CurrWindow != null)
|
|
{
|
|
m_CurrWindow.OnPreview -= M_CurrWindow_OnPreview;
|
|
m_CurrWindow = null;
|
|
}
|
|
m_CurrWindow = WindowFromJson.Deserialize();
|
|
m_CurrWindow.OnPreview += M_CurrWindow_OnPreview;
|
|
m_FillList = new List<Fill>();
|
|
m_SashList = new List<Sash>();
|
|
m_SplitList = new List<Split>();
|
|
m_SplittedList = new List<Splitted>();
|
|
m_SplitParentList = new List<SplitParent>();
|
|
m_ItemTableList = new List<ItemTable>();
|
|
m_maxCol = 0;
|
|
m_maxRow = 0;
|
|
// popolo le liste Fill, Sash e Split
|
|
CreateWindowsList(m_CurrWindow.AreaList[0], false);
|
|
CreateElementTable(m_CurrWindow.AreaList[0], 1, 1, 1, 1);
|
|
currSash = -1;
|
|
await DoPreviewSvg();
|
|
}
|
|
|
|
// Ancora da fare..
|
|
protected async Task DoSave()
|
|
{
|
|
//manca salvataggio JWD
|
|
await EC_OnClose.InvokeAsync(true);
|
|
}
|
|
|
|
/// <summary>
|
|
/// Selezione del template
|
|
/// </summary>
|
|
/// <param name="newSel"> template selezionato</param>
|
|
protected async void DoSelect(TemplateSelectDTO newSel)
|
|
{
|
|
SelTemplateDTO = newSel;
|
|
//DoSelectAndPreview(CompileStep.Frame);
|
|
await EC_OnSelectedTemplate.InvokeAsync(newSel);
|
|
}
|
|
|
|
/// <summary>
|
|
/// Metodo per cambiare step e aggiornare preview svg
|
|
/// </summary>
|
|
/// <param name="newStep"> step successivo</param>
|
|
protected async void NextStepAndPreview(CompileStep newStep, int Index = -1)
|
|
{
|
|
currStep = newStep;
|
|
if (newStep == CompileStep.Sash)
|
|
currSash = Index;
|
|
else
|
|
currSash = -1;
|
|
await DoPreviewSvg();
|
|
}
|
|
|
|
protected void CreateWindowsList(Area node, bool IntoSash)
|
|
{
|
|
if (node != null)
|
|
{
|
|
if (node.ParentArea is Sash || IntoSash == true)
|
|
IntoSash = true;
|
|
switch (node.AreaType)
|
|
{
|
|
case AreaTypes.FRAME:
|
|
{
|
|
FrameWindow = (Frame)node;
|
|
break;
|
|
}
|
|
case AreaTypes.SASH:
|
|
{
|
|
m_SashList.Add((Sash)node);
|
|
break;
|
|
}
|
|
case AreaTypes.FILL:
|
|
{
|
|
m_FillList.Add((Fill)node);
|
|
break;
|
|
}
|
|
case AreaTypes.SPLIT:
|
|
{
|
|
m_SplitList.Add((Split)node);
|
|
break;
|
|
}
|
|
case AreaTypes.SPLITTED:
|
|
{
|
|
if (node.ParentArea is Split && !IntoSash && node.AreaList[0] is Fill)
|
|
{
|
|
m_SplittedList.Add((Splitted)node);
|
|
}
|
|
break;
|
|
}
|
|
}
|
|
foreach (var item in node.AreaList)
|
|
{
|
|
CreateWindowsList(item, IntoSash);
|
|
}
|
|
}
|
|
}
|
|
|
|
protected void CreateElementTable(Area node, int row, int col, int maxRow, int maxCol)
|
|
{
|
|
if (node != null)
|
|
{
|
|
switch (node.AreaType)
|
|
{
|
|
case AreaTypes.FRAME:
|
|
{
|
|
if(node.AreaList.Count >= 1)
|
|
ItemTableList.Add(new ItemTable(AreaTypes.FRAME, "FR", row, col, -1, node.AreaList.Count));
|
|
else
|
|
ItemTableList.Add(new ItemTable(AreaTypes.FRAME, "FR", row, col, -1, 0));
|
|
row++;
|
|
col++;
|
|
maxRow++;
|
|
maxCol++;
|
|
break;
|
|
}
|
|
case AreaTypes.SASH:
|
|
{
|
|
// Se ha fratelli
|
|
if ((node.ParentArea.ParentArea != null && node.ParentArea.ParentArea.AreaList.Count > 1) ||
|
|
(node.ParentArea != null && node.ParentArea.AreaList.Count > 1))
|
|
{
|
|
for(int i = 0; i < SashList.Count; i++)
|
|
{
|
|
if (SashList[i].Equals(node))
|
|
{
|
|
// Se il nodo ha figli, salvo il numero nell'oggetto
|
|
if(node.AreaList.Count >= 1)
|
|
ItemTableList.Add(new ItemTable(AreaTypes.SASH, "SH", maxRow, col, i, node.AreaList.Count));
|
|
else
|
|
ItemTableList.Add(new ItemTable(AreaTypes.SASH, "SH", maxRow, col, i, 0));
|
|
}
|
|
}
|
|
maxCol++;
|
|
}
|
|
else
|
|
{
|
|
// Se il nodo ha figli, salvo il numero nell'oggetto
|
|
if (node.AreaList.Count >= 1)
|
|
ItemTableList.Add(new ItemTable(AreaTypes.SASH, "SH", row, col, 0, node.AreaList.Count));
|
|
else
|
|
ItemTableList.Add(new ItemTable(AreaTypes.SASH, "SH", row, col, 0, 0));
|
|
maxCol++;
|
|
}
|
|
row++;
|
|
col++;
|
|
maxRow++;
|
|
break;
|
|
}
|
|
case AreaTypes.FILL:
|
|
{
|
|
if((node.ParentArea.AreaList.Count > 1 && node.ParentArea.AreaList[0].Equals(node)) ||
|
|
(node.ParentArea.ParentArea != null && node.ParentArea.ParentArea.AreaList.Count > 1 && node.ParentArea.ParentArea.AreaList[0].AreaList[0].Equals(node)))
|
|
maxCol++;
|
|
ItemTableList.Add(new ItemTable(AreaTypes.FILL, "FL", maxRow, col, -1, 0));
|
|
row++;
|
|
col++;
|
|
maxRow++;
|
|
break;
|
|
}
|
|
case AreaTypes.SPLIT:
|
|
{
|
|
if (node.ParentArea.AreaList.Count > 1 || (node.ParentArea.ParentArea != null && node.ParentArea.ParentArea.AreaList.Count > 1))
|
|
{
|
|
if (node.ParentArea.AreaList[0].Equals(node) || node.ParentArea.ParentArea.AreaList[0].Equals(node))
|
|
maxCol ++;
|
|
if (node.AreaList.Count >= 1 || node.AreaList.Count >= 1)
|
|
ItemTableList.Add(new ItemTable(AreaTypes.SPLIT, "SP", maxRow, col, -1, node.AreaList.Count));
|
|
else
|
|
ItemTableList.Add(new ItemTable(AreaTypes.SPLIT, "SP", maxRow, col, -1, 0));
|
|
}
|
|
else
|
|
{
|
|
if (node.AreaList.Count >= 1 || node.AreaList.Count >= 1)
|
|
ItemTableList.Add(new ItemTable(AreaTypes.SPLIT, "SP", row, col, -1, node.AreaList.Count));
|
|
else
|
|
ItemTableList.Add(new ItemTable(AreaTypes.SPLIT, "SP", row, col, -1, 0));
|
|
maxCol++;
|
|
}
|
|
row++;
|
|
col++;
|
|
maxRow++;
|
|
break;
|
|
}
|
|
case AreaTypes.SPLITTED:
|
|
{
|
|
break;
|
|
}
|
|
}
|
|
foreach (var item in node.AreaList)
|
|
{
|
|
if (maxRow < m_maxRow)
|
|
CreateElementTable(item, row, col, m_maxRow, maxCol);
|
|
else
|
|
CreateElementTable(item, row, col, maxRow, maxCol);
|
|
}
|
|
}
|
|
if(maxCol> m_maxCol)
|
|
{
|
|
m_maxCol = maxCol;
|
|
}
|
|
if (maxRow > m_maxRow)
|
|
{
|
|
m_maxRow = maxRow;
|
|
}
|
|
}
|
|
|
|
private string fillTable(int row, int col)
|
|
{
|
|
List<ItemTable> itemSameCol = new List<ItemTable>();
|
|
for(int k = 0; k < row; k++)
|
|
{
|
|
if(ItemTableList[k].Col == col+1)
|
|
{
|
|
itemSameCol.Add(ItemTableList[k]);
|
|
}
|
|
continue;
|
|
}
|
|
int numItemNextCol = 0;
|
|
for (int k = 0; k < row; k++)
|
|
{
|
|
if (ItemTableList[k].Row <= row && ItemTableList[k].Col == col + 2)
|
|
{
|
|
numItemNextCol++;
|
|
}
|
|
continue;
|
|
}
|
|
if (itemSameCol.Count > 1)
|
|
{
|
|
for (int i = 0; i <= itemSameCol.Count - 2; i++)
|
|
{
|
|
if (itemSameCol[i].NumChild > 0)
|
|
numItemNextCol = numItemNextCol - itemSameCol[i].NumChild;
|
|
}
|
|
}
|
|
if (itemSameCol.Count > 0)
|
|
{
|
|
// Sono alla riga successiva di un elemento e nella stessa colonna
|
|
if(itemSameCol.Last().Row == row)
|
|
{
|
|
// se ha un solo figlio
|
|
if(itemSameCol.Last().NumChild == 1)
|
|
{
|
|
return "└";
|
|
}
|
|
else if (itemSameCol.Last().NumChild == 0)
|
|
{
|
|
return " ";
|
|
}
|
|
else
|
|
{
|
|
return "├";
|
|
}
|
|
}
|
|
// Non solo alla riga successiva
|
|
else
|
|
{
|
|
// se ha un solo figlio
|
|
if(itemSameCol.Last().NumChild == 1)
|
|
{
|
|
return " ";
|
|
}
|
|
else if (col + 2 <= m_maxCol && ItemTableList[row].Col == col + 2)
|
|
{
|
|
if (numItemNextCol < itemSameCol.Last().NumChild && numItemNextCol != (itemSameCol.Last().NumChild - 1))
|
|
{
|
|
return "├";
|
|
}
|
|
return "└";
|
|
}
|
|
else if (numItemNextCol < itemSameCol.Last().NumChild)
|
|
{
|
|
return "│";
|
|
}
|
|
else
|
|
{
|
|
return " ";
|
|
}
|
|
}
|
|
}
|
|
else
|
|
{
|
|
return " ";
|
|
}
|
|
}
|
|
|
|
/// <summary>
|
|
/// Metodo per settare tutti i Joints di Frame o Sash come ANGLED o FULL_H o FULL_V
|
|
/// </summary>
|
|
/// <param name="n_type"> tipo di giunzione (ANGLED o FULL_H o FULL_V)</param>
|
|
/// <param name="n_place"> oggetto a cui essere applicato (Frame o Sash)</param>
|
|
/// <returns></returns>
|
|
private async Task AllJointsFrame(int n_type, int n_place)
|
|
{
|
|
Joints type = Joints.ANGLED;
|
|
if (n_type == 2)
|
|
{
|
|
type = Joints.FULL_H;
|
|
}
|
|
else if (n_type == 3)
|
|
{
|
|
type = Joints.FULL_V;
|
|
}
|
|
if (n_place == 0)
|
|
{
|
|
foreach (Joint joint in FrameWindow.JointList)
|
|
{
|
|
joint.SetSelJointType(type);
|
|
}
|
|
}
|
|
else if (n_place == 1)
|
|
{
|
|
foreach (Joint joint in m_SashList[0].JointList)
|
|
{
|
|
joint.SetSelJointType(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="n_type"> tipo di riempimento (GLASS o WOOD)</param>
|
|
/// <returns></returns>
|
|
private async Task AllFill(int n_type)
|
|
{
|
|
FillTypes type = FillTypes.GLASS;
|
|
if (n_type == 2)
|
|
{
|
|
type = FillTypes.WOOD;
|
|
}
|
|
foreach (Fill currFill in m_FillList)
|
|
{
|
|
currFill.SetFillType(type);
|
|
}
|
|
await DoPreviewSvg();
|
|
}
|
|
|
|
/// <summary>
|
|
/// Metodo per copiare contenuto di un'anta in un'altra anta
|
|
/// </summary>
|
|
/// <param name="sashItem">Sash dove si torva anta </param>
|
|
/// <param name="IndexCopy">Indice dell'anta che si copia</param>
|
|
/// <param name="IndexModify">Indice dell'anta che si modifica</param>
|
|
private async Task CopyContent(Sash sashItem, int IndexCopy, int 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-1].AreaList[0].Copy(sashSplitted);
|
|
// Aggiungo copia all'anta selezionata
|
|
sashItem.AreaList[IndexModify].AreaList.Add(a);
|
|
await DoPreviewSvg();
|
|
}
|
|
|
|
private async Task CopySplitted(Splitted currSplitted, int numSash)
|
|
{
|
|
//Rimuovo contenuto di Splitted
|
|
currSplitted.AreaList.RemoveAll(i => i != null);
|
|
// Copio sash
|
|
Area a = SashList[numSash].Copy(currSplitted);
|
|
a.SetParentArea(currSplitted);
|
|
// Aggiungo copia a Splitted
|
|
currSplitted.AreaList.Add(a);
|
|
await DoPreviewSvg();
|
|
}
|
|
|
|
private async Task SwapTwoAree(Area currArea)
|
|
{
|
|
currArea.SwapAree();
|
|
await DoPreviewSvg();
|
|
}
|
|
|
|
#endregion Protected Methods
|
|
|
|
#region Private Fields
|
|
|
|
private CompileStep currStep = CompileStep.Template;
|
|
|
|
private int currSash = -1;
|
|
|
|
private ColorWindow currColorWin = ColorWindow.Bianco;
|
|
|
|
private Frame m_Frame;
|
|
|
|
private List<Sash> m_SashList = new List<Sash>();
|
|
|
|
private List<Split> m_SplitList = new List<Split>();
|
|
|
|
private List<Fill> m_FillList = new List<Fill>();
|
|
|
|
private List<Splitted> m_SplittedList = new List<Splitted>();
|
|
|
|
private List<ItemTable> m_ItemTableList = new List<ItemTable>();
|
|
|
|
private List<SplitParent> m_SplitParentList = new List<SplitParent>();
|
|
|
|
private int m_maxCol = 0;
|
|
private int m_maxRow = 0;
|
|
|
|
#endregion Private Fields
|
|
|
|
#region Private Properties
|
|
|
|
private Window? m_CurrWindow { get; set; } = null;
|
|
|
|
private Window? m_PreviousWindow { get; set; } = null;
|
|
|
|
private Template m_SelTemplate { get; set; } = null!;
|
|
|
|
private string m_SelFamilyHardware { get; set; } = "";
|
|
|
|
#endregion Private Properties
|
|
|
|
#region Private Methods
|
|
|
|
/// <summary>
|
|
/// Metodo per andare allo step successivo
|
|
/// </summary>
|
|
/// <param name="newStep"> step successivo</param>
|
|
private void AdvStep(CompileStep newStep)
|
|
{
|
|
currStep = newStep;
|
|
currSash = -1;
|
|
}
|
|
|
|
|
|
private void ChangeColorWindow(ColorWindow newColorWin)
|
|
{
|
|
currColorWin = newColorWin;
|
|
}
|
|
|
|
private void M_CurrWindow_OnPreview(object? sender, OnPreviewEventArgs e)
|
|
{
|
|
Dictionary<string, string> Args = new Dictionary<string, string>();
|
|
Args.Add("Jwd", e.sJwd);
|
|
Args.Add("Mode", 1.ToString());
|
|
EC_OnUpdate.InvokeAsync(Args);
|
|
}
|
|
|
|
/// <summary>
|
|
/// Calcola il css del tab selezionato
|
|
/// </summary>
|
|
/// <param name="testStep"></param>
|
|
/// <returns></returns>
|
|
private string tabNavCss(CompileStep testStep, int Index = -1)
|
|
{
|
|
if (testStep == CompileStep.Sash)
|
|
{
|
|
if ((currSash == 0 && Index == 0) || (currSash == 1 && Index == 1))
|
|
{
|
|
return "nav-link active fw-bold";
|
|
}
|
|
else
|
|
{
|
|
return "nav-link text-secondary";
|
|
}
|
|
}
|
|
return (testStep == currStep) ? "nav-link active fw-bold" : "nav-link text-secondary";
|
|
}
|
|
|
|
private string buttonCss(ColorWindow testColor)
|
|
{
|
|
return testColor.Equals(currColorWin) ? "btn btn-outline-secondary active" : "btn btn-outline-secondary";
|
|
}
|
|
|
|
/// <summary>
|
|
/// Calcola larghezza colonna da mostrare
|
|
/// </summary>
|
|
/// <returns></returns>
|
|
private string mainCss()
|
|
{
|
|
return (currStep == CompileStep.Template) ? "col-12" : "col-6";
|
|
}
|
|
|
|
#endregion Private Methods
|
|
}
|
|
} |