update pager con avanzamento random

This commit is contained in:
Samuele Locatelli
2021-05-21 13:17:19 +02:00
parent 50079ddb37
commit 61db2f33e5
2 changed files with 55 additions and 10 deletions
+42 -7
View File
@@ -1,4 +1,6 @@
<div class="row">
@inject Services.BlazorTimer Timer
<div class="row">
<div class="col-6 col-lg-10 text-left">
<div class="row">
<div class="col-9 small">
@@ -28,16 +30,20 @@
}
</div>
<div class="col-3">
@if (!showLoading)
{
<span>@totalCount records</span>
}
</div>
</div>
<div class="row">
<div class="col-12 small">
@if (showLoading)
{
<Progress>
<ProgressBar Value="75" Striped="true" Animated="true" />
<ProgressBar Value="@percLoading" Striped="true" Animated="true" />
</Progress>
}
else
{
<span>@totalCount records</span>
}
</div>
</div>
</div>
@@ -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;
+13 -3
View File
@@ -24,8 +24,6 @@ namespace MP.Stats.Data
private readonly IDistributedCache distributedCache;
private readonly IMemoryCache memoryCache;
private DistributedCacheEntryOptions cacheOpt;
/// <summary>
/// Durata assoluta massima della cache
/// </summary>
@@ -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)