using CommunityToolkit.Mvvm.ComponentModel; using CommunityToolkit.Mvvm.Input; using AppClientBase.Services; namespace AppClientBase.ViewModels; /// /// EN: Base ViewModel class with common functionality. /// VI: Lớp ViewModel cơ sở với chức năng chung. /// public abstract partial class BaseViewModel : ObservableObject { /// /// EN: Navigation service instance. /// VI: Instance của dịch vụ điều hướng. /// protected readonly INavigationService NavigationService; /// /// EN: Indicates if the ViewModel is currently loading data. /// VI: Cho biết ViewModel đang tải dữ liệu hay không. /// [ObservableProperty] [NotifyPropertyChangedFor(nameof(IsNotBusy))] private bool _isBusy; /// /// EN: Title of the current page. /// VI: Tiêu đề của trang hiện tại. /// [ObservableProperty] private string _title = string.Empty; /// /// EN: Indicates if the ViewModel is not busy. /// VI: Cho biết ViewModel không bận. /// public bool IsNotBusy => !IsBusy; /// /// EN: Constructor with navigation service. /// VI: Constructor với dịch vụ điều hướng. /// protected BaseViewModel(INavigationService navigationService) { NavigationService = navigationService; } /// /// EN: Navigate back to previous page. /// VI: Điều hướng quay lại trang trước. /// [RelayCommand] protected virtual async Task GoBackAsync() { await NavigationService.GoBackAsync(); } }