diff --git a/framework/src/Volo.Abp.MudBlazorUI/MudBlazorUiPageProgressService.cs b/framework/src/Volo.Abp.MudBlazorUI/MudBlazorUiPageProgressService.cs index aeb9d51841..9a9c11e717 100644 --- a/framework/src/Volo.Abp.MudBlazorUI/MudBlazorUiPageProgressService.cs +++ b/framework/src/Volo.Abp.MudBlazorUI/MudBlazorUiPageProgressService.cs @@ -17,33 +17,57 @@ public class MudBlazorUiPageProgressService : IUiPageProgressService, IScopedDep protected virtual int HideDelayMs => 250; private int _activeCount; - private UiPageProgressOptions _lastOptions = new(); + private bool _visible; + private UiPageProgressOptions _lastOptions; private readonly Timer _hideTimer; public MudBlazorUiPageProgressService() { - _hideTimer = new Timer(_ => ProgressChanged?.Invoke(this, new UiPageProgressEventArgs(-1, _lastOptions))); + _lastOptions = CreateDefaultOptions(); + _hideTimer = new Timer(_ => + { + _visible = false; + ProgressChanged?.Invoke(this, new UiPageProgressEventArgs(-1, _lastOptions)); + }); } public Task Go(int? percentage, Action? options = null) { - var opt = new UiPageProgressOptions(); + var opt = CreateDefaultOptions(); options?.Invoke(opt); _lastOptions = opt; - if (percentage == -1 && Interlocked.Decrement(ref _activeCount) <= 0) + if (percentage == -1) { - Interlocked.Exchange(ref _activeCount, 0); - _hideTimer.Change(HideDelayMs, Timeout.Infinite); + _activeCount--; + if (_activeCount <= 0) + { + _activeCount = 0; + _hideTimer.Change(HideDelayMs, Timeout.Infinite); + } } - else if (percentage == null && Interlocked.Increment(ref _activeCount) == 1) + else if (percentage == null) { + _activeCount++; _hideTimer.Change(Timeout.Infinite, Timeout.Infinite); - ProgressChanged?.Invoke(this, new UiPageProgressEventArgs(null, opt)); + if (!_visible) + { + _visible = true; + ProgressChanged?.Invoke(this, new UiPageProgressEventArgs(null, opt)); + } + } + else + { + ProgressChanged?.Invoke(this, new UiPageProgressEventArgs(percentage, opt)); } return Task.CompletedTask; } + protected virtual UiPageProgressOptions CreateDefaultOptions() + { + return new UiPageProgressOptions(); + } + public void Dispose() => _hideTimer.Dispose(); } diff --git a/modules/identity/src/Volo.Abp.Identity.Blazor.MudBlazor/Pages/Identity/UserManagement.razor b/modules/identity/src/Volo.Abp.Identity.Blazor.MudBlazor/Pages/Identity/UserManagement.razor index f6b0849311..061a1e33b6 100644 --- a/modules/identity/src/Volo.Abp.Identity.Blazor.MudBlazor/Pages/Identity/UserManagement.razor +++ b/modules/identity/src/Volo.Abp.Identity.Blazor.MudBlazor/Pages/Identity/UserManagement.razor @@ -24,6 +24,7 @@ diff --git a/modules/setting-management/src/Volo.Abp.SettingManagement.Blazor.MudBlazor/Pages/SettingManagement/SettingManagement.razor b/modules/setting-management/src/Volo.Abp.SettingManagement.Blazor.MudBlazor/Pages/SettingManagement/SettingManagement.razor index 9bb7e1362c..a9ccb02a6a 100644 --- a/modules/setting-management/src/Volo.Abp.SettingManagement.Blazor.MudBlazor/Pages/SettingManagement/SettingManagement.razor +++ b/modules/setting-management/src/Volo.Abp.SettingManagement.Blazor.MudBlazor/Pages/SettingManagement/SettingManagement.razor @@ -15,13 +15,13 @@ - @if (string.IsNullOrEmpty(SelectedGroup)) + @if (_loading) {
} - else + else if (SettingComponentCreationContext != null && SettingComponentCreationContext.Groups.Any()) {