AcaMate_Web/Program/Services/LoadingService.cs
SEAN-59 3e31f9f46b [] am/Intro 화면 동작 구현
1. 로그인 연동
2. 화면 변환 연동
2.1. 아직 Academy 테이블 연동은 안되어있는 상황
2025-06-17 16:00:56 +09:00

43 lines
992 B
C#

// 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();
}