195 lines
5.8 KiB
C#
195 lines
5.8 KiB
C#
using Microsoft.AspNetCore.Components;
|
|
using Newtonsoft.Json.Linq;
|
|
using WebWindowTest.Models;
|
|
using static WebWindowTest.Json.WindowConst;
|
|
using static WebWindowTest.LayoutConst;
|
|
|
|
namespace WebWindowTest.Compo
|
|
{
|
|
public partial class CardSplit
|
|
{
|
|
|
|
/// <summary>
|
|
/// Split corrente rispetto alla lista split
|
|
/// </summary>
|
|
[Parameter]
|
|
public Split CurrSplit { get; set; } = null!;
|
|
|
|
/// <summary>
|
|
/// Lista di sash
|
|
/// </summary>
|
|
[Parameter]
|
|
public List<Sash> SashList { get; set; } = null!;
|
|
|
|
/// <summary>
|
|
/// Lista di split
|
|
/// </summary>
|
|
[Parameter]
|
|
public List<Split> SplitList { get; set; } = null!;
|
|
|
|
/// <summary>
|
|
/// Frame
|
|
/// </summary>
|
|
[Parameter]
|
|
public Frame FrameWindow { get; set; } = null!;
|
|
|
|
/// <summary>
|
|
/// Evento per richiedere reset dizionario
|
|
/// </summary>
|
|
[Parameter]
|
|
public EventCallback<DataUpdateRes> EC_ReqResetDict { get; set; }
|
|
|
|
/// <summary>
|
|
/// Evento per aggiornare Split
|
|
/// </summary>
|
|
[Parameter]
|
|
public EventCallback<DataUpdateSplit> EC_UpdateSplit { get; set; }
|
|
|
|
/// <summary>
|
|
/// Evento per aggiornare Frame
|
|
/// </summary>
|
|
[Parameter]
|
|
public EventCallback<DataUpdateFrame> EC_UpdateFrame { get; set; }
|
|
|
|
/// <summary>
|
|
/// Evento per tornare nella pagine Tree
|
|
/// </summary>
|
|
[Parameter]
|
|
public EventCallback<bool> EC_ReqClose { get; set; }
|
|
|
|
/// <summary>
|
|
/// Proprietà per selezionare shape split
|
|
/// </summary>
|
|
/// <returns></returns>
|
|
protected int SplitShapeIndex
|
|
{
|
|
get => CurrSplit.SelSplitShapeIndex;
|
|
}
|
|
|
|
/// <summary>
|
|
/// Proprietà per selezionare numero di split verticali
|
|
/// </summary>
|
|
/// <returns></returns>
|
|
protected int SplitQtyVert
|
|
{
|
|
get => CurrSplit.nSplitQtyVert;
|
|
}
|
|
|
|
/// <summary>
|
|
/// Proprietà per selezionare numero di split verticali
|
|
/// </summary>
|
|
/// <returns></returns>
|
|
protected int SplitQtyHoriz
|
|
{
|
|
get => CurrSplit.nSplitQtyHoriz;
|
|
}
|
|
|
|
/// <summary>
|
|
/// Metodo per aggiornare la dimensione dello split
|
|
/// </summary>
|
|
/// <param name="updRec"></param>
|
|
/// <returns></returns>
|
|
protected async Task UpdateDimension(DataUpdateSplitDimension updRec)
|
|
{
|
|
SplitDimension currSplitDim = updRec.currSplit;
|
|
SplitDimension currRec = null;
|
|
// cerco il record
|
|
if (currSplitDim.bIsVertListDim)
|
|
currRec = CurrSplit.SplitVertList.ElementAt(updRec.index);
|
|
else
|
|
currRec = CurrSplit.SplitHorizList.ElementAt(updRec.index);
|
|
// lo aggiorno
|
|
if (currSplitDim != null)
|
|
{
|
|
currRec = currSplitDim;
|
|
var args = new DataUpdateSplit()
|
|
{
|
|
currSplit = CurrSplit,
|
|
noSvg = updRec.noSvg
|
|
};
|
|
await EC_UpdateSplit.InvokeAsync(args);
|
|
}
|
|
}
|
|
|
|
/// <summary>
|
|
/// Metodo per determinare la descrizione del parent dello split corrente
|
|
/// </summary>
|
|
/// <returns></returns>
|
|
protected string descParentSplit()
|
|
{
|
|
if ((CurrSplit.ParentArea is Splitted || CurrSplit.ParentArea is Sash) && SashList.Count > 0)
|
|
{
|
|
for (int j = 0; j < SashList.Count; j++)
|
|
{
|
|
if (SashList[j].Equals(CurrSplit.ParentArea))
|
|
{
|
|
return "Sash " + (j + 1);
|
|
}
|
|
else if (SashList[j].Equals(CurrSplit.ParentArea.ParentArea))
|
|
{
|
|
for (int k = 0; k < SashList[j].AreaList.Count; k++)
|
|
{
|
|
if (SashList[j].AreaList[k].AreaList[0].Equals(CurrSplit))
|
|
{
|
|
return "Sash group " + (j + 1) + " - sash " + (k + 1);
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
else
|
|
{
|
|
return "Frame";
|
|
}
|
|
return "";
|
|
}
|
|
|
|
/// <summary>
|
|
/// Sollevo evento per tornare alla pagina Tree
|
|
/// </summary>
|
|
private void ReqClose()
|
|
{
|
|
_ = EC_ReqClose.InvokeAsync(true);
|
|
}
|
|
|
|
private bool isOpen = false;
|
|
private void ToggleDropdown()
|
|
{
|
|
isOpen = !isOpen;
|
|
}
|
|
|
|
/// <summary>
|
|
/// Metodo per cambiare il tipo di misura di tutti gli SplitDimension
|
|
/// </summary>
|
|
/// <param name="type"> nuovo tipo </param>
|
|
/// <returns></returns>
|
|
protected async Task SetMeasureType(MeasureTypes type)
|
|
{
|
|
isOpen = !isOpen;
|
|
foreach (var item in CurrSplit.SplitVertList)
|
|
{
|
|
item.SetSelMeasureType(type);
|
|
}
|
|
foreach (var item in CurrSplit.SplitHorizList)
|
|
{
|
|
item.SetSelMeasureType(type);
|
|
}
|
|
var args = new DataUpdateSplit()
|
|
{
|
|
currSplit = CurrSplit,
|
|
noSvg = true
|
|
};
|
|
await EC_UpdateSplit.InvokeAsync(args);
|
|
}
|
|
}
|
|
|
|
/// <summary>
|
|
/// Classe per raggruppare oggetti che servono per aggiornare split
|
|
/// </summary>
|
|
public class DataUpdateSplit
|
|
{
|
|
public Split currSplit { get; set; } = null!;
|
|
public bool svgNoHw { get; set; } = false;
|
|
public bool noSvg { get; set; } = false;
|
|
}
|
|
} |