Spaces:
Sleeping
Sleeping
Download BlazorWebAssembly/Services/NotificationStateService.cs from Yuruyuruu/LibraryManagement: direct link, hf CLI and curl.
- Browser
- Download file 590 Bytes
-
https://huggingface.co/spaces/Yuruyuruu/LibraryManagement/resolve/main/BlazorWebAssembly/Services/NotificationStateService.cs
- Command line
-
hf download hf://spaces/Yuruyuruu/LibraryManagement/BlazorWebAssembly/Services/NotificationStateService.cs
-
curl -L -o NotificationStateService.cs https://huggingface.co/spaces/Yuruyuruu/LibraryManagement/resolve/main/BlazorWebAssembly/Services/NotificationStateService.cs
590 Bytes
| using System; | |
| namespace BlazorWebAssembly.Services | |
| { | |
| public class NotificationStateService | |
| { | |
| public int UnreadCount { get; private set; } | |
| public event Action? OnChange; | |
| public void SetUnreadCount(int count) | |
| { | |
| UnreadCount = count; | |
| NotifyStateChanged(); | |
| } | |
| public void DecrementCount() | |
| { | |
| if (UnreadCount > 0) | |
| { | |
| UnreadCount--; | |
| NotifyStateChanged(); | |
| } | |
| } | |
| private void NotifyStateChanged() => OnChange?.Invoke(); | |
| } | |
| } | |