Fix recupero IMG da API service
This commit is contained in:
@@ -13,13 +13,16 @@
|
||||
<span class="bi bi-house-door-fill-nav-menu" aria-hidden="true"></span> Home
|
||||
</NavLink>
|
||||
</div>
|
||||
|
||||
<div class="nav-item px-3">
|
||||
<NavLink class="nav-link" href="TestComponent">
|
||||
<span class="bi bi-plus-square-fill-nav-menu" aria-hidden="true"></span> Test Component
|
||||
</NavLink>
|
||||
</div>
|
||||
<div class="nav-item px-3">
|
||||
<NavLink class="nav-link" href="counter">
|
||||
<span class="bi bi-plus-square-fill-nav-menu" aria-hidden="true"></span> Counter
|
||||
</NavLink>
|
||||
</div>
|
||||
|
||||
<div class="nav-item px-3">
|
||||
<NavLink class="nav-link" href="weather">
|
||||
<span class="bi bi-list-nested-nav-menu" aria-hidden="true"></span> Weather
|
||||
|
||||
@@ -0,0 +1,12 @@
|
||||
@page "/TestComponent"
|
||||
@rendermode InteractiveServer
|
||||
|
||||
<PageTitle>TestComponent</PageTitle>
|
||||
|
||||
<WebWindowMaker IN_TemplateDTOList="@AvailTemplateList"
|
||||
IN_SelTemplate="@SelTemplate"
|
||||
EC_OnUpdate="SaveJWD"
|
||||
EC_OnSelectedTemplate="SetTemplate">
|
||||
</WebWindowMaker>
|
||||
|
||||
|
||||
@@ -0,0 +1,108 @@
|
||||
using EgwCoreLib.Lux.Data.Services;
|
||||
using Microsoft.AspNetCore.Components;
|
||||
using Newtonsoft.Json;
|
||||
using NLog;
|
||||
using WebWindowConfigurator;
|
||||
using WebWindowConfigurator.DTO;
|
||||
|
||||
namespace Test.UI.Components.Pages
|
||||
{
|
||||
public partial class TestComponent
|
||||
{
|
||||
#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 List<TemplateSelectDTO> AvailTemplateList { get; set; } = new List<TemplateSelectDTO>();
|
||||
|
||||
protected MarkupString JsonSer
|
||||
{
|
||||
get => (MarkupString)currJwd.Replace(Environment.NewLine, "<br/>").Replace(" ", " ");
|
||||
}
|
||||
|
||||
#endregion Protected Properties
|
||||
|
||||
#region Protected Methods
|
||||
|
||||
protected override async Task OnInitializedAsync()
|
||||
{
|
||||
ConfInit();
|
||||
await ReloadData();
|
||||
}
|
||||
|
||||
[Inject]
|
||||
protected IConfiguration Config { get; set; } = null!;
|
||||
|
||||
private string imgBasePath = "";
|
||||
private string imgTag = "";
|
||||
private void ConfInit()
|
||||
{
|
||||
imgBasePath = Config.GetValue<string>("ServerConf:ImageBaseUrl") ?? "";
|
||||
imgTag = Config.GetValue<string>("ServerConf:ImageFileTag") ?? "";
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Rilettura dati
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
private async Task ReloadData()
|
||||
{
|
||||
//return base.OnInitializedAsync();
|
||||
AvailTemplateList = new List<TemplateSelectDTO>();
|
||||
await Task.Delay(100);
|
||||
// brutale, da rivedere...
|
||||
if (File.Exists(cFile))
|
||||
{
|
||||
string rawVal = File.ReadAllText(cFile);
|
||||
var rawList = JsonConvert.DeserializeObject<List<TemplateSelectDTO>>(rawVal) ?? new List<TemplateSelectDTO>();
|
||||
|
||||
// calcolo URL immagini... DTO da rivedere...
|
||||
foreach (var item in rawList)
|
||||
{
|
||||
item.ImageUrl = $"{imgBasePath}{imgTag}/{item.SVGFileName}";
|
||||
AvailTemplateList.Add(item);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
#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
|
||||
}
|
||||
}
|
||||
@@ -2,31 +2,31 @@
|
||||
{
|
||||
"Index": 1,
|
||||
"Description": "Anta singola",
|
||||
"SVGFileName": "Images/ImgRouter/Singola.svg",
|
||||
"SVGFileName": "AntaDoppia.svg",
|
||||
"JwdFileName": "Data/AntaSingola.jwd"
|
||||
},
|
||||
{
|
||||
"Index": 2,
|
||||
"Description": "Anta doppia",
|
||||
"SVGFileName": "Images/ImgRouter/Doppia.svg",
|
||||
"SVGFileName": "AntaDoppia.svg",
|
||||
"JwdFileName": "Data/AntaDoppia.jwd"
|
||||
},
|
||||
{
|
||||
"Index": 3,
|
||||
"Description": "Finestra con split verticale",
|
||||
"SVGFileName": "",
|
||||
"SVGFileName": "FinestraSplitVert.svg",
|
||||
"JwdFileName": "Data/FinestraSplitVert.jwd"
|
||||
},
|
||||
{
|
||||
"Index": 4,
|
||||
"Description": "Finestra con split verticale e orizzontale",
|
||||
"SVGFileName": "",
|
||||
"SVGFileName": "FinestraSplitVertOriz.svg",
|
||||
"JwdFileName": "Data/FinestraSplitVertOriz.jwd"
|
||||
},
|
||||
{
|
||||
"Index": 5,
|
||||
"Description": "Finestra con split orizzontale (sopra due ante e sotto vetro fisso)",
|
||||
"SVGFileName": "",
|
||||
"SVGFileName": "FinDueAnteBottomFisso.svg",
|
||||
"JwdFileName": "Data/FinDueAnteBottomFisso.jwd"
|
||||
}
|
||||
|
||||
|
||||
@@ -25,6 +25,10 @@
|
||||
<ItemGroup>
|
||||
<ProjectReference Include="..\Test.UI.Client\Test.UI.Client.csproj" />
|
||||
<ProjectReference Include="..\WebWindowConfigurator\WebWindowConfigurator.csproj" />
|
||||
<PackageReference Include="EgwCoreLib.Lux.Core" Version="0.9.2507.2307" />
|
||||
<PackageReference Include="EgwCoreLib.Lux.Data" Version="0.9.2507.2307" />
|
||||
<PackageReference Include="EgwCoreLib.Razor" Version="1.5.2507.1815" />
|
||||
<PackageReference Include="EgwCoreLib.Utils" Version="1.5.2507.1815" />
|
||||
<PackageReference Include="Microsoft.AspNetCore.Components.WebAssembly.Server" Version="8.0.17" />
|
||||
</ItemGroup>
|
||||
|
||||
|
||||
@@ -5,5 +5,12 @@
|
||||
"Microsoft.AspNetCore": "Warning"
|
||||
}
|
||||
},
|
||||
"AllowedHosts": "*"
|
||||
"AllowedHosts": "*",
|
||||
"ServerConf": {
|
||||
"PubChannel": "EgwEngineInput",
|
||||
"SubChannel": "EgwEngineOutput",
|
||||
"ImageBaseUrl": "https://iis01.egalware.com/lux/srv/api/window/",
|
||||
"ImageLiveTag": "svg",
|
||||
"ImageFileTag": "svgfile"
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user