spostato aggiornamento automatico nel componente hardwarenewpanel
This commit is contained in:
@@ -1,12 +1,19 @@
|
||||
@if (DoorOpList != null)
|
||||
{
|
||||
<div class="row">
|
||||
@foreach (var item in DoorOpList)
|
||||
{
|
||||
<div class="col-4" style="min-height: 20rem;">
|
||||
<HwSingleInstance instanceN="@(instNum++)" Lingua="@Lingua" DoorOpInst="@item" HwCode="@HwCode" E_recordUpdate="manageUpdate"></HwSingleInstance>
|
||||
</div>
|
||||
}
|
||||
</div>
|
||||
@if (isLoading)
|
||||
{
|
||||
<EgwCoreLib.Razor.LoadingDataSmall></EgwCoreLib.Razor.LoadingDataSmall>
|
||||
}
|
||||
else
|
||||
{
|
||||
<div class="row">
|
||||
@foreach (var item in DoorOpList)
|
||||
{
|
||||
<div class="col-4" style="min-height: 20rem;">
|
||||
<HwSingleInstance instanceN="@(instNum++)" Lingua="@Lingua" DoorOpInst="@item" HwCode="@HwCode" E_recordUpdate="manageUpdate"></HwSingleInstance>
|
||||
</div>
|
||||
}
|
||||
</div>
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -70,7 +70,7 @@ namespace WebDoorCreator.UI.Components.Hardware
|
||||
{
|
||||
DOPEventArgs currArgs = (DOPEventArgs)e;
|
||||
// SE sono sula porta indicata + objId corretto --> refresh
|
||||
if (currArgs.DoorId == DoorId)//&& currArgs.ObjectId == obid )
|
||||
if (currArgs.DoorId == DoorId && currArgs.ObjectId == HwCode)
|
||||
{
|
||||
var pupd = InvokeAsync(async () => await ReloadData());
|
||||
}
|
||||
@@ -126,14 +126,18 @@ namespace WebDoorCreator.UI.Components.Hardware
|
||||
|
||||
#region Private Methods
|
||||
|
||||
protected bool isLoading { get; set; } = false;
|
||||
|
||||
private async Task ReloadData()
|
||||
{
|
||||
isLoading = true;
|
||||
var ListRecord = await WDCService.DoorOpGetByDoorId(DoorId);
|
||||
var tempListVal = await WDCService.ListValuesGetAll(HwCode, "Folder");
|
||||
if (ListRecord != null)
|
||||
{
|
||||
DoorOpList = ListRecord.Where(x => (x.DoorId == DoorId) && (x.ObjectId == HwCode)).ToList();
|
||||
}
|
||||
isLoading = false;
|
||||
}
|
||||
|
||||
#endregion Private Methods
|
||||
|
||||
@@ -5,6 +5,7 @@ using Newtonsoft.Json;
|
||||
using WebDoorCreator.Data.DbModels;
|
||||
using WebDoorCreator.Data.Services;
|
||||
using WebDoorCreator.UI.Data;
|
||||
using static WebDoorCreator.UI.Data.WDCRefreshService;
|
||||
|
||||
namespace WebDoorCreator.UI.Components.Hardware
|
||||
{
|
||||
@@ -231,6 +232,35 @@ namespace WebDoorCreator.UI.Components.Hardware
|
||||
await FullReloadData();
|
||||
}
|
||||
|
||||
|
||||
#if false
|
||||
|
||||
private void WDCRefresh_EA_ConfDoorOp(object? sender, EventArgs e)
|
||||
{
|
||||
DOPEventArgs currArgs = (DOPEventArgs)e;
|
||||
// SE sono sula porta indicata + objId corretto --> refresh
|
||||
if (currArgs.DoorId == DoorOpInst.DoorId && currArgs.DoorOpId == DoorOpInst.DoorOpId && currArgs.ObjectId == DoorOpInst.ObjectId)//&& currArgs.ObjectId == obid )
|
||||
{
|
||||
var pupd = InvokeAsync(async () => await FullReloadData());
|
||||
}
|
||||
}
|
||||
|
||||
public void Dispose()
|
||||
{
|
||||
WDCRefresh.EA_ConfDoorOp -= WDCRefresh_EA_ConfDoorOp;
|
||||
}
|
||||
|
||||
[Inject]
|
||||
protected WDCRefreshService WDCRefresh { get; set; } = null!;
|
||||
|
||||
protected override async Task OnInitializedAsync()
|
||||
{
|
||||
await FullReloadData();
|
||||
await Task.Delay(1);
|
||||
WDCRefresh.EA_ConfDoorOp += WDCRefresh_EA_ConfDoorOp;
|
||||
}
|
||||
#endif
|
||||
|
||||
protected string translate(string lemma)
|
||||
{
|
||||
string answ = "";
|
||||
|
||||
Reference in New Issue
Block a user