118 lines
3.2 KiB
C#
118 lines
3.2 KiB
C#
using Egw.Window.Data;
|
|
using Microsoft.AspNetCore.Components;
|
|
using WebWindowComplex.Models;
|
|
|
|
namespace WebWindowComplex.Compo
|
|
{
|
|
public partial class AreaSplit
|
|
{
|
|
#region Public Properties
|
|
|
|
/// <summary>
|
|
/// Lista delle sash
|
|
/// </summary>
|
|
[Parameter]
|
|
public List<Sash> SashGroupList { get; set; } = null!;
|
|
|
|
/// <summary>
|
|
/// Oggetto splitted corrente
|
|
/// </summary>
|
|
[Parameter]
|
|
public Splitted CurrSplitted { get; set; } = null!;
|
|
|
|
/// <summary>
|
|
/// Lista degli Splitted
|
|
/// </summary>
|
|
[Parameter]
|
|
public List<Splitted> SplittedList { get; set; } = null!;
|
|
|
|
/// <summary>
|
|
/// Vocabolario con traduzione lingua corrente
|
|
/// </summary>
|
|
[Parameter]
|
|
public Dictionary<string, string> Vocabulary { get; set; } = null!;
|
|
|
|
/// <summary>
|
|
/// Evento per aggiungere Sash
|
|
/// </summary>
|
|
[Parameter]
|
|
public EventCallback<Splitted> EC_UpdateSplitted { get; set; }
|
|
|
|
#endregion Public Properties
|
|
|
|
#region Protected Methods
|
|
|
|
protected override void OnParametersSet()
|
|
{
|
|
AreaSpDict = Vocabulary.Where(x => x.Key.Contains("CWAreaSp_")).ToDictionary(x => x.Key, y => y.Value);
|
|
}
|
|
|
|
#endregion Protected Methods
|
|
|
|
#region Private Fields
|
|
|
|
private bool isOpen = false;
|
|
|
|
private Dictionary<string, string> AreaSpDict = new();
|
|
|
|
#endregion Private Fields
|
|
|
|
#region Private Methods
|
|
|
|
/// <summary>
|
|
/// Metodo per copiare sash
|
|
/// </summary>
|
|
/// <param name="indexCurrSash"> Indice della finestra che si vuole copiare</param>
|
|
/// <returns></returns>
|
|
private Task RaiseCopySash(int indexCurrSash)
|
|
{
|
|
CurrSplitted.AreaList.RemoveAll(i => i != null);
|
|
Area a = SashGroupList[indexCurrSash].Copy(CurrSplitted);
|
|
a.SetParentArea(CurrSplitted);
|
|
CurrSplitted.AreaList.Add(a);
|
|
return EC_UpdateSplitted.InvokeAsync(CurrSplitted);
|
|
}
|
|
|
|
/// <summary>
|
|
/// Metodo per aggiungere prima sash
|
|
/// </summary>
|
|
/// <returns></returns>
|
|
private Task RaiseAddSash()
|
|
{
|
|
CurrSplitted.AddFirstSash();
|
|
return EC_UpdateSplitted.InvokeAsync(CurrSplitted);
|
|
}
|
|
|
|
/// <summary>
|
|
/// Metodo per aggiungere prima sash
|
|
/// </summary>
|
|
/// <returns></returns>
|
|
private Task RaiseAddInglesina()
|
|
{
|
|
CurrSplitted.AddInglesina();
|
|
return EC_UpdateSplitted.InvokeAsync(CurrSplitted);
|
|
}
|
|
|
|
/// <summary>
|
|
/// Metodo per traduzione in lingua corrente
|
|
/// </summary>
|
|
/// <param name="lemma"></param>
|
|
/// <returns></returns>
|
|
private string Traduci(string lemma)
|
|
{
|
|
string ans = lemma;
|
|
if (AreaSpDict != null && AreaSpDict.ContainsKey(lemma))
|
|
{
|
|
ans = AreaSpDict.GetValueOrDefault(lemma) ?? "";
|
|
}
|
|
return ans;
|
|
}
|
|
|
|
private void ToggleDropdown()
|
|
{
|
|
isOpen = !isOpen;
|
|
}
|
|
|
|
#endregion Private Methods
|
|
}
|
|
} |