2026-05-28 23:26:37 +08:00
|
|
|
using CommunityToolkit.Mvvm.ComponentModel;
|
2026-05-23 18:16:50 +08:00
|
|
|
|
|
|
|
|
namespace CloudPrint.Client.Models;
|
|
|
|
|
|
2026-05-28 23:26:37 +08:00
|
|
|
public sealed partial class CloudPrintDocument : ObservableObject
|
2026-05-23 18:16:50 +08:00
|
|
|
{
|
2026-05-28 23:26:37 +08:00
|
|
|
[ObservableProperty]
|
|
|
|
|
private string title = string.Empty;
|
|
|
|
|
|
|
|
|
|
[ObservableProperty]
|
|
|
|
|
private string description = string.Empty;
|
|
|
|
|
|
|
|
|
|
[ObservableProperty]
|
|
|
|
|
private string categoryName = "未分类";
|
|
|
|
|
|
|
|
|
|
[ObservableProperty]
|
|
|
|
|
private bool isUploaded;
|
|
|
|
|
|
|
|
|
|
[ObservableProperty]
|
|
|
|
|
private string syncStatus = "本地";
|
2026-05-23 18:16:50 +08:00
|
|
|
|
|
|
|
|
public int Id { get; init; }
|
|
|
|
|
public string FileName { get; init; } = string.Empty;
|
|
|
|
|
public string FilePath { get; init; } = string.Empty;
|
|
|
|
|
public string FileType { get; init; } = string.Empty;
|
|
|
|
|
public long FileSize { get; init; }
|
|
|
|
|
public string UploaderType { get; init; } = "admin";
|
|
|
|
|
public int UploaderId { get; init; }
|
|
|
|
|
public int CategoryId { get; init; }
|
|
|
|
|
public int PageCount { get; init; }
|
|
|
|
|
public DateTime CreatedAt { get; init; } = DateTime.Now;
|
|
|
|
|
|
|
|
|
|
public string FileSizeText
|
|
|
|
|
{
|
|
|
|
|
get
|
|
|
|
|
{
|
|
|
|
|
if (FileSize >= 1024 * 1024)
|
|
|
|
|
{
|
|
|
|
|
return $"{FileSize / 1024d / 1024d:F2} MB";
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (FileSize >= 1024)
|
|
|
|
|
{
|
|
|
|
|
return $"{FileSize / 1024d:F2} KB";
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return $"{FileSize} B";
|
|
|
|
|
}
|
|
|
|
|
}
|
2026-05-28 23:26:37 +08:00
|
|
|
}
|