Files
client/Models/ClientSettings.cs
2026-05-28 23:26:37 +08:00

46 lines
1.1 KiB
C#

using CommunityToolkit.Mvvm.ComponentModel;
namespace CloudPrint.Client.Models;
public sealed partial class ClientSettings : ObservableObject
{
[ObservableProperty]
private string serverAddress = "http://localhost:8080";
[ObservableProperty]
private string apiKey = string.Empty;
[ObservableProperty]
private string adminUsername = string.Empty;
[ObservableProperty]
private string adminAccessToken = string.Empty;
[ObservableProperty]
private string storeName = "默认打印店";
[ObservableProperty]
private bool allowInsecureGrpc = true;
[ObservableProperty]
private string libraryRoot = string.Empty;
[ObservableProperty]
private string printCacheRoot = string.Empty;
private int maxUploadSizeMb = 50;
private int heartbeatIntervalSeconds = 15;
public int MaxUploadSizeMb
{
get => maxUploadSizeMb;
set => SetProperty(ref maxUploadSizeMb, Math.Clamp(value, 1, 1024));
}
public int HeartbeatIntervalSeconds
{
get => heartbeatIntervalSeconds;
set => SetProperty(ref heartbeatIntervalSeconds, Math.Clamp(value, 5, 300));
}
}