Files
client/Models/ClientSettings.cs
2026-05-23 18:16:50 +08:00

77 lines
1.9 KiB
C#

using CloudPrint.Client.Infrastructure;
namespace CloudPrint.Client.Models;
public sealed class ClientSettings : ObservableObject
{
private string _serverAddress = "http://localhost:8080";
private string _apiKey = string.Empty;
private string _adminUsername = string.Empty;
private string _adminAccessToken = string.Empty;
private string _storeName = "默认打印店";
private bool _allowInsecureGrpc = true;
private string _libraryRoot = string.Empty;
private string _printCacheRoot = string.Empty;
private int _maxUploadSizeMb = 50;
private int _heartbeatIntervalSeconds = 15;
public string ServerAddress
{
get => _serverAddress;
set => SetProperty(ref _serverAddress, value);
}
public string ApiKey
{
get => _apiKey;
set => SetProperty(ref _apiKey, value);
}
public string AdminUsername
{
get => _adminUsername;
set => SetProperty(ref _adminUsername, value);
}
public string AdminAccessToken
{
get => _adminAccessToken;
set => SetProperty(ref _adminAccessToken, value);
}
public string StoreName
{
get => _storeName;
set => SetProperty(ref _storeName, value);
}
public bool AllowInsecureGrpc
{
get => _allowInsecureGrpc;
set => SetProperty(ref _allowInsecureGrpc, value);
}
public string LibraryRoot
{
get => _libraryRoot;
set => SetProperty(ref _libraryRoot, value);
}
public string PrintCacheRoot
{
get => _printCacheRoot;
set => SetProperty(ref _printCacheRoot, value);
}
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));
}
}