From 7810e90ebbde945d7d079152c5c1bd78a749febb Mon Sep 17 00:00:00 2001 From: fonaix Date: Thu, 21 Nov 2024 21:05:35 +0800 Subject: [PATCH] =?UTF-8?q?=E6=B7=BB=E5=8A=A0=EF=BC=9A=E4=B8=BB=E9=A2=98?= =?UTF-8?q?=E6=A8=A1=E5=BC=8F=E8=87=AA=E5=8A=A8=E8=B7=9F=E9=9A=8F=E7=B3=BB?= =?UTF-8?q?=E7=BB=9F=E9=A2=9C=E8=89=B2?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- v2rayN/ServiceLib/Global.cs | 1 + v2rayN/ServiceLib/Models/ConfigItems.cs | 2 +- v2rayN/ServiceLib/Resx/ResUI.Designer.cs | 18 +- v2rayN/ServiceLib/Resx/ResUI.fa-Ir.resx | 442 +++++++++--------- v2rayN/ServiceLib/Resx/ResUI.resx | 6 +- v2rayN/ServiceLib/Resx/ResUI.ru.resx | 436 ++++++++--------- v2rayN/ServiceLib/Resx/ResUI.zh-Hans.resx | 38 +- v2rayN/ServiceLib/Resx/ResUI.zh-Hant.resx | 279 ++++++----- .../ViewModels/ThemeSettingViewModel.cs | 25 +- .../Views/ThemeSettingView.axaml | 51 +- .../Views/ThemeSettingView.axaml.cs | 7 +- 11 files changed, 659 insertions(+), 646 deletions(-) diff --git a/v2rayN/ServiceLib/Global.cs b/v2rayN/ServiceLib/Global.cs index cb2382d4..6044646a 100644 --- a/v2rayN/ServiceLib/Global.cs +++ b/v2rayN/ServiceLib/Global.cs @@ -196,6 +196,7 @@ public static readonly List DomainDNSAddress = ["223.5.5.5", "223.6.6.6", "localhost"]; public static readonly List SingboxDomainDNSAddress = ["223.5.5.5", "223.6.6.6", "dhcp://auto"]; public static readonly List Languages = new() { "zh-Hans", "zh-Hant", "en", "fa-Ir", "ru" }; + public static readonly List ThemeModes = new() { "system", "dark", "light" }; public static readonly List Alpns = new() { "h3", "h2", "http/1.1", "h3,h2", "h2,http/1.1", "h3,h2,http/1.1", "" }; public static readonly List LogLevels = new() { "debug", "info", "warning", "error", "none" }; public static readonly List InboundTags = new() { "socks", "http", "socks2", "http2" }; diff --git a/v2rayN/ServiceLib/Models/ConfigItems.cs b/v2rayN/ServiceLib/Models/ConfigItems.cs index 75943e2a..b5594ecc 100644 --- a/v2rayN/ServiceLib/Models/ConfigItems.cs +++ b/v2rayN/ServiceLib/Models/ConfigItems.cs @@ -107,7 +107,7 @@ public double MainGirdHeight1 { get; set; } public double MainGirdHeight2 { get; set; } public EGirdOrientation MainGirdOrientation { get; set; } = EGirdOrientation.Vertical; - public bool ColorModeDark { get; set; } + public string ThemeMode { get; set; } public bool FollowSystemTheme { get; set; } public string? ColorPrimaryName { get; set; } public string CurrentLanguage { get; set; } diff --git a/v2rayN/ServiceLib/Resx/ResUI.Designer.cs b/v2rayN/ServiceLib/Resx/ResUI.Designer.cs index 86355997..1025defd 100644 --- a/v2rayN/ServiceLib/Resx/ResUI.Designer.cs +++ b/v2rayN/ServiceLib/Resx/ResUI.Designer.cs @@ -2797,15 +2797,6 @@ namespace ServiceLib.Resx { } } - /// - /// 查找类似 Dark Mode 的本地化字符串。 - /// - public static string TbSettingsColorMode { - get { - return ResourceManager.GetString("TbSettingsColorMode", resourceCulture); - } - } - /// /// 查找类似 Core: basic settings 的本地化字符串。 /// @@ -3409,6 +3400,15 @@ namespace ServiceLib.Resx { } } + /// + /// 查找类似 Theme mode 的本地化字符串。 + /// + public static string TbSettingsThemeMode { + get { + return ResourceManager.GetString("TbSettingsThemeMode", resourceCulture); + } + } + /// /// 查找类似 Enable Security Protocol TLS v1.3 (subscription/update) 的本地化字符串。 /// diff --git a/v2rayN/ServiceLib/Resx/ResUI.fa-Ir.resx b/v2rayN/ServiceLib/Resx/ResUI.fa-Ir.resx index 3b90ede6..1f03825a 100644 --- a/v2rayN/ServiceLib/Resx/ResUI.fa-Ir.resx +++ b/v2rayN/ServiceLib/Resx/ResUI.fa-Ir.resx @@ -481,8 +481,8 @@ رنگ - - حالت تاریک + + Follow System Theme زبان @@ -952,21 +952,219 @@ تنظیمات TunMode + + Move to group + + + Enable Server Drag Drop Sort(Require restart) + + + AutoRefresh + + + Skip test + + + Edit Server (Ctrl+D) + + + Double-click server make active + + + Test completed + + + Default TLS fingerprint + User-Agent This parameter is valid only for tcp/http and ws + + FontFamily(Require restart) + + + Copy the font TTF/TTC file to the directory guiFonts, restart the settings + + + http port = +1; Pac port = +4; *ray API port = +5; mihomo API port = +6; + + + Set this with admin privileges, get admin privileges after startup + + + Font Size + + + SpeedTest Single Timeout Value + + + SpeedTest URL + + + Move up and down + + + PublicKey + + + ShortId + + + SpiderX + فعال‌سازی شتاب‌دهنده سخت‌افزاری (نیاز به راه‌اندازی مجدد) + + Waiting for testing (press ESC to terminate)... + + + Please turn off when there is an abnormal disconnection + + + Updates are not enabled, skip this subscription + + + Restart as Administrator + + + More URLs, separated by commas; Subscription conversion will be invalid + + + {0} : {1}/s↑ | {2}/s↓ + + + Automatic update interval (minutes) + + + Enable logging to file + + + Convert target type + + + Please leave blank if no conversion is required + + + DNS Settings + + + sing-box DNS settings + + + Please fill in DNS Structure, Click to view the document + + + Click to import default DNS config + + + sing-box domain strategy + + + sing-box Mux Protocol + + + Full process name (Tun mode) + + + IP or IP CIDR + + + Domain + + + Add [Hysteria2] server + + + Hysteria Max bandwidth (Up/Dw) + + + Use System Hosts + + + Add [TUIC] server + + + Congestion control + + + Previous proxy remarks + + + Next proxy remarks + + + Please make sure the remarks exists and is unique + + + Enable additional Inbound + + + Enable IPv6 Address + + + Add [WireGuard] server + + + PrivateKey + + + Reserved(2,3,4) + + + Address(Ip,Ipv6) + + + obfs password + + + (Domain or IP or ProcName) and Port and Protocol and InboundTag => OutboundTag + + + Auto ScrollToEnd + + + Speed Ping Test URL + + + Updating subscription, only determine remarks exists + + + Test terminating... + + + *grpc Authority + + + Add [HTTP] server + + + Use Xray and enable non-Tun mode, which conflicts with the group previous proxy + + + Enable fragment + فعال کردن کش فایل مجموعه قوانین برای sing-box + + Custom the rule-set of sing-box + + + Successful operation. Click the settings menu to reboot the app. + + + Open the storage location + مرتب سازی + + Chain + Default @@ -979,12 +1177,21 @@ ترافیک دانلود + + Host + نام + + Network + زمان + + Type + سرعت اپلود @@ -1024,15 +1231,12 @@ Part Node Latency Test + + Refresh Proxies + Select active node (Enter) - - Backup to remote (WebDAV) - - - Restore from remote (WebDAV) - Default domain strategy for outbound @@ -1075,6 +1279,12 @@ Restore from local + + Backup to remote (WebDAV) + + + Restore from remote (WebDAV) + Local @@ -1150,219 +1360,6 @@ Remarks Memo - - Enable logging to file - - - Updates are not enabled, skip this subscription - - - Restart as Administrator - - - More URLs, separated by commas; Subscription conversion will be invalid - - - {0} : {1}/s↑ | {2}/s↓ - - - Automatic update interval (minutes) - - - Convert target type - - - Please leave blank if no conversion is required - - - Please turn off when there is an abnormal disconnection - - - DNS Settings - - - Please fill in DNS Structure, Click to view the document - - - Click to import default DNS config - - - sing-box domain strategy - - - sing-box Mux Protocol - - - Full process name (Tun mode) - - - IP or IP CIDR - - - Domain - - - sing-box DNS settings - - - Waiting for testing (press ESC to terminate)... - - - SpiderX - - - ShortId - - - Move to group - - - Enable Server Drag Drop Sort(Require restart) - - - AutoRefresh - - - Skip test - - - Edit Server (Ctrl+D) - - - Double-click server make active - - - Test completed - - - Default TLS fingerprint - - - FontFamily(Require restart) - - - Copy the font TTF/TTC file to the directory guiFonts, restart the settings - - - http port = +1; Pac port = +4; *ray API port = +5; mihomo API port = +6; - - - Set this with admin privileges, get admin privileges after startup - - - Font Size - - - SpeedTest Single Timeout Value - - - SpeedTest URL - - - Move up and down - - - PublicKey - - - Add [Hysteria2] server - - - Hysteria Max bandwidth (Up/Dw) - - - Follow System Theme - - - Add [TUIC] server - - - Updating subscription, only determine remarks exists - - - Refresh Proxies - - - Network - - - Type - - - *grpc Authority - - - Add [HTTP] server - - - Speed Ping Test URL - - - Use Xray and enable non-Tun mode, which conflicts with the group previous proxy - - - Custom the rule-set of sing-box - - - Successful operation. Click the settings menu to reboot the app. - - - Open the storage location - - - Chain - - - Host - - - Use System Hosts - - - Enable fragment - - - Auto ScrollToEnd - - - Test terminating... - - - Next proxy remarks - - - obfs password - - - Congestion control - - - Previous proxy remarks - - - Address(Ip,Ipv6) - - - Reserved(2,3,4) - - - PrivateKey - - - Add [WireGuard] server - - - Enable IPv6 Address - - - Enable additional Inbound - - - Please make sure the remarks exists and is unique - - - (Domain or IP or ProcName) and Port and Protocol and InboundTag => OutboundTag - Linux system sudo password @@ -1384,4 +1381,7 @@ Hide to tray when closing the window + + Theme mode + \ No newline at end of file diff --git a/v2rayN/ServiceLib/Resx/ResUI.resx b/v2rayN/ServiceLib/Resx/ResUI.resx index 50f47431..6288c055 100644 --- a/v2rayN/ServiceLib/Resx/ResUI.resx +++ b/v2rayN/ServiceLib/Resx/ResUI.resx @@ -481,9 +481,6 @@ Color - - Dark Mode - Follow System Theme @@ -1384,4 +1381,7 @@ Hide to tray when closing the window + + Theme mode + \ No newline at end of file diff --git a/v2rayN/ServiceLib/Resx/ResUI.ru.resx b/v2rayN/ServiceLib/Resx/ResUI.ru.resx index 77d2314b..eb7a0cf1 100644 --- a/v2rayN/ServiceLib/Resx/ResUI.ru.resx +++ b/v2rayN/ServiceLib/Resx/ResUI.ru.resx @@ -481,9 +481,6 @@ Цвет - - Тёмный режим - Следить за системной темой @@ -691,18 +688,12 @@ Интервал автоматического обновления Geo в часах - - Интервал автоматического обновления в минутах - Ядро: базовые настройки Настройки DNS V2ray - - Настройки DNS sing-box - Ядро: настройки KCP @@ -997,134 +988,146 @@ Скопируйте файл шрифта TTF/TTC в каталог guiFonts, перезапустите настройки + + http port = +1; Pac port = +4; *ray API port = +5; mihomo API port = +6; + Установите это с правами администратора Размер шрифта - - Включить аппаратное ускорение (требуется перезагрузка) - - - Перезагрузить как администратор - - - Настройки DNS - - - Включить логгирование в файл - Таймаут одиночного спидтеста URL спидтеста - - Источник geo файлов + + Move up and down - - Источник sing-box srs файлов + + PublicKey - - Источник правил маршрутизации + + ShortId - - Региональные пресеты + + SpiderX - - По умолчанию (Китай) + + Включить аппаратное ускорение (требуется перезагрузка) - - Россия + + Waiting for testing (press ESC to terminate)... - - Используйте Настройки -> Региональные пресеты вместо изменения этого поля + + Please turn off when there is an abnormal disconnection - - Remarks Memo + + Updates are not enabled, skip this subscription - - Speed Ping Test URL + + Перезагрузить как администратор - - Part Node Latency Test + + More URLs, separated by commas; Subscription conversion will be invalid - - Refresh Proxies + + {0} : {1}/s↑ | {2}/s↓ - - Auto ScrollToEnd + + Интервал автоматического обновления в минутах - - Select active node (Enter) + + Включить логгирование в файл - - (Domain or IP or ProcName) and Port and Protocol and InboundTag => OutboundTag + + Convert target type - - obfs password + + Please leave blank if no conversion is required - - Address(Ip,Ipv6) + + Настройки DNS - - Default domain strategy for outbound + + Настройки DNS sing-box - - Multi-Server lowest latency + + Please fill in DNS Structure, Click to view the document - - Main layout orientation(Require restart) + + Click to import default DNS config - - Multi-server load balancing + + sing-box domain strategy - - Latency Test + + sing-box Mux Protocol - - Reserved(2,3,4) + + Full process name (Tun mode) - - PrivateKey + + IP or IP CIDR - - Add [WireGuard] server + + Domain - - Auto column width adjustment + + Add [Hysteria2] server - - Export Base64-encoded Share Links to Clipboard + + Hysteria Max bandwidth (Up/Dw) - - Delay + + Use System Hosts - - Enable additional Inbound - - - Please make sure the remarks exists and is unique - - - Export selected server for complete configuration to clipboard - - - Next proxy remarks - - - Show or hide the main window - - - Previous proxy remarks + + Add [TUIC] server Congestion control - - Outbound DNS address + + Previous proxy remarks + + + Next proxy remarks + + + Please make sure the remarks exists and is unique + + + Enable additional Inbound + + + Enable IPv6 Address + + + Add [WireGuard] server + + + PrivateKey + + + Reserved(2,3,4) + + + Address(Ip,Ipv6) + + + obfs password + + + (Domain or IP or ProcName) and Port and Protocol and InboundTag => OutboundTag + + + Auto ScrollToEnd + + + Speed Ping Test URL Updating subscription, only determine remarks exists @@ -1135,23 +1138,41 @@ *grpc Authority - - Default + + Add [HTTP] server - - Chain + + Use Xray and enable non-Tun mode, which conflicts with the group previous proxy - - Sorting + + Enable fragment - - Open the storage location + + Enable cache file for sing-box (ruleset files) + + + Custom the rule-set of sing-box Successful operation. Click the settings menu to reboot the app. - - Custom the rule-set of sing-box + + Open the storage location + + + Sorting + + + Chain + + + Default + + + Delay + + + Download Speed Download Traffic @@ -1171,9 +1192,6 @@ Type - - Enable cache file for sing-box (ruleset files) - Upload Speed @@ -1204,164 +1222,143 @@ Do not change - - Enable fragment - - - Use Xray and enable non-Tun mode, which conflicts with the group previous proxy - Rule - - Add [HTTP] server + + Latency Test - - Add [TUIC] server + + Part Node Latency Test + + + Refresh Proxies + + + Select active node (Enter) + + + Default domain strategy for outbound + + + Multi-Server lowest latency + + + Main layout orientation(Require restart) + + + Multi-server load balancing + + + Outbound DNS address + + + Auto column width adjustment + + + Export Base64-encoded Share Links to Clipboard + + + Export selected server for complete configuration to clipboard + + + Show or hide the main window You are currently running a standalone package, please manually download the SelfContained.7z file to unzip and overwrite it! - - Enable IPv6 Address - Custom config socks port + + Backup and Restore + + + Backup to local + + + Restore from local + + + Backup to remote (WebDAV) + + + Restore from remote (WebDAV) + + + Local + + + Remote (WebDAV) + + + WebDav Url + + + WebDav User Name + + + WebDav Password + WebDav Check - - Domain - - - IP or IP CIDR - - - Full process name (Tun mode) - - - sing-box Mux Protocol + + Remote folder name (optional) Invalid backup file - - sing-box domain strategy - Host filter - - Click to import default DNS config - Active - - Please fill in DNS Structure, Click to view the document - - - Please leave blank if no conversion is required - - - Convert target type - Save Interface Layout - - {0} : {1}/s↑ | {2}/s↓ + + Источник geo файлов - - More URLs, separated by commas; Subscription conversion will be invalid - - - Updates are not enabled, skip this subscription + + Источник sing-box srs файлов UpgradeApp does not exist + + Источник правил маршрутизации + + + Региональные пресеты + + + По умолчанию (Китай) + + + Россия + + + Используйте Настройки -> Региональные пресеты вместо изменения этого поля + Scan QR code in the image - - Please turn off when there is an abnormal disconnection - - - Waiting for testing (press ESC to terminate)... - - - SpiderX - - - ShortId - Invalid address (Url) Please do not use the insecure HTTP protocol subscription address - - PublicKey - - - Move up and down - - - http port = +1; Pac port = +4; *ray API port = +5; mihomo API port = +6; - Install the font to the system and restart the settings - - Add [Hysteria2] server - - - WebDav Password - - - Remote folder name (optional) - - - Download Speed - - - Restore from remote (WebDAV) - - - Backup to remote (WebDAV) - - - WebDav User Name - - - Restore from local - - - Backup to local - - - Use System Hosts - - - Backup and Restore - - - Local - Are you sure to exit? - - Hysteria Max bandwidth (Up/Dw) - - - WebDav Url - - - Remote (WebDAV) + + Remarks Memo Linux system sudo password @@ -1384,4 +1381,7 @@ Hide to tray when closing the window + + Theme mode + \ No newline at end of file diff --git a/v2rayN/ServiceLib/Resx/ResUI.zh-Hans.resx b/v2rayN/ServiceLib/Resx/ResUI.zh-Hans.resx index e6c33ce8..a83dca76 100644 --- a/v2rayN/ServiceLib/Resx/ResUI.zh-Hans.resx +++ b/v2rayN/ServiceLib/Resx/ResUI.zh-Hans.resx @@ -481,8 +481,8 @@ 颜色 - - 暗黑模式 + + 主题模式 是否跟随系统主题 @@ -1069,12 +1069,12 @@ 进程名全称 (Tun模式) - - Domain - IP 或 IP CIDR + + Domain + 添加[Hysteria2]服务器 @@ -1141,12 +1141,12 @@ 添加[HTTP]服务器 - - 启用分片(Fragment) - 使用Xray且非Tun模式启用,和分组前置代理冲突 + + 启用分片(Fragment) + 启用sing-box(规则集文件)的缓存文件 @@ -1291,17 +1291,17 @@ 远程 (WebDAV) + + WebDav 服务器地址 + WebDav 账户 - - WebDav 可用检查 - WebDav 密码 - - WebDav 服务器地址 + + WebDav 可用检查 远程文件夹名称(可选) @@ -1321,18 +1321,15 @@ Geo文件来源(可选) - - 升级工具App不存在 - sing-box ruleset文件来源(可选) + + 升级工具App不存在 + 路由规则集来源(可选) - - 中国区域用户可忽略此项 - 区域预置设置 @@ -1342,6 +1339,9 @@ 俄罗斯 + + 中国区域用户可忽略此项 + 扫描图片中的二维码 diff --git a/v2rayN/ServiceLib/Resx/ResUI.zh-Hant.resx b/v2rayN/ServiceLib/Resx/ResUI.zh-Hant.resx index 05aaf56e..fcdb0fc4 100644 --- a/v2rayN/ServiceLib/Resx/ResUI.zh-Hant.resx +++ b/v2rayN/ServiceLib/Resx/ResUI.zh-Hant.resx @@ -480,8 +480,8 @@ 顏色 - - 暗黑模式 + + 主題模式 是否跟隨系統主題 @@ -672,7 +672,6 @@ * 自訂設定的Socks埠值,可不設定;當設定此值後,將使用Xray/sing-box(Tun)額外啟動一個前置Socks服務,提供分流和速度顯示等功能 - 瀏覽 @@ -1069,15 +1068,27 @@ 行程名全稱 (TUN模式) - - Domain - IP 或 IP CIDR + + Domain + + + 添加[Hysteria2]伺服器 + + + Hysteria 最大頻寬(Up/Dw) + + + 使用系統hosts + 新增[TUIC]伺服器 + + 擁塞控制算法 + 前置代理別名 @@ -1093,6 +1104,21 @@ 啟用IPv6 + + 添加[WireGuard]伺服器 + + + PrivateKey + + + Reserved(2,3,4) + + + Address(Ip,Ipv6) + + + 混淆密碼(obfs password) + (Domain 或 IP 或 行程名) 与 Port 与 Protocol 与 InboundTag => OutboundTag @@ -1114,12 +1140,12 @@ 新增[HTTP]伺服器 - - 啟用分片(Fragment) - 使用Xray且非Tun模式啟用,和分組前置代理衝突 + + 啟用分片(Fragment) + 啟用sing-box(規則集檔案)的快取檔案 @@ -1132,6 +1158,99 @@ 打開儲存所在的位置 + + 排序 + + + 路由鏈 + + + 預設 + + + 延遲 + + + 下載速度 + + + 下載流量 + + + 主機 + + + 名稱 + + + 網路 + + + 時間 + + + 類型 + + + 上傳速度 + + + 上傳流量 + + + 目前連線 + + + 關閉連線 + + + 關閉所有連線 + + + 目前代理 + + + 規則模式 + + + 直連 + + + 全局 + + + 随原配置 + + + 規則 + + + 延遲測試 + + + 目前部分節點延遲測試 + + + 重新整理 + + + 設為活動節點 (Enter) + + + Outbound預設解析策略 + + + 多伺服器最低延遲 (多選) + + + 主界面佈局方向(需重啟) + + + 多伺服器負載平衡 (多選) + + + Outbound域名解析位址 + 自動調整列寬 @@ -1171,17 +1290,17 @@ 遠端 (WebDAV) + + WebDav 伺服器位址 + WebDav 賬戶 - - WebDav 可用檢查 - WebDav 密碼 - - WebDav 伺服器位址 + + WebDav 可用檢查 遠端資料夾名稱(可選) @@ -1201,18 +1320,15 @@ Geo檔案來源(可選) - - 升級工具App不存在 - sing-box ruleset檔案來源(可選) + + 升級工具App不存在 + 路由規則集來源(可選) - - 中國區域用戶可忽略此項 - 區域預置設定 @@ -1222,6 +1338,9 @@ 俄羅斯 + + 中國區域用戶可忽略此項 + 掃描圖片中的二維碼 @@ -1240,126 +1359,6 @@ 備註備忘 - - 擁塞控制算法 - - - 設為活動節點 (Enter) - - - 重新整理 - - - 排序 - - - 延遲測試 - - - 規則 - - - 随原配置 - - - 全局 - - - 直連 - - - 規則模式 - - - 目前代理 - - - 關閉所有連線 - - - Outbound預設解析策略 - - - 關閉連線 - - - 上傳流量 - - - 上傳速度 - - - 類型 - - - 時間 - - - 網路 - - - 名稱 - - - 主機 - - - 下載流量 - - - 下載速度 - - - 延遲 - - - 預設 - - - 目前連線 - - - 多伺服器最低延遲 (多選) - - - 目前部分節點延遲測試 - - - 多伺服器負載平衡 (多選) - - - 添加[Hysteria2]伺服器 - - - Hysteria 最大頻寬(Up/Dw) - - - 主界面佈局方向(需重啟) - - - 添加[WireGuard]伺服器 - - - PrivateKey - - - Reserved(2,3,4) - - - Address(Ip,Ipv6) - - - 使用系統hosts - - - 路由鏈 - - - Outbound域名解析位址 - - - 混淆密碼(obfs password) - Linux系統的sudo密碼 diff --git a/v2rayN/v2rayN.Desktop/ViewModels/ThemeSettingViewModel.cs b/v2rayN/v2rayN.Desktop/ViewModels/ThemeSettingViewModel.cs index 6b22f580..e76bb1ac 100644 --- a/v2rayN/v2rayN.Desktop/ViewModels/ThemeSettingViewModel.cs +++ b/v2rayN/v2rayN.Desktop/ViewModels/ThemeSettingViewModel.cs @@ -12,7 +12,7 @@ namespace v2rayN.Desktop.ViewModels { public class ThemeSettingViewModel : MyReactiveObject { - [Reactive] public bool ColorModeDark { get; set; } + [Reactive] public string ThemeMode { get; set; } [Reactive] public int CurrentFontSize { get; set; } @@ -28,23 +28,23 @@ namespace v2rayN.Desktop.ViewModels private void RestoreUI() { - ModifyTheme(_config.UiItem.ColorModeDark); + ModifyTheme(_config.UiItem.ThemeMode); ModifyFontFamily(); } private void BindingUI() { - ColorModeDark = _config.UiItem.ColorModeDark; + ThemeMode = _config.UiItem.ThemeMode; CurrentFontSize = _config.UiItem.CurrentFontSize; CurrentLanguage = _config.UiItem.CurrentLanguage; - this.WhenAnyValue(x => x.ColorModeDark) + this.WhenAnyValue(x => x.ThemeMode) .Subscribe(c => { - if (_config.UiItem.ColorModeDark != ColorModeDark) + if (_config.UiItem.ThemeMode != ThemeMode) { - _config.UiItem.ColorModeDark = ColorModeDark; - ModifyTheme(ColorModeDark); + _config.UiItem.ThemeMode = ThemeMode; + ModifyTheme(ThemeMode); ConfigHandler.SaveConfig(_config); } }); @@ -79,12 +79,19 @@ namespace v2rayN.Desktop.ViewModels }); } - private void ModifyTheme(bool isDarkTheme) + private void ModifyTheme(string themeMode) { var app = Application.Current; if (app is not null) { - app.RequestedThemeVariant = isDarkTheme ? ThemeVariant.Dark : ThemeVariant.Light; + ThemeVariant tv = ThemeVariant.Default; + switch (themeMode) + { + case "dark": tv = ThemeVariant.Dark; break; + case "light": tv = ThemeVariant.Light; break; + default: tv = ThemeVariant.Default; break; + } + app.RequestedThemeVariant = tv; } } diff --git a/v2rayN/v2rayN.Desktop/Views/ThemeSettingView.axaml b/v2rayN/v2rayN.Desktop/Views/ThemeSettingView.axaml index f898a1df..01e492a6 100644 --- a/v2rayN/v2rayN.Desktop/Views/ThemeSettingView.axaml +++ b/v2rayN/v2rayN.Desktop/Views/ThemeSettingView.axaml @@ -10,54 +10,57 @@ d:DesignWidth="800" x:DataType="vms:ThemeSettingViewModel" mc:Ignorable="d"> - + + + + + \ No newline at end of file diff --git a/v2rayN/v2rayN.Desktop/Views/ThemeSettingView.axaml.cs b/v2rayN/v2rayN.Desktop/Views/ThemeSettingView.axaml.cs index 1c544aad..4cf089c8 100644 --- a/v2rayN/v2rayN.Desktop/Views/ThemeSettingView.axaml.cs +++ b/v2rayN/v2rayN.Desktop/Views/ThemeSettingView.axaml.cs @@ -25,10 +25,13 @@ namespace v2rayN.Desktop.Views { cmbCurrentLanguage.Items.Add(it); }); - + Global.ThemeModes.ForEach(it => + { + cmbThemeMode.Items.Add(it); + }); this.WhenActivated(disposables => { - this.Bind(ViewModel, vm => vm.ColorModeDark, v => v.togDarkMode.IsChecked).DisposeWith(disposables); + this.Bind(ViewModel, vm => vm.ThemeMode, v => v.cmbThemeMode.SelectedValue).DisposeWith(disposables); this.Bind(ViewModel, vm => vm.CurrentFontSize, v => v.cmbCurrentFontSize.SelectedValue).DisposeWith(disposables); this.Bind(ViewModel, vm => vm.CurrentLanguage, v => v.cmbCurrentLanguage.SelectedValue).DisposeWith(disposables); });