build: Tạo các tệp đầu ra debug ban đầu cho dự án AppClientBase trên iOS và Mac Catalyst.
This commit is contained in:
58
apps/app-client-base/ViewModels/BaseViewModel.cs
Normal file
58
apps/app-client-base/ViewModels/BaseViewModel.cs
Normal file
@@ -0,0 +1,58 @@
|
||||
using CommunityToolkit.Mvvm.ComponentModel;
|
||||
using CommunityToolkit.Mvvm.Input;
|
||||
using AppClientBase.Services;
|
||||
|
||||
namespace AppClientBase.ViewModels;
|
||||
|
||||
/// <summary>
|
||||
/// EN: Base ViewModel class with common functionality.
|
||||
/// VI: Lớp ViewModel cơ sở với chức năng chung.
|
||||
/// </summary>
|
||||
public abstract partial class BaseViewModel : ObservableObject
|
||||
{
|
||||
/// <summary>
|
||||
/// EN: Navigation service instance.
|
||||
/// VI: Instance của dịch vụ điều hướng.
|
||||
/// </summary>
|
||||
protected readonly INavigationService NavigationService;
|
||||
|
||||
/// <summary>
|
||||
/// EN: Indicates if the ViewModel is currently loading data.
|
||||
/// VI: Cho biết ViewModel đang tải dữ liệu hay không.
|
||||
/// </summary>
|
||||
[ObservableProperty]
|
||||
[NotifyPropertyChangedFor(nameof(IsNotBusy))]
|
||||
private bool _isBusy;
|
||||
|
||||
/// <summary>
|
||||
/// EN: Title of the current page.
|
||||
/// VI: Tiêu đề của trang hiện tại.
|
||||
/// </summary>
|
||||
[ObservableProperty]
|
||||
private string _title = string.Empty;
|
||||
|
||||
/// <summary>
|
||||
/// EN: Indicates if the ViewModel is not busy.
|
||||
/// VI: Cho biết ViewModel không bận.
|
||||
/// </summary>
|
||||
public bool IsNotBusy => !IsBusy;
|
||||
|
||||
/// <summary>
|
||||
/// EN: Constructor with navigation service.
|
||||
/// VI: Constructor với dịch vụ điều hướng.
|
||||
/// </summary>
|
||||
protected BaseViewModel(INavigationService navigationService)
|
||||
{
|
||||
NavigationService = navigationService;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// EN: Navigate back to previous page.
|
||||
/// VI: Điều hướng quay lại trang trước.
|
||||
/// </summary>
|
||||
[RelayCommand]
|
||||
protected virtual async Task GoBackAsync()
|
||||
{
|
||||
await NavigationService.GoBackAsync();
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user