fix comportamento tools come parameters

This commit is contained in:
zaccaria.majid
2022-10-27 15:47:47 +02:00
parent 78361306e8
commit 2bb37146dd
3 changed files with 36 additions and 17 deletions
+23 -12
View File
@@ -24,6 +24,9 @@ namespace MP.MONO.UI.Components
[Parameter]
public bool ShowReduced { get; set; } = false;
[Parameter]
public double sampleSecMin { get; set; } = 1;
#endregion Public Properties
#region Public Methods
@@ -134,24 +137,32 @@ namespace MP.MONO.UI.Components
}
}
protected DateTime lastRec = DateTime.Now.AddMinutes(-1);
private void ToolsPipe_EA_NewMessage(object? sender, EventArgs e)
{
PubSubEventArgs currArgs = (PubSubEventArgs)e;
if (!string.IsNullOrEmpty(currArgs.newMessage))
DateTime adesso = DateTime.Now;
if (lastRec.AddSeconds(sampleSecMin) < adesso)
{
try
PubSubEventArgs currArgs = (PubSubEventArgs)e;
if (!string.IsNullOrEmpty(currArgs.newMessage))
{
var rawData = JsonConvert.DeserializeObject<List<DisplayDataDTO>>(currArgs.newMessage);
var allData = rawData == null ? new List<DisplayDataDTO>() : rawData;
FilterData(allData);
lastRec = adesso;
try
{
var rawData = JsonConvert.DeserializeObject<List<DisplayDataDTO>>(currArgs.newMessage);
var allData = rawData == null ? new List<DisplayDataDTO>() : rawData;
FilterData(allData);
}
catch
{ }
InvokeAsync(() =>
{
StateHasChanged();
});
}
catch
{ }
}
InvokeAsync(() =>
{
StateHasChanged();
});
}
#endregion Private Methods
+2 -2
View File
@@ -7,11 +7,11 @@
<div class="card-header">
<div class="row">
<div class="d-flex justify-content-between">
<div class="col-6 d-flex justify-content-between">
<div class="col-6 d-flex">
<div class="mx-0">
<h5 class="pt-2"><i class="fa-solid fa-battery-half pe-2" aria-hidden="true"></i> <b> TOOLS </b></h5>
</div>
<div class="d-flex justify-content-between">
<div class="d-flex justify-content-between mx-2">
<div class="me-3">
<button @onclick="() => resetSel()" class="btn btn-dark @btnResetCss" title="Reset Selection"><i class="fa-solid fa-repeat" title="Reset selection"></i></button>
</div>
+11 -3
View File
@@ -14,6 +14,8 @@ namespace MP.MONO.UI.Pages
private int maxRecord = 120;
private bool showParam = false;
protected int maxDisplay = 18;
private DateTime DateFrom
{
@@ -92,7 +94,10 @@ namespace MP.MONO.UI.Pages
{
if (!selTools.Contains(toolName))
{
selTools.Add(toolName);
if (selTools.Count < maxDisplay)
{
selTools.Add(toolName);
}
}
#if false
@@ -143,7 +148,10 @@ namespace MP.MONO.UI.Pages
{
foreach (var item in ListRecords)
{
selTools.Add(item.Title);
if (selTools.Count < maxDisplay)
{
selTools.Add(item.Title);
}
}
}
}
@@ -157,7 +165,7 @@ namespace MP.MONO.UI.Pages
await InvokeAsync(() => StateHasChanged());
currFilter = newParams;
}
#endregion Protected Methods
}