Files
lux/Lux.UI/Components/BaseComp.cs
T
2026-06-04 09:23:17 +02:00

83 lines
2.3 KiB
C#

namespace Lux.UI.Components
{
public abstract class BaseComp : ComponentBase
{
#region Protected Properties
[Inject]
protected IVocabolarioService VService { get; set; } = null!;
#endregion Protected Properties
#region Protected Methods
/// <summary>
/// Gestione traduzione interfaccia con lingua corrente
/// </summary>
/// <param name="lemma"></param>
/// <param name="lingua"></param>
/// <returns></returns>
protected string Traduci(string lemma)
{
return VService.Traduci(lemma, lingua);
}
#endregion Protected Methods
#region Private Fields
/// <summary>
/// Lingua corrente (da rivedere con Cascading Parameters
/// </summary>
private string lingua = "IT";
#endregion Private Fields
#region Private Properties
[Inject]
private IConfiguration Config { get; set; } = null!;
#endregion Private Properties
#if false
private static Logger Log = LogManager.GetCurrentClassLogger();
/// <summary>
/// Base path x network share files
/// </summary>
private string basePath = "unsafe_uploads";
private void ConfInit()
{
basePath = Config.GetValue<string>("ServerConf:FileSharePath") ?? "unsafe_uploads";
}
/// <summary>
/// Restituisce il contenuto del file salvato
/// </summary>
/// <param name="folderPath"></param>
/// <param name="secureName"></param>
/// <returns></returns>
private string LoadFileContent(string folderPath, string secureName)
{
string answ = "";
if (!string.IsNullOrEmpty(folderPath))
{
try
{
// calcolo path file...
string filePath = Path.Combine(basePath, folderPath, secureName);
if (File.Exists(filePath))
{
answ = File.ReadAllText(filePath);
}
}
catch (Exception exc)
{
Log.Error($"Exception on LoadFileContent{Environment.NewLine}{exc}");
}
}
return answ;
}
#endif
}
}