fix: 使用 CommunityToolkit.Mvvm

This commit is contained in:
Shiqvlizi Name
2026-05-28 23:26:37 +08:00
parent 47572fefb8
commit ef61ae7e6b
12 changed files with 310 additions and 512 deletions

View File

@@ -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";
}
}
}
}