fix: 使用 CommunityToolkit.Mvvm
This commit is contained in:
@@ -1,14 +1,23 @@
|
||||
using CloudPrint.Client.Infrastructure;
|
||||
using CommunityToolkit.Mvvm.ComponentModel;
|
||||
|
||||
namespace CloudPrint.Client.Models;
|
||||
|
||||
public sealed class CloudPrintDocument : ObservableObject
|
||||
public sealed partial class CloudPrintDocument : ObservableObject
|
||||
{
|
||||
private string _title = string.Empty;
|
||||
private string _description = string.Empty;
|
||||
private string _categoryName = "未分类";
|
||||
private bool _isUploaded;
|
||||
private string _syncStatus = "本地";
|
||||
[ObservableProperty]
|
||||
private string title = string.Empty;
|
||||
|
||||
[ObservableProperty]
|
||||
private string description = string.Empty;
|
||||
|
||||
[ObservableProperty]
|
||||
private string categoryName = "未分类";
|
||||
|
||||
[ObservableProperty]
|
||||
private bool isUploaded;
|
||||
|
||||
[ObservableProperty]
|
||||
private string syncStatus = "本地";
|
||||
|
||||
public int Id { get; init; }
|
||||
public string FileName { get; init; } = string.Empty;
|
||||
@@ -21,36 +30,6 @@ public sealed class CloudPrintDocument : ObservableObject
|
||||
public int PageCount { get; init; }
|
||||
public DateTime CreatedAt { get; init; } = DateTime.Now;
|
||||
|
||||
public string Title
|
||||
{
|
||||
get => _title;
|
||||
set => SetProperty(ref _title, value);
|
||||
}
|
||||
|
||||
public string Description
|
||||
{
|
||||
get => _description;
|
||||
set => SetProperty(ref _description, value);
|
||||
}
|
||||
|
||||
public string CategoryName
|
||||
{
|
||||
get => _categoryName;
|
||||
set => SetProperty(ref _categoryName, value);
|
||||
}
|
||||
|
||||
public bool IsUploaded
|
||||
{
|
||||
get => _isUploaded;
|
||||
set => SetProperty(ref _isUploaded, value);
|
||||
}
|
||||
|
||||
public string SyncStatus
|
||||
{
|
||||
get => _syncStatus;
|
||||
set => SetProperty(ref _syncStatus, value);
|
||||
}
|
||||
|
||||
public string FileSizeText
|
||||
{
|
||||
get
|
||||
@@ -68,4 +47,4 @@ public sealed class CloudPrintDocument : ObservableObject
|
||||
return $"{FileSize} B";
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user