Files
client/Models/ClientSettings.cs

46 lines
1.1 KiB
C#
Raw Permalink Normal View History

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 ClientSettings : ObservableObject
2026-05-23 18:16:50 +08:00
{
2026-05-28 23:26:37 +08:00
[ObservableProperty]
private string serverAddress = "http://localhost:8080";
2026-05-23 18:16:50 +08:00
2026-05-28 23:26:37 +08:00
[ObservableProperty]
private string apiKey = string.Empty;
2026-05-23 18:16:50 +08:00
2026-05-28 23:26:37 +08:00
[ObservableProperty]
private string adminUsername = string.Empty;
2026-05-23 18:16:50 +08:00
2026-05-28 23:26:37 +08:00
[ObservableProperty]
private string adminAccessToken = string.Empty;
2026-05-23 18:16:50 +08:00
2026-05-28 23:26:37 +08:00
[ObservableProperty]
private string storeName = "默认打印店";
2026-05-23 18:16:50 +08:00
2026-05-28 23:26:37 +08:00
[ObservableProperty]
private bool allowInsecureGrpc = true;
2026-05-23 18:16:50 +08:00
2026-05-28 23:26:37 +08:00
[ObservableProperty]
private string libraryRoot = string.Empty;
2026-05-23 18:16:50 +08:00
2026-05-28 23:26:37 +08:00
[ObservableProperty]
private string printCacheRoot = string.Empty;
2026-05-23 18:16:50 +08:00
2026-05-28 23:26:37 +08:00
private int maxUploadSizeMb = 50;
private int heartbeatIntervalSeconds = 15;
2026-05-23 18:16:50 +08:00
public int MaxUploadSizeMb
{
2026-05-28 23:26:37 +08:00
get => maxUploadSizeMb;
set => SetProperty(ref maxUploadSizeMb, Math.Clamp(value, 1, 1024));
2026-05-23 18:16:50 +08:00
}
public int HeartbeatIntervalSeconds
{
2026-05-28 23:26:37 +08:00
get => heartbeatIntervalSeconds;
set => SetProperty(ref heartbeatIntervalSeconds, Math.Clamp(value, 5, 300));
2026-05-23 18:16:50 +08:00
}
2026-05-28 23:26:37 +08:00
}