Aggiunta update componenti in pag demo
This commit is contained in:
@@ -1,3 +1,4 @@
|
||||
using EgwCoreLib.Lux.Core;
|
||||
using EgwCoreLib.Lux.Data.Services;
|
||||
using Microsoft.AspNetCore.Components;
|
||||
using Newtonsoft.Json;
|
||||
@@ -7,7 +8,7 @@ using WebWindowConfigurator.DTO;
|
||||
|
||||
namespace Test.UI.Components.Pages
|
||||
{
|
||||
public partial class TestComponent
|
||||
public partial class TestComponent : IDisposable
|
||||
{
|
||||
#region Public Properties
|
||||
|
||||
@@ -15,6 +16,15 @@ namespace Test.UI.Components.Pages
|
||||
|
||||
#endregion Public Properties
|
||||
|
||||
#region Public Methods
|
||||
|
||||
public void Dispose()
|
||||
{
|
||||
DLService.CalcDonePipe.EA_NewMessage -= CalcDonePipe_EA_NewMessage;
|
||||
}
|
||||
|
||||
#endregion Public Methods
|
||||
|
||||
#region Protected Fields
|
||||
|
||||
protected string currJwd = "...";
|
||||
@@ -25,6 +35,15 @@ namespace Test.UI.Components.Pages
|
||||
|
||||
protected List<TemplateSelectDTO> AvailTemplateList { get; set; } = new List<TemplateSelectDTO>();
|
||||
|
||||
[Inject]
|
||||
protected IConfiguration Config { get; set; } = null!;
|
||||
|
||||
[Inject]
|
||||
protected DataLayerServices DLService { get; set; } = null!;
|
||||
|
||||
[Inject]
|
||||
protected ImageCacheService ICService { get; set; } = null!;
|
||||
|
||||
protected MarkupString JsonSer
|
||||
{
|
||||
get => (MarkupString)currJwd.Replace(Environment.NewLine, "<br/>").Replace(" ", " ");
|
||||
@@ -37,21 +56,70 @@ namespace Test.UI.Components.Pages
|
||||
protected override async Task OnInitializedAsync()
|
||||
{
|
||||
ConfInit();
|
||||
DLService.CalcDonePipe.EA_NewMessage += CalcDonePipe_EA_NewMessage;
|
||||
await ReloadData();
|
||||
}
|
||||
|
||||
[Inject]
|
||||
protected IConfiguration Config { get; set; } = null!;
|
||||
#endregion Protected Methods
|
||||
|
||||
[Inject]
|
||||
protected ImageCacheService ImgService { get; set; } = null!;
|
||||
#region Private Fields
|
||||
|
||||
private string apiUrl = "";
|
||||
private string calcTag = "";
|
||||
private string cFile = "Data/Setup.json";
|
||||
private TemplateSelectDTO? currSel = null;
|
||||
private string currSvg = "";
|
||||
|
||||
private string imgBasePath = "";
|
||||
|
||||
private string imgTag = "";
|
||||
|
||||
private string subChannel = "";
|
||||
|
||||
#endregion Private Fields
|
||||
|
||||
#region Private Properties
|
||||
|
||||
private string windowUid
|
||||
{
|
||||
get
|
||||
{
|
||||
string answ = "";
|
||||
if (currSel != null)
|
||||
{
|
||||
answ = currSel.SVGFileName.Replace(".svg", "");
|
||||
}
|
||||
return answ;
|
||||
}
|
||||
}
|
||||
|
||||
#endregion Private Properties
|
||||
|
||||
#region Private Methods
|
||||
|
||||
private async void CalcDonePipe_EA_NewMessage(object? sender, EventArgs e)
|
||||
{
|
||||
// aggiorno visualizzazione
|
||||
PubSubEventArgs currArgs = (PubSubEventArgs)e;
|
||||
// conversione on-the-fly SVG da mostrare
|
||||
if (!string.IsNullOrEmpty(currArgs.newMessage))
|
||||
{
|
||||
if (currArgs.msgUid.Equals($"{subChannel}:{windowUid}"))
|
||||
{
|
||||
currSvg = currArgs.newMessage;
|
||||
}
|
||||
await InvokeAsync(StateHasChanged);
|
||||
}
|
||||
await Task.Delay(1);
|
||||
}
|
||||
|
||||
private void ConfInit()
|
||||
{
|
||||
apiUrl = Config.GetValue<string>("ServerConf:Prog.ApiUrl") ?? "";
|
||||
imgBasePath = Config.GetValue<string>("ServerConf:ImageBaseUrl") ?? "";
|
||||
imgTag = Config.GetValue<string>("ServerConf:ImageFileTag") ?? "";
|
||||
calcTag = Config.GetValue<string>("ServerConf:ImageCalcTag") ?? "";
|
||||
subChannel = Config.GetValue<string>("ServerConf:SvgChannel") ?? "";
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@@ -72,32 +140,26 @@ namespace Test.UI.Components.Pages
|
||||
// calcolo URL immagini... DTO interno da rivedere?
|
||||
foreach (var item in rawList)
|
||||
{
|
||||
item.ImageUrl = ImgService.ImageUrl(imgBasePath, false, item.SVGFileName);
|
||||
item.ImageUrl = ICService.ImageUrl(imgBasePath, false, 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)
|
||||
private async Task SaveJWD(string newSerial)
|
||||
{
|
||||
currJwd = newSerial;
|
||||
// chiamo la chiamata POST alla API, che manda la richiesta via REDIS
|
||||
if (currSel != null)
|
||||
{
|
||||
await ICService.CallRestPost(apiUrl, $"{calcTag}/{windowUid}", currJwd);
|
||||
}
|
||||
}
|
||||
|
||||
private void SetTemplate(TemplateSelectDTO selTemp)
|
||||
{
|
||||
string rawVal = "";
|
||||
currSel = selTemp;
|
||||
// brutale,d a rivedere...
|
||||
if (File.Exists(selTemp.JwdFileName))
|
||||
{
|
||||
|
||||
@@ -25,6 +25,8 @@ builder.Services.AddSingleton<IConnectionMultiplexer>(redisConn);
|
||||
// registro wrapper servizi REDIS
|
||||
builder.Services.AddSingleton<IRedisService, RedisService>();
|
||||
builder.Services.AddSingleton<RedisSubscriptionManager>();
|
||||
// Aggiunta servizi specifici
|
||||
builder.Services.AddSingleton<DataLayerServices>();
|
||||
builder.Services.AddSingleton<ImageCacheService>();
|
||||
|
||||
|
||||
|
||||
@@ -25,11 +25,12 @@
|
||||
<ItemGroup>
|
||||
<ProjectReference Include="..\Test.UI.Client\Test.UI.Client.csproj" />
|
||||
<ProjectReference Include="..\WebWindowConfigurator\WebWindowConfigurator.csproj" />
|
||||
<PackageReference Include="EgwCoreLib.Lux.Core" Version="0.9.2507.2308" />
|
||||
<PackageReference Include="EgwCoreLib.Lux.Data" Version="0.9.2507.2308" />
|
||||
<PackageReference Include="EgwCoreLib.Lux.Core" Version="0.9.2508.417" />
|
||||
<PackageReference Include="EgwCoreLib.Lux.Data" Version="0.9.2508.417" />
|
||||
<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" />
|
||||
<PackageReference Include="RestSharp" Version="112.1.0" />
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
|
||||
@@ -13,8 +13,10 @@
|
||||
"PubChannel": "EgwEngineInput",
|
||||
"SubChannel": "EgwEngineOutput",
|
||||
"SvgChannel": "svg:img",
|
||||
"Prog.ApiUrl": "https://iis01.egalware.com/lux/srv/api/window",
|
||||
"ImageBaseUrl": "https://iis01.egalware.com/lux/srv/api/window",
|
||||
"ImageLiveTag": "svg",
|
||||
"ImageFileTag": "svgfile"
|
||||
"ImageFileTag": "svgfile",
|
||||
"ImageCalcTag": "svg-preview"
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user