// using Front.Program.Views.Project.Common; using Front.Program.Models; using Microsoft.AspNetCore.Components; namespace Front.Program.Services; // 뷰를 참조 안하고도 로딩 상태를 알 수 있게 바꾸기 public class LoadingService { public bool IsLoading { get; private set; } private bool isNavigationLoading { get; set; } public event Action? OnChange; public void ShowLoading(bool isNavigation = false) { IsLoading = true; isNavigationLoading = isNavigation; NotifyStateChanged(); } public void HideLoading() { if (!isNavigationLoading) { IsLoading = false; NotifyStateChanged(); } } public void HideNavigationLoading() { if (isNavigationLoading) { IsLoading = false; isNavigationLoading = false; NotifyStateChanged(); } } private void NotifyStateChanged() => OnChange?.Invoke(); }