1fed423ab0
- Aggiornata interfaccia sash - Aggiornato jwd di base nel caso di sbagliata deserializzazione - Aggiornato readme
235 lines
7.1 KiB
C#
235 lines
7.1 KiB
C#
using Microsoft.AspNetCore.Components;
|
|
using WebWindowComplex.Models;
|
|
using static WebWindowComplex.Json.WindowConst;
|
|
|
|
namespace WebWindowComplex.Compo
|
|
{
|
|
public partial class CardSashGroup
|
|
{
|
|
#region Public Properties
|
|
|
|
/// <summary>
|
|
/// Indice della sash corrente rispetto alla lista sash
|
|
/// </summary>
|
|
[Parameter]
|
|
public int CurrIndex { get; set; } = 0;
|
|
|
|
/// <summary>
|
|
/// Sash corrente rispetto alla lista Sash
|
|
/// </summary>
|
|
[CascadingParameter(Name = "CurrSashGroup")]
|
|
public Sash CurrSashGroup { get; set; } = null!;
|
|
|
|
/// <summary>
|
|
/// Evento per cambiare l'anta su cui è presente la maniglia
|
|
/// </summary>
|
|
[Parameter]
|
|
public EventCallback<DataChangeHandle> EC_ChangeHandle { get; set; }
|
|
|
|
/// <summary>
|
|
/// Evento per cambiare l'anta su cui è presente la maniglia
|
|
/// </summary>
|
|
[Parameter]
|
|
public EventCallback<DataCopyContentSash> EC_CopyContentSash { get; set; }
|
|
|
|
/// <summary>
|
|
/// Evento per cambiare tutti i fill
|
|
/// </summary>
|
|
[Parameter]
|
|
public EventCallback<Area> EC_RemoveArea { get; set; }
|
|
|
|
/// <summary>
|
|
/// Evento per tornare nella pagine Tree
|
|
/// </summary>
|
|
[Parameter]
|
|
public EventCallback<bool> EC_ReqClose { get; set; }
|
|
|
|
/// <summary>
|
|
/// Evento per richiedere reset dizionario Shape
|
|
/// </summary>
|
|
[Parameter]
|
|
public EventCallback<bool> EC_ReqResetDictShape { get; set; }
|
|
|
|
/// <summary>
|
|
/// Evento per cambiare tutti i Joints
|
|
/// </summary>
|
|
[Parameter]
|
|
public EventCallback<Sash> EC_UpdateSash { get; set; }
|
|
|
|
/// <summary>
|
|
/// Evento per segnalare cambio hw e richiesta calcolo
|
|
/// </summary>
|
|
[Parameter]
|
|
public EventCallback<Sash> EC_UpdateSashHardware { get; set; }
|
|
|
|
/// <summary>
|
|
/// Evento per richiedere la prima volta le opzioni hardware
|
|
/// </summary>
|
|
[Parameter]
|
|
public EventCallback<int> EC_CallFirstHwOpt { get; set; }
|
|
|
|
/// <summary>
|
|
/// Lista di sash
|
|
/// </summary>
|
|
[Parameter]
|
|
public List<Sash> SashList { get; set; } = null!;
|
|
|
|
#endregion Public Properties
|
|
|
|
#region Protected Properties
|
|
|
|
/// <summary>
|
|
/// Selezione hardware
|
|
/// </summary>
|
|
protected string SelHwType
|
|
{
|
|
get => CurrSashGroup.SelHardwareFromId;
|
|
set
|
|
{
|
|
if (CurrSashGroup.SelHardwareFromId != value)
|
|
{
|
|
CurrSashGroup.SelHardwareFromId = value;
|
|
_ = EC_UpdateSashHardware.InvokeAsync(CurrSashGroup);
|
|
}
|
|
}
|
|
}
|
|
|
|
#endregion Protected Properties
|
|
|
|
#region Protected Methods
|
|
|
|
/// <summary>
|
|
/// Sollevo evento per rimuovere area
|
|
/// </summary>
|
|
/// <param name="currArea"> area da rimuovere </param>
|
|
/// <returns></returns>
|
|
protected async Task RemoveArea(Area currArea)
|
|
{
|
|
// richiesta reset dict shape
|
|
await EC_ReqResetDictShape.InvokeAsync(true);
|
|
await EC_RemoveArea.InvokeAsync(currArea);
|
|
}
|
|
|
|
protected async Task SetMeasureType(MeasureTypes type)
|
|
{
|
|
isOpen = !isOpen;
|
|
foreach (var item in CurrSashGroup.SashList)
|
|
{
|
|
item.SetSelMeasureType(type);
|
|
}
|
|
await EC_UpdateSash.InvokeAsync(CurrSashGroup);
|
|
}
|
|
|
|
protected async Task UpdateSashDimension(SashDimension updateSD)
|
|
{
|
|
var currRec = CurrSashGroup.SashList.Where(x => x.nSashId == updateSD.nSashId).FirstOrDefault();
|
|
if(currRec != null)
|
|
{
|
|
currRec = updateSD;
|
|
await EC_UpdateSash.InvokeAsync(CurrSashGroup);
|
|
}
|
|
}
|
|
|
|
#endregion Protected Methods
|
|
|
|
#region Private Methods
|
|
|
|
/// <summary>
|
|
/// Sollevo evento per cambiare l'anta su cui è presente la maniglia
|
|
/// </summary>
|
|
/// <returns></returns>
|
|
private async Task ChangeHandle(DataChangeHandle Args)
|
|
{
|
|
await EC_ChangeHandle.InvokeAsync(Args);
|
|
}
|
|
|
|
/// <summary>
|
|
/// Sollevo evento per cambiare l'anta su cui è presente la maniglia
|
|
/// </summary>
|
|
/// <returns></returns>
|
|
private async Task CopyContentSash(DataCopyContentSash Args)
|
|
{
|
|
await EC_CopyContentSash.InvokeAsync(Args);
|
|
}
|
|
|
|
private bool editMode = false;
|
|
private List<int> currSashDimEdit = new List<int>();
|
|
private void EditView(DataChangeMode args)
|
|
{
|
|
editMode = args.Edit;
|
|
if(args.IndexSashEdit != -1)
|
|
currSashDimEdit.Add(args.IndexSashEdit);
|
|
if (args.IndexSashClose != -1)
|
|
currSashDimEdit.Remove(args.IndexSashClose);
|
|
}
|
|
|
|
/// <summary>
|
|
/// Sollevo evento per tornare alla pagina Tree
|
|
/// </summary>
|
|
private void ReqClose()
|
|
{
|
|
_ = EC_ReqClose.InvokeAsync(true);
|
|
}
|
|
|
|
/// <summary>
|
|
/// Report aggiornamento Option Combo
|
|
/// </summary>
|
|
/// <param name="updRec"></param>
|
|
/// <returns></returns>
|
|
private async Task UpdateOptCombo(AGBOptionCombo updRec)
|
|
{
|
|
// cerco il record
|
|
var currRec = CurrSashGroup.HwOptionList.FirstOrDefault(x => x.sName == updRec.sName && x.sDescription == updRec.sDescription);
|
|
// lo aggiorno
|
|
if (updRec != null)
|
|
{
|
|
currRec = updRec;
|
|
await EC_UpdateSashHardware.InvokeAsync(CurrSashGroup);
|
|
}
|
|
}
|
|
|
|
/// <summary>
|
|
/// Report aggiornamento Option Text
|
|
/// </summary>
|
|
/// <param name="updRec"></param>
|
|
/// <returns></returns>
|
|
private async Task UpdateOptText(AGBOptionText updRec)
|
|
{
|
|
// cerco il record
|
|
var currRec = CurrSashGroup.HwOptionList.FirstOrDefault(x => x.sName == updRec.sName && x.sDescription == updRec.sDescription);
|
|
// lo aggiorno
|
|
if (updRec != null)
|
|
{
|
|
currRec = updRec;
|
|
await EC_UpdateSashHardware.InvokeAsync(CurrSashGroup);
|
|
}
|
|
}
|
|
|
|
/// <summary>
|
|
/// Prima chiamata hw option list
|
|
/// </summary>
|
|
/// <param name="updRec"></param>
|
|
/// <returns></returns>
|
|
private async Task FirstHwOptionList(int groupId)
|
|
{
|
|
await EC_CallFirstHwOpt.InvokeAsync(groupId);
|
|
}
|
|
|
|
private string ButtonMeasureCss(MeasureTypes type)
|
|
{
|
|
foreach(var item in CurrSashGroup.SashList)
|
|
{
|
|
if (!item.SelMeasureType.Equals(type))
|
|
return "btn btn-outline-secondary btn-sm";
|
|
}
|
|
return "btn btn-secondary btn-sm";
|
|
}
|
|
|
|
private bool isOpen = false;
|
|
private void ToggleDropdown()
|
|
{
|
|
isOpen = !isOpen;
|
|
}
|
|
#endregion Private Methods
|
|
}
|
|
} |