mirror of
https://github.com/BeyondDimension/SteamTools.git
synced 2026-10-24 19:00:04 +08:00
fix
This commit is contained in:
@@ -6,8 +6,6 @@ namespace System.Application.Settings
|
||||
{
|
||||
public abstract class SettingsHostBase
|
||||
{
|
||||
protected static readonly bool IsDesktopPlatform = OperatingSystem2.IsWindows || OperatingSystem2.IsMacOS || (OperatingSystem2.IsLinux && !OperatingSystem2.IsAndroid);
|
||||
|
||||
static readonly Dictionary<Type, SettingsHostBase> instances = new();
|
||||
|
||||
public string CategoryName => GetCategoryName();
|
||||
|
||||
@@ -36,10 +36,6 @@ namespace System.Application.UI
|
||||
|
||||
public MainApplication(IntPtr javaReference, JniHandleOwnership transfer) : base(javaReference, transfer)
|
||||
{
|
||||
IViewModelBase.IsInDesignMode = false;
|
||||
IViewModelBase.IsMobileLayout = true;
|
||||
IWindowViewModel.IsSupportedSizePosition = false;
|
||||
|
||||
// 此页面当前使用 Square.Picasso 库加载图片
|
||||
AuthTradeWindowViewModel.IsLoadImage = false;
|
||||
}
|
||||
|
||||
@@ -13,7 +13,7 @@ namespace System.Application.Settings
|
||||
{
|
||||
partial class GameLibrarySettings
|
||||
{
|
||||
static readonly SerializableProperty<Dictionary<uint, string?>>? _HideGameList = IsDesktopPlatform ? GetProperty(defaultValue: new Dictionary<uint, string?>(), autoSave: true) : null;
|
||||
static readonly SerializableProperty<Dictionary<uint, string?>>? _HideGameList = IApplication.IsDesktopPlatform ? GetProperty(defaultValue: new Dictionary<uint, string?>(), autoSave: true) : null;
|
||||
/// <summary>
|
||||
/// 隐藏的游戏列表
|
||||
/// </summary>
|
||||
@@ -22,7 +22,7 @@ namespace System.Application.Settings
|
||||
[SupportedOSPlatform("Linux")]
|
||||
public static SerializableProperty<Dictionary<uint, string?>> HideGameList => _HideGameList ?? throw new PlatformNotSupportedException();
|
||||
|
||||
readonly static SerializableProperty<Dictionary<uint, string?>>? _AFKAppList = IsDesktopPlatform ? GetProperty(defaultValue: new Dictionary<uint, string?>(), autoSave: true) : null;
|
||||
readonly static SerializableProperty<Dictionary<uint, string?>>? _AFKAppList = IApplication.IsDesktopPlatform ? GetProperty(defaultValue: new Dictionary<uint, string?>(), autoSave: true) : null;
|
||||
/// <summary>
|
||||
/// 挂时长游戏列表
|
||||
/// </summary>
|
||||
@@ -32,7 +32,7 @@ namespace System.Application.Settings
|
||||
public static SerializableProperty<Dictionary<uint, string?>> AFKAppList => _AFKAppList ?? throw new PlatformNotSupportedException();
|
||||
|
||||
readonly static SerializableProperty<bool>? _IsAutoAFKApps
|
||||
= IsDesktopPlatform ? GetProperty(defaultValue: true, autoSave: true) : null;
|
||||
= IApplication.IsDesktopPlatform ? GetProperty(defaultValue: true, autoSave: true) : null;
|
||||
/// <summary>
|
||||
/// 启用自动挂机
|
||||
/// </summary>
|
||||
@@ -44,7 +44,7 @@ namespace System.Application.Settings
|
||||
// [SupportedOSPlatform("Windows")]
|
||||
// [SupportedOSPlatform("macOS")]
|
||||
// [SupportedOSPlatform("Linux")]
|
||||
// public static readonly Lazy<ReadOnlyCollection<uint>>? DefaultIgnoreList = IsDesktopPlatform ? new(new ReadOnlyCollection<uint>(new uint[]
|
||||
// public static readonly Lazy<ReadOnlyCollection<uint>>? DefaultIgnoreList = IApplication.IsDesktopPlatform ? new(new ReadOnlyCollection<uint>(new uint[]
|
||||
// {
|
||||
// 5,
|
||||
// 7,
|
||||
|
||||
@@ -17,7 +17,7 @@ namespace System.Application.Settings
|
||||
{
|
||||
partial class GeneralSettings
|
||||
{
|
||||
readonly static SerializableProperty<bool>? _WindowsStartupAutoRun = IsDesktopPlatform ? GetProperty(defaultValue: false, autoSave: true) : null;
|
||||
readonly static SerializableProperty<bool>? _WindowsStartupAutoRun = IApplication.IsDesktopPlatform ? GetProperty(defaultValue: false, autoSave: true) : null;
|
||||
/// <summary>
|
||||
/// 程序是否开机自启动
|
||||
/// </summary>
|
||||
@@ -26,7 +26,7 @@ namespace System.Application.Settings
|
||||
[SupportedOSPlatform("Linux")]
|
||||
public static SerializableProperty<bool> WindowsStartupAutoRun => _WindowsStartupAutoRun ?? throw new PlatformNotSupportedException();
|
||||
|
||||
readonly static SerializableProperty<bool>? _IsStartupAppMinimized = IsDesktopPlatform ? GetProperty(defaultValue: false, autoSave: true) : null;
|
||||
readonly static SerializableProperty<bool>? _IsStartupAppMinimized = IApplication.IsDesktopPlatform ? GetProperty(defaultValue: false, autoSave: true) : null;
|
||||
/// <summary>
|
||||
/// 程序启动时最小化
|
||||
/// </summary>
|
||||
@@ -36,7 +36,7 @@ namespace System.Application.Settings
|
||||
public static SerializableProperty<bool>? IsStartupAppMinimized => _IsStartupAppMinimized ?? throw new PlatformNotSupportedException();
|
||||
|
||||
readonly static SerializableProperty<bool>? _IsSteamAppListLocalCache
|
||||
= IsDesktopPlatform ? GetProperty(defaultValue: true, autoSave: true) : null;
|
||||
= IApplication.IsDesktopPlatform ? GetProperty(defaultValue: true, autoSave: true) : null;
|
||||
/// <summary>
|
||||
/// 启用游戏列表本地缓存
|
||||
/// </summary>
|
||||
@@ -45,7 +45,7 @@ namespace System.Application.Settings
|
||||
[SupportedOSPlatform("Linux")]
|
||||
public static SerializableProperty<bool>? IsSteamAppListLocalCache => _IsSteamAppListLocalCache ?? throw new PlatformNotSupportedException();
|
||||
|
||||
readonly static SerializableProperty<IReadOnlyDictionary<Platform, string>>? _TextReaderProvider = IsDesktopPlatform ? GetProperty(defaultValue: (IReadOnlyDictionary<Platform, string>?)null, autoSave: true) : null;
|
||||
readonly static SerializableProperty<IReadOnlyDictionary<Platform, string>>? _TextReaderProvider = IApplication.IsDesktopPlatform ? GetProperty(defaultValue: (IReadOnlyDictionary<Platform, string>?)null, autoSave: true) : null;
|
||||
/// <summary>
|
||||
/// 用户设置的文本阅读器提供商,根据平台值不同,值格式为 枚举字符串 或 程序路径
|
||||
/// </summary>
|
||||
@@ -54,7 +54,7 @@ namespace System.Application.Settings
|
||||
[SupportedOSPlatform("Linux")]
|
||||
public static SerializableProperty<IReadOnlyDictionary<Platform, string>> TextReaderProvider => _TextReaderProvider ?? throw new PlatformNotSupportedException();
|
||||
|
||||
readonly static SerializableProperty<IHostsFileService.EncodingType>? _HostsEncodingType = IsDesktopPlatform ? GetProperty(defaultValue: default(IHostsFileService.EncodingType), autoSave: true) : null;
|
||||
readonly static SerializableProperty<IHostsFileService.EncodingType>? _HostsEncodingType = IApplication.IsDesktopPlatform ? GetProperty(defaultValue: default(IHostsFileService.EncodingType), autoSave: true) : null;
|
||||
/// <summary>
|
||||
/// Hosts 文件编码类型
|
||||
/// </summary>
|
||||
@@ -63,7 +63,7 @@ namespace System.Application.Settings
|
||||
[SupportedOSPlatform("Linux")]
|
||||
public static SerializableProperty<IHostsFileService.EncodingType> HostsEncodingType => _HostsEncodingType ?? throw new PlatformNotSupportedException();
|
||||
|
||||
readonly static SerializableProperty<bool>? _UseGPURendering = IsDesktopPlatform ? GetProperty(defaultValue: !OperatingSystem2.IsWindows7, autoSave: true) : null;
|
||||
readonly static SerializableProperty<bool>? _UseGPURendering = IApplication.IsDesktopPlatform ? GetProperty(defaultValue: !OperatingSystem2.IsWindows7, autoSave: true) : null;
|
||||
/// <summary>
|
||||
/// 使用硬件加速
|
||||
/// </summary>
|
||||
|
||||
@@ -14,7 +14,7 @@ namespace System.Application.Settings
|
||||
partial class ProxySettings
|
||||
{
|
||||
readonly static SerializableProperty<bool>? _IsProxyGOG
|
||||
= IsDesktopPlatform ? GetProperty(defaultValue: false, autoSave: true) : null;
|
||||
= IApplication.IsDesktopPlatform ? GetProperty(defaultValue: false, autoSave: true) : null;
|
||||
/// <summary>
|
||||
/// 启用GOG插件代理
|
||||
/// </summary>
|
||||
@@ -24,7 +24,7 @@ namespace System.Application.Settings
|
||||
public static SerializableProperty<bool> IsProxyGOG => _IsProxyGOG ?? throw new PlatformNotSupportedException();
|
||||
|
||||
readonly static SerializableProperty<bool>? _EnableWindowsProxy
|
||||
= IsDesktopPlatform ? GetProperty(defaultValue: false, autoSave: true) : null;
|
||||
= IApplication.IsDesktopPlatform ? GetProperty(defaultValue: false, autoSave: true) : null;
|
||||
/// <summary>
|
||||
/// 启用系统代理模式
|
||||
/// </summary>
|
||||
@@ -34,7 +34,7 @@ namespace System.Application.Settings
|
||||
public static SerializableProperty<bool> EnableWindowsProxy => _EnableWindowsProxy ?? throw new PlatformNotSupportedException();
|
||||
|
||||
readonly static SerializableProperty<bool>? _IsOnlyWorkSteamBrowser
|
||||
= IsDesktopPlatform ? GetProperty(defaultValue: false, autoSave: true) : null;
|
||||
= IApplication.IsDesktopPlatform ? GetProperty(defaultValue: false, autoSave: true) : null;
|
||||
/// <summary>
|
||||
/// 是否只针对Steam内置浏览器启用脚本
|
||||
/// </summary>
|
||||
|
||||
@@ -16,7 +16,7 @@ namespace System.Application.Settings
|
||||
{
|
||||
#region Compat
|
||||
|
||||
readonly static SerializableProperty<ConcurrentDictionary<long, string?>>? _AccountRemarks = IsDesktopPlatform ? Compat.GetProperty(defaultValue: new ConcurrentDictionary<long, string?>(), autoSave: false) : null;
|
||||
readonly static SerializableProperty<ConcurrentDictionary<long, string?>>? _AccountRemarks = IApplication.IsDesktopPlatform ? Compat.GetProperty(defaultValue: new ConcurrentDictionary<long, string?>(), autoSave: false) : null;
|
||||
/// <summary>
|
||||
/// Steam账号备注字典
|
||||
/// </summary>
|
||||
|
||||
@@ -26,7 +26,7 @@ namespace System.Application.Settings
|
||||
[SupportedOSPlatform("Linux")]
|
||||
public static SerializableProperty<ConcurrentDictionary<string, SizePosition>> WindowSizePositions => _WindowSizePositions ?? throw new PlatformNotSupportedException();
|
||||
|
||||
readonly static SerializableProperty<string>? _FontName = IsDesktopPlatform ? GetProperty(defaultValue: "Default", autoSave: true) : null;
|
||||
readonly static SerializableProperty<string>? _FontName = IApplication.IsDesktopPlatform ? GetProperty(defaultValue: "Default", autoSave: true) : null;
|
||||
/// <summary>
|
||||
/// 字体
|
||||
/// </summary>
|
||||
@@ -35,7 +35,7 @@ namespace System.Application.Settings
|
||||
[SupportedOSPlatform("Linux")]
|
||||
public static SerializableProperty<string> FontName => _FontName ?? throw new PlatformNotSupportedException();
|
||||
|
||||
readonly static SerializableProperty<double>? _AcrylicOpacity = IsDesktopPlatform ? GetProperty(defaultValue: .8, autoSave: true) : null;
|
||||
readonly static SerializableProperty<double>? _AcrylicOpacity = IApplication.IsDesktopPlatform ? GetProperty(defaultValue: .8, autoSave: true) : null;
|
||||
/// <summary>
|
||||
/// 窗口背景透明度
|
||||
/// </summary>
|
||||
@@ -44,7 +44,7 @@ namespace System.Application.Settings
|
||||
[SupportedOSPlatform("Linux")]
|
||||
public static SerializableProperty<double> AcrylicOpacity => _AcrylicOpacity ?? throw new PlatformNotSupportedException();
|
||||
|
||||
readonly static SerializableProperty<int>? _WindowBackgroundMateria = IsDesktopPlatform ? GetProperty(defaultValue: OperatingSystem2.IsWindows11AtLeast ? 4 : 3, autoSave: true) : null;
|
||||
readonly static SerializableProperty<int>? _WindowBackgroundMateria = IApplication.IsDesktopPlatform ? GetProperty(defaultValue: OperatingSystem2.IsWindows11AtLeast ? 4 : 3, autoSave: true) : null;
|
||||
/// <summary>
|
||||
/// 窗口背景材质
|
||||
/// </summary>
|
||||
@@ -53,7 +53,7 @@ namespace System.Application.Settings
|
||||
[SupportedOSPlatform("Linux")]
|
||||
public static SerializableProperty<int> WindowBackgroundMateria => _WindowBackgroundMateria ?? throw new PlatformNotSupportedException();
|
||||
|
||||
readonly static SerializableProperty<int>? _AppGridSize = IsDesktopPlatform ? GetProperty(defaultValue: 150, autoSave: true) : null;
|
||||
readonly static SerializableProperty<int>? _AppGridSize = IApplication.IsDesktopPlatform ? GetProperty(defaultValue: 150, autoSave: true) : null;
|
||||
/// <summary>
|
||||
/// 库存游戏封面大小
|
||||
/// </summary>
|
||||
@@ -62,7 +62,7 @@ namespace System.Application.Settings
|
||||
[SupportedOSPlatform("Linux")]
|
||||
public static SerializableProperty<int> AppGridSize => _AppGridSize ?? throw new PlatformNotSupportedException();
|
||||
|
||||
readonly static SerializableProperty<bool>? _SteamAccountRemarkReplaceName = IsDesktopPlatform ? GetProperty(defaultValue: false, autoSave: true) : null;
|
||||
readonly static SerializableProperty<bool>? _SteamAccountRemarkReplaceName = IApplication.IsDesktopPlatform ? GetProperty(defaultValue: false, autoSave: true) : null;
|
||||
/// <summary>
|
||||
/// Steam账号备注替换名称显示
|
||||
/// </summary>
|
||||
@@ -71,7 +71,7 @@ namespace System.Application.Settings
|
||||
[SupportedOSPlatform("Linux")]
|
||||
public static SerializableProperty<bool> SteamAccountRemarkReplaceName => _SteamAccountRemarkReplaceName ?? throw new PlatformNotSupportedException();
|
||||
|
||||
readonly static SerializableProperty<bool>? _EnableFilletUI = IsDesktopPlatform ? GetProperty(defaultValue: false, autoSave: true) : null;
|
||||
readonly static SerializableProperty<bool>? _EnableFilletUI = IApplication.IsDesktopPlatform ? GetProperty(defaultValue: false, autoSave: true) : null;
|
||||
/// <summary>
|
||||
/// 启用圆角界面
|
||||
/// </summary>
|
||||
@@ -80,7 +80,7 @@ namespace System.Application.Settings
|
||||
[SupportedOSPlatform("Linux")]
|
||||
public static SerializableProperty<bool> EnableFilletUI => _EnableFilletUI ?? throw new PlatformNotSupportedException();
|
||||
|
||||
readonly static SerializableProperty<bool>? _EnableDesktopBackground = IsDesktopPlatform ? GetProperty(defaultValue: false, autoSave: true) : null;
|
||||
readonly static SerializableProperty<bool>? _EnableDesktopBackground = IApplication.IsDesktopPlatform ? GetProperty(defaultValue: false, autoSave: true) : null;
|
||||
/// <summary>
|
||||
/// 启用动态桌面背景
|
||||
/// </summary>
|
||||
@@ -90,7 +90,7 @@ namespace System.Application.Settings
|
||||
public static SerializableProperty<bool> EnableDesktopBackground => _EnableDesktopBackground ?? throw new PlatformNotSupportedException();
|
||||
|
||||
readonly static SerializableProperty<bool>? _EnableCustomBackgroundImage
|
||||
= IsDesktopPlatform ? GetProperty(defaultValue: false, autoSave: true) : null;
|
||||
= IApplication.IsDesktopPlatform ? GetProperty(defaultValue: false, autoSave: true) : null;
|
||||
/// <summary>
|
||||
/// 启用自定义背景图片
|
||||
/// </summary>
|
||||
@@ -99,7 +99,7 @@ namespace System.Application.Settings
|
||||
[SupportedOSPlatform("Linux")]
|
||||
public static SerializableProperty<bool> EnableCustomBackgroundImage => _EnableCustomBackgroundImage ?? throw new PlatformNotSupportedException();
|
||||
|
||||
readonly static SerializableProperty<string>? _BackgroundImagePath = IsDesktopPlatform ? GetProperty(defaultValue: "avares://System.Application.SteamTools.Client.Avalonia/Application/UI/Assets/AppResources/Placeholders/0.png", autoSave: true) : null;
|
||||
readonly static SerializableProperty<string>? _BackgroundImagePath = IApplication.IsDesktopPlatform ? GetProperty(defaultValue: "avares://System.Application.SteamTools.Client.Avalonia/Application/UI/Assets/AppResources/Placeholders/0.png", autoSave: true) : null;
|
||||
/// <summary>
|
||||
/// 背景图片路径
|
||||
/// </summary>
|
||||
@@ -108,7 +108,7 @@ namespace System.Application.Settings
|
||||
[SupportedOSPlatform("Linux")]
|
||||
public static SerializableProperty<string> BackgroundImagePath => _BackgroundImagePath ?? throw new PlatformNotSupportedException();
|
||||
|
||||
readonly static SerializableProperty<string>? _ThemeAccent = IsDesktopPlatform ? GetProperty(defaultValue: "#FF0078D7", autoSave: true) : null;
|
||||
readonly static SerializableProperty<string>? _ThemeAccent = IApplication.IsDesktopPlatform ? GetProperty(defaultValue: "#FF0078D7", autoSave: true) : null;
|
||||
/// <summary>
|
||||
/// 主题颜色(十六进制字符串)
|
||||
/// </summary>
|
||||
@@ -117,7 +117,7 @@ namespace System.Application.Settings
|
||||
[SupportedOSPlatform("Linux")]
|
||||
public static SerializableProperty<string> ThemeAccent => _ThemeAccent ?? throw new PlatformNotSupportedException();
|
||||
|
||||
readonly static SerializableProperty<bool>? _GetUserThemeAccent = IsDesktopPlatform ? GetProperty(defaultValue: true, autoSave: true) : null;
|
||||
readonly static SerializableProperty<bool>? _GetUserThemeAccent = IApplication.IsDesktopPlatform ? GetProperty(defaultValue: true, autoSave: true) : null;
|
||||
/// <summary>
|
||||
/// 主题颜色从系统获取
|
||||
/// </summary>
|
||||
@@ -126,7 +126,7 @@ namespace System.Application.Settings
|
||||
[SupportedOSPlatform("Linux")]
|
||||
public static SerializableProperty<bool> GetUserThemeAccent => _GetUserThemeAccent ?? throw new PlatformNotSupportedException();
|
||||
|
||||
readonly static SerializableProperty<bool>? _MainMenuExpandedState = IsDesktopPlatform ? GetProperty(defaultValue: false, autoSave: true) : null;
|
||||
readonly static SerializableProperty<bool>? _MainMenuExpandedState = IApplication.IsDesktopPlatform ? GetProperty(defaultValue: false, autoSave: true) : null;
|
||||
/// <summary>
|
||||
/// 主菜单展开状态
|
||||
/// </summary>
|
||||
|
||||
@@ -12,6 +12,11 @@ namespace System.Application.UI
|
||||
/// </summary>
|
||||
public partial interface IApplication
|
||||
{
|
||||
/// <summary>
|
||||
/// IsWindows or IsMacOS or (IsLinux and !IsAndroid)
|
||||
/// </summary>
|
||||
public static readonly bool IsDesktopPlatform = OperatingSystem2.IsWindows || OperatingSystem2.IsMacOS || (OperatingSystem2.IsLinux && !OperatingSystem2.IsAndroid);
|
||||
|
||||
static IApplication Instance => DI.Get<IApplication>();
|
||||
|
||||
/// <summary>
|
||||
|
||||
@@ -19,11 +19,13 @@ namespace System.Application.UI.ViewModels
|
||||
/// <summary>
|
||||
/// 是否在设计器的上下文中运行
|
||||
/// </summary>
|
||||
public static bool IsInDesignMode { protected get; set; } = true;
|
||||
public static bool IsInDesignMode { protected get; set; }
|
||||
= IApplication.IsDesktopPlatform;
|
||||
|
||||
/// <summary>
|
||||
/// 是否使用移动端布局
|
||||
/// </summary>
|
||||
public static bool IsMobileLayout { protected get; set; }
|
||||
= !IApplication.IsDesktopPlatform;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -10,6 +10,7 @@ namespace System.Application.UI.ViewModels
|
||||
/// <summary>
|
||||
/// 是否支持窗口大小与位置
|
||||
/// </summary>
|
||||
public static bool IsSupportedSizePosition { protected get; set; } = true;
|
||||
public static bool IsSupportedSizePosition { protected get; set; }
|
||||
= IApplication.IsDesktopPlatform;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user