MasstransferExporter/MasstransferInfrastructure/Database/DTO/Page.cs

77 lines
1.4 KiB
C#

using System.ComponentModel;
using System.Runtime.CompilerServices;
namespace MasstransferInfrastructure.Database.DTO;
/// <summary>
/// 分页结果
/// </summary>
public class Page<T> : INotifyPropertyChanged
{
private int _total;
private int _pages;
private int _currentPage;
private List<T> _data = [];
private int _pageSize;
public int CurrentPage
{
get => _currentPage;
set
{
_currentPage = value;
OnPropertyChanged();
}
}
public int PageSize
{
get => _pageSize;
set
{
_pageSize = value;
OnPropertyChanged();
}
}
public int Total
{
get => _total;
set
{
_total = value;
OnPropertyChanged();
}
}
public int Pages
{
get => _pages;
set
{
_pages = value;
OnPropertyChanged();
}
}
public List<T> Data
{
get => _data;
set
{
_data = value;
OnPropertyChanged();
}
}
public event PropertyChangedEventHandler? PropertyChanged;
protected virtual void OnPropertyChanged([CallerMemberName] string? propertyName = null)
{
PropertyChanged?.Invoke(this, new PropertyChangedEventArgs(propertyName));
}
}