using Microsoft.AspNetCore.Components; using Newtonsoft.Json; using System.Security.AccessControl; using WebWindowConfigurator; using WebWindowConfigurator.DTO; namespace Test.UI.Components.Pages { public partial class Home { #region Public Properties public Template SelTemplate { get; set; } = new Template(0, "---SELECT---", "",""); #endregion Public Properties #region Protected Fields protected string currJwd = "..."; #endregion Protected Fields #region Protected Properties protected MarkupString JsonSer { get => (MarkupString)currJwd.Replace(Environment.NewLine, "
").Replace(" ", " "); } protected List AvailTemplateList { get; set; } = new List(); #endregion Protected Properties #region Protected Methods protected override async Task OnInitializedAsync() { //return base.OnInitializedAsync(); AvailTemplateList = new List(); await Task.Delay(100); // brutale, da rivedere... if (File.Exists(cFile)) { string rawVal = File.ReadAllText(cFile); AvailTemplateList = JsonConvert.DeserializeObject>(rawVal) ?? new List(); } #if false ListAvailTemp.Add(new TemplateSelectDTO() { Index = 1, Description = "Anta singola", TemplFile = "Data/AntaSingola.jwd" }); ListAvailTemp.Add(new TemplateSelectDTO() { Index = 2, Description = "Anta doppia", TemplFile = "Data/AntaDoppia.jwd" }); #endif } #endregion Protected Methods #region Private Fields private string cFile = "Data/Setup.json"; #endregion Private Fields #region Private Methods private void SaveJWD(string newSerial) { currJwd = newSerial; } private void SetTemplate(TemplateSelectDTO selTemp) { string rawVal = ""; // brutale,d a rivedere... if (File.Exists(selTemp.JwdFileName)) { rawVal = File.ReadAllText(selTemp.JwdFileName); } SelTemplate = new Template(selTemp.Index, selTemp.Description, selTemp.SVGFileName, rawVal); } #endregion Private Methods } }