diff --git a/MP.Stats/Components/DataPager.razor b/MP.Stats/Components/DataPager.razor index 32f4c64f..03cdd0d5 100644 --- a/MP.Stats/Components/DataPager.razor +++ b/MP.Stats/Components/DataPager.razor @@ -1,4 +1,6 @@ -
+@inject Services.BlazorTimer Timer + +
@@ -28,16 +30,20 @@ }
+ @if (!showLoading) + { + @totalCount records + } +
+
+
+
@if (showLoading) { - + } - else - { - @totalCount records - }
@@ -96,8 +102,37 @@ } } + protected override Task OnInitializedAsync() + { + showLoading = false; + return base.OnInitializedAsync(); + } + + protected int percLoading { get; set; } = 0; + + protected bool _showLoading = false; + [Parameter] - public bool showLoading { get; set; } = false; + public bool showLoading + { + get + { + return _showLoading; + } + set + { + if (value) + { + Random random = new Random(); + percLoading = random.Next(30, 90); + } + else + { + percLoading = 5; + } + _showLoading = value; + } + } [Parameter] public int totalCount { get; set; } = 0; diff --git a/MP.Stats/Data/MpStatsService.cs b/MP.Stats/Data/MpStatsService.cs index 7455e85d..cc9fa595 100644 --- a/MP.Stats/Data/MpStatsService.cs +++ b/MP.Stats/Data/MpStatsService.cs @@ -24,8 +24,6 @@ namespace MP.Stats.Data private readonly IDistributedCache distributedCache; private readonly IMemoryCache memoryCache; - private DistributedCacheEntryOptions cacheOpt; - /// /// Durata assoluta massima della cache /// @@ -42,6 +40,7 @@ namespace MP.Stats.Data #region Protected Fields protected static string connStringBBM = ""; + protected static string connStringFatt = ""; #endregion Protected Fields @@ -61,7 +60,6 @@ namespace MP.Stats.Data // conf cache this.memoryCache = memoryCache; this.distributedCache = distributedCache; - cacheOpt = new DistributedCacheEntryOptions().SetAbsoluteExpiration(DateTime.Now.AddMinutes(chAbsExp)).SetSlidingExpiration(TimeSpan.FromMinutes(chSliExp)); // conf DB string connStr = _configuration.GetConnectionString("Mp.Stats"); if (string.IsNullOrEmpty(connStr)) @@ -80,6 +78,18 @@ namespace MP.Stats.Data #endregion Public Constructors + #region Private Properties + + private DistributedCacheEntryOptions cacheOpt + { + get + { + return new DistributedCacheEntryOptions().SetAbsoluteExpiration(DateTime.Now.AddMinutes(chAbsExp)).SetSlidingExpiration(TimeSpan.FromMinutes(chSliExp)); + } + } + + #endregion Private Properties + #region Protected Methods protected string getCacheKey(string TableName, SelectData CurrFilter)