From aec1e932d1e8d1293cc04e65407f1f7fde66bf2e Mon Sep 17 00:00:00 2001 From: Samuele Locatelli Date: Mon, 31 Jul 2023 09:31:53 +0200 Subject: [PATCH] =?UTF-8?q?Update=20propriet=C3=A0=20progressBar?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- EgwCoreLib.BlazorTest/Pages/TestLoading.razor | 2 +- EgwCoreLib.Razor/ProgressDisplay.razor.cs | 20 ++++++++++++++----- 2 files changed, 16 insertions(+), 6 deletions(-) diff --git a/EgwCoreLib.BlazorTest/Pages/TestLoading.razor b/EgwCoreLib.BlazorTest/Pages/TestLoading.razor index 9e66ea2..e9bdada 100644 --- a/EgwCoreLib.BlazorTest/Pages/TestLoading.razor +++ b/EgwCoreLib.BlazorTest/Pages/TestLoading.razor @@ -11,4 +11,4 @@ - + diff --git a/EgwCoreLib.Razor/ProgressDisplay.razor.cs b/EgwCoreLib.Razor/ProgressDisplay.razor.cs index db4435b..a3bf777 100644 --- a/EgwCoreLib.Razor/ProgressDisplay.razor.cs +++ b/EgwCoreLib.Razor/ProgressDisplay.razor.cs @@ -90,12 +90,22 @@ namespace EgwCoreLib.Razor public bool ShowPercent { get; set; } = true; /// - /// Numero di secondi prima (rispetto valore ExpTimeMsec) da cui iniziare rallentamento + /// Limite per anticipo slowdown (% della durata di ExpTimeMSec) /// [Parameter] - public int SlowWindowMSec { get; set; } = 3000; + public double SlowLimit { get; set; } = 0.5; - //Titolo da mostrare (se "" NON lo mostra) + /// + /// Numero di secondi prima (rispetto valore ExpTimeMsec) da cui iniziare rallentamento + /// + private int slowWindowMSec + { + get => (int)(ExpTimeMSec * SlowLimit); + } + + /// + /// Titolo da mostrare (se "" NON lo mostra) + /// [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;