Files
webwindowconfigurator/WebWindowComplex/Compo/General.razor.cs
T
2026-01-19 10:31:08 +01:00

160 lines
4.0 KiB
C#

using Microsoft.AspNetCore.Components;
using WebWindowComplex.DTO;
using WebWindowComplex.Models;
namespace WebWindowComplex.Compo
{
public partial class General
{
#region Public Properties
/// <summary>
/// Finestra corrente
/// </summary>
[Parameter]
public Window CurrWindow { get; set; } = null!;
[Parameter]
public bool User { get; set; } = false!;
[Parameter]
public EventCallback<DataUpdateGeneral> EC_UpdateGeneral { get; set; }
[Parameter]
public EventCallback<bool> EC_ReqClose { get; set; }
/// <summary>
/// Elenco anagrafiche di base
/// </summary>
[Parameter]
public BaseListPayload ListPayload { get; set; } = null!;
/// <summary>
/// Elenco Warnings attivi
/// </summary>
[Parameter]
public Dictionary<string, string> ListWarnings { get; set; } = new Dictionary<string, string>();
#endregion Public Properties
#region Protected Properties
/// <summary>
/// Colore corrente
/// </summary>
protected string CurrColor
{
get => currColor;
set
{
currColor = value;
var args = new DataUpdateGeneral
{
Color = value,
};
_ = EC_UpdateGeneral.InvokeAsync(args);
}
}
/// <summary>
/// Vetro corrente
/// </summary>
protected string CurrGlass
{
get => currGlass;
set
{
currGlass = value;
var args = new DataUpdateGeneral
{
Glass = value,
};
_ = EC_UpdateGeneral.InvokeAsync(args);
}
}
/// <summary>
/// Materiale corrente
/// </summary>
protected string CurrMaterial
{
get => currMaterial;
set
{
currMaterial = value;
var args = new DataUpdateGeneral
{
Material = value,
};
_ = EC_UpdateGeneral.InvokeAsync(args);
}
}
/// <summary>
/// Profilo corrente
/// </summary>
protected string CurrProfile
{
get => currProfile;
set
{
currProfile = value;
var args = new DataUpdateGeneral
{
Profile = value,
};
_ = EC_UpdateGeneral.InvokeAsync(args);
}
}
#endregion Protected Properties
#region Protected Methods
/// <summary>
/// Calcola CSS warning
/// </summary>
/// <param name="fKey"></param>
/// <returns></returns>
protected string cssValid(string fKey)
{
return ListWarnings.ContainsKey(fKey) ? "border border-danger" : "";
}
protected override void OnParametersSet()
{
currColor = CurrWindow.sColorMaterial;
currGlass = CurrWindow.sGlass;
currMaterial = CurrWindow.sMaterial;
currProfile = CurrWindow.sProfilePath;
}
#endregion Protected Methods
#region Private Fields
private string currColor = "";
private string currGlass = "";
private string currMaterial = "";
private string currProfile = "";
#endregion Private Fields
private void ReqClose()
{
_ = EC_ReqClose.InvokeAsync(true);
}
}
/// <summary>
/// Classe per aggiornamento dati general
/// </summary>
public class DataUpdateGeneral
{
public string Color { get; set; } = "";
public string Glass { get; set; } = "";
public string Material { get; set; } = "";
public string Profile { get; set; } = "";
}
}