Update proprietà progressBar

This commit is contained in:
Samuele Locatelli
2023-07-31 09:31:53 +02:00
parent 429009c915
commit aec1e932d1
2 changed files with 16 additions and 6 deletions
@@ -11,4 +11,4 @@
</div>
<button class="btn btn-success" @onclick="StartLongTimer">Start</button>
<ProgressDisplay RefreshInterval="100" Title="@titleMsg" MaxVal="@maxVal" CurrVal="@currVal" NextVal="@nextVal" ExpTimeMSec="@expTimeMSec" DisplaySize="ProgressDisplay.ModalSize.Medium" ModalCss="card alert-primary"></ProgressDisplay>
<ProgressDisplay RefreshInterval="100" Title="@titleMsg" MaxVal="@maxVal" CurrVal="@currVal" NextVal="@nextVal" ExpTimeMSec="@expTimeMSec" DisplaySize="ProgressDisplay.ModalSize.Medium" ModalCss="card alert-primary" SlowLimit="0.4"></ProgressDisplay>
+15 -5
View File
@@ -90,12 +90,22 @@ namespace EgwCoreLib.Razor
public bool ShowPercent { get; set; } = true;
/// <summary>
/// Numero di secondi prima (rispetto valore ExpTimeMsec) da cui iniziare rallentamento
/// Limite per anticipo slowdown (% della durata di ExpTimeMSec)
/// </summary>
[Parameter]
public int SlowWindowMSec { get; set; } = 3000;
public double SlowLimit { get; set; } = 0.5;
//Titolo da mostrare (se "" NON lo mostra)
/// <summary>
/// Numero di secondi prima (rispetto valore ExpTimeMsec) da cui iniziare rallentamento
/// </summary>
private int slowWindowMSec
{
get => (int)(ExpTimeMSec * SlowLimit);
}
/// <summary>
/// Titolo da mostrare (se "" NON lo mostra)
/// </summary>
[Parameter]
public string Title { get; set; } = "Progress";
@@ -203,9 +213,9 @@ namespace EgwCoreLib.Razor
if (isLoading)
{
DateTime adesso = DateTime.Now;
if (nextUpdate <= adesso.AddMilliseconds(SlowWindowMSec))
if (nextUpdate <= adesso.AddMilliseconds(slowWindowMSec))
{
nextUpdate = adesso.AddMilliseconds(RefreshInterval);
nextUpdate = adesso.AddMilliseconds(RefreshInterval*2);
}
// calcolo delta ms...
var numMs = adesso.Subtract(lastUpdate).TotalMilliseconds;