108 lines
2.9 KiB
C#
108 lines
2.9 KiB
C#
using Microsoft.AspNetCore.Components;
|
|
using WebWindowComplex.Models;
|
|
|
|
namespace WebWindowComplex.Compo
|
|
{
|
|
public partial class EditSplitElement
|
|
{
|
|
#region Public Properties
|
|
|
|
/// <summary>
|
|
/// Element corrente
|
|
/// </summary>
|
|
[Parameter]
|
|
public SplitElementDimension CurrRec { get; set; } = null!;
|
|
|
|
/// <summary>
|
|
/// Tipo dello split element corrente
|
|
/// </summary>
|
|
[Parameter]
|
|
public string Type { get; set; } = null!;
|
|
|
|
/// <summary>
|
|
/// Aggiornamento element
|
|
/// </summary>
|
|
[Parameter]
|
|
public EventCallback<SplitElementDimension> EC_Update { get; set; }
|
|
|
|
/// <summary>
|
|
/// Livello di accesso (utente base)
|
|
/// </summary>
|
|
[CascadingParameter(Name = "User")]
|
|
public bool BaseUser { get; set; } = false!;
|
|
|
|
/// <summary>
|
|
/// Vocabolario con traduzione lingua corrente
|
|
/// </summary>
|
|
[CascadingParameter(Name = "Vocabulary")]
|
|
public Dictionary<string, string> Vocabulary { get; set; } = null!;
|
|
|
|
#endregion Public Properties
|
|
|
|
#region Protected Properties
|
|
|
|
protected override void OnParametersSet()
|
|
{
|
|
SplitElemDict = Vocabulary.Where(x => x.Key.Contains("CWSplitElem_")).ToDictionary(x => x.Key, y => y.Value);
|
|
}
|
|
|
|
#endregion Protected Properties
|
|
|
|
#region Private Fields
|
|
|
|
private Dictionary<string, string> SplitElemDict = new();
|
|
|
|
#endregion Private Fields
|
|
|
|
#region Private Properties
|
|
|
|
/// <summary>
|
|
/// Metodo per aggiornare element corrente
|
|
/// </summary>
|
|
private double updateVal
|
|
{
|
|
get => CurrRec.dDimension;
|
|
set
|
|
{
|
|
if (CurrRec.dDimension != value)
|
|
{
|
|
CurrRec.dDimension = value;
|
|
_ = EC_Update.InvokeAsync(CurrRec);
|
|
}
|
|
}
|
|
}
|
|
|
|
#endregion Private Properties
|
|
|
|
#region Private Methods
|
|
|
|
private string GetImageElemPath() => $"_content/Egw.Lux.WebWindowComplex/icone/split/element/{Type}.svg";
|
|
|
|
private string Title()
|
|
{
|
|
return "Min: " + CurrRec.dMinDim + ", Max: " + CurrRec.dMaxDim;
|
|
}
|
|
|
|
/// <summary>
|
|
/// Metodo per traduzione in lingua corrente
|
|
/// </summary>
|
|
/// <param name="lemma"></param>
|
|
/// <returns></returns>
|
|
private string Traduci(string lemma)
|
|
{
|
|
string ans = "";
|
|
string totalLemma = "CWSplitElem_Height";
|
|
if (lemma.Equals("Vertical"))
|
|
{
|
|
totalLemma = "CWSplitElem_Width";
|
|
}
|
|
if (SplitElemDict != null && SplitElemDict.ContainsKey(totalLemma))
|
|
{
|
|
ans = SplitElemDict.GetValueOrDefault(totalLemma) ?? "";
|
|
}
|
|
return ans;
|
|
}
|
|
|
|
#endregion Private Methods
|
|
}
|
|
} |