diff --git a/v2rayN/ServiceLib/Enums/ETheme.cs b/v2rayN/ServiceLib/Enums/ETheme.cs
new file mode 100644
index 00000000..7701ae8f
--- /dev/null
+++ b/v2rayN/ServiceLib/Enums/ETheme.cs
@@ -0,0 +1,13 @@
+namespace ServiceLib.Enums
+{
+ public enum ETheme
+ {
+ FollowSystem,
+ Dark,
+ Light,
+ Aquatic,
+ Desert,
+ Dusk,
+ NightSky
+ }
+}
\ No newline at end of file
diff --git a/v2rayN/ServiceLib/Models/ConfigItems.cs b/v2rayN/ServiceLib/Models/ConfigItems.cs
index f7642df3..41d34606 100644
--- a/v2rayN/ServiceLib/Models/ConfigItems.cs
+++ b/v2rayN/ServiceLib/Models/ConfigItems.cs
@@ -105,6 +105,7 @@
public bool ColorModeDark { get; set; }
public bool FollowSystemTheme { get; set; }
public string? ColorPrimaryName { get; set; }
+ public string? CurrentTheme { get; set; }
public string CurrentLanguage { get; set; }
public string CurrentFontFamily { get; set; }
public int CurrentFontSize { get; set; }
diff --git a/v2rayN/ServiceLib/Resx/ResUI.Designer.cs b/v2rayN/ServiceLib/Resx/ResUI.Designer.cs
index abe53603..4cc375a8 100644
--- a/v2rayN/ServiceLib/Resx/ResUI.Designer.cs
+++ b/v2rayN/ServiceLib/Resx/ResUI.Designer.cs
@@ -3463,6 +3463,15 @@ namespace ServiceLib.Resx {
}
}
+ ///
+ /// 查找类似 Theme 的本地化字符串。
+ ///
+ public static string TbSettingsTheme {
+ get {
+ return ResourceManager.GetString("TbSettingsTheme", 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 5b2de6a0..8d9a69f4 100644
--- a/v2rayN/ServiceLib/Resx/ResUI.fa-Ir.resx
+++ b/v2rayN/ServiceLib/Resx/ResUI.fa-Ir.resx
@@ -1402,4 +1402,7 @@
socks:پورت محلی، socks2: پورت دوم محلی، socks3: پورت LAN
-
+
+ Theme
+
+
\ No newline at end of file
diff --git a/v2rayN/ServiceLib/Resx/ResUI.hu.resx b/v2rayN/ServiceLib/Resx/ResUI.hu.resx
index 053efb6a..a66ddedb 100644
--- a/v2rayN/ServiceLib/Resx/ResUI.hu.resx
+++ b/v2rayN/ServiceLib/Resx/ResUI.hu.resx
@@ -1402,4 +1402,7 @@
socks: local port, socks2: second local port, socks3: LAN port
+
+ Theme
+
\ No newline at end of file
diff --git a/v2rayN/ServiceLib/Resx/ResUI.resx b/v2rayN/ServiceLib/Resx/ResUI.resx
index 82b27147..1152a657 100644
--- a/v2rayN/ServiceLib/Resx/ResUI.resx
+++ b/v2rayN/ServiceLib/Resx/ResUI.resx
@@ -1402,4 +1402,7 @@
socks: local port, socks2: second local port, socks3: LAN port
+
+ Theme
+
\ No newline at end of file
diff --git a/v2rayN/ServiceLib/Resx/ResUI.ru.resx b/v2rayN/ServiceLib/Resx/ResUI.ru.resx
index 326bf5d3..325e431c 100644
--- a/v2rayN/ServiceLib/Resx/ResUI.ru.resx
+++ b/v2rayN/ServiceLib/Resx/ResUI.ru.resx
@@ -1402,4 +1402,7 @@
socks: local port, socks2: second local port, socks3: LAN port
+
+ Theme
+
\ 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 6807b6de..45dfaca1 100644
--- a/v2rayN/ServiceLib/Resx/ResUI.zh-Hans.resx
+++ b/v2rayN/ServiceLib/Resx/ResUI.zh-Hans.resx
@@ -1399,4 +1399,7 @@
socks:本地端口,socks2:第二个本地端口,socks3:局域网端口
+
+ 主题
+
\ No newline at end of file
diff --git a/v2rayN/ServiceLib/Resx/ResUI.zh-Hant.resx b/v2rayN/ServiceLib/Resx/ResUI.zh-Hant.resx
index 27d7207b..ff22b92d 100644
--- a/v2rayN/ServiceLib/Resx/ResUI.zh-Hant.resx
+++ b/v2rayN/ServiceLib/Resx/ResUI.zh-Hant.resx
@@ -1400,4 +1400,7 @@
socks:本地端口,socks2:第二個本地端口,socks3:區域網路端口
+
+ 主題
+
\ No newline at end of file
diff --git a/v2rayN/ServiceLib/Services/CoreConfig/CoreConfigSingboxService.cs b/v2rayN/ServiceLib/Services/CoreConfig/CoreConfigSingboxService.cs
index e4268916..26708d79 100644
--- a/v2rayN/ServiceLib/Services/CoreConfig/CoreConfigSingboxService.cs
+++ b/v2rayN/ServiceLib/Services/CoreConfig/CoreConfigSingboxService.cs
@@ -1259,7 +1259,8 @@ namespace ServiceLib.Services.CoreConfig
singboxConfig.experimental ??= new Experimental4Sbox();
singboxConfig.experimental.cache_file = new CacheFile4Sbox()
{
- enabled = true
+ enabled = true,
+ path = Utils.GetConfigPath("cache.db")
};
}
diff --git a/v2rayN/v2rayN.Desktop/ViewModels/ThemeSettingViewModel.cs b/v2rayN/v2rayN.Desktop/ViewModels/ThemeSettingViewModel.cs
index d0854a2f..afdf78c2 100644
--- a/v2rayN/v2rayN.Desktop/ViewModels/ThemeSettingViewModel.cs
+++ b/v2rayN/v2rayN.Desktop/ViewModels/ThemeSettingViewModel.cs
@@ -6,14 +6,14 @@ using Avalonia.Media;
using Avalonia.Styling;
using ReactiveUI;
using ReactiveUI.Fody.Helpers;
+using Semi.Avalonia;
using System.Reactive.Linq;
namespace v2rayN.Desktop.ViewModels
{
public class ThemeSettingViewModel : MyReactiveObject
{
- [Reactive] public bool ColorModeDark { get; set; }
- [Reactive] public bool FollowSystemTheme { get; set; }
+ [Reactive] public string CurrentTheme { get; set; }
[Reactive] public int CurrentFontSize { get; set; }
@@ -36,28 +36,16 @@ namespace v2rayN.Desktop.ViewModels
private void BindingUI()
{
- ColorModeDark = _config.UiItem.ColorModeDark;
- FollowSystemTheme = _config.UiItem.FollowSystemTheme;
+ CurrentTheme = _config.UiItem.CurrentTheme;
CurrentFontSize = _config.UiItem.CurrentFontSize;
CurrentLanguage = _config.UiItem.CurrentLanguage;
- this.WhenAnyValue(x => x.ColorModeDark)
+ this.WhenAnyValue(x => x.CurrentTheme)
.Subscribe(c =>
{
- if (_config.UiItem.ColorModeDark != ColorModeDark)
+ if (_config.UiItem.CurrentTheme != CurrentTheme)
{
- _config.UiItem.ColorModeDark = ColorModeDark;
- ModifyTheme();
- ConfigHandler.SaveConfig(_config);
- }
- });
- this.WhenAnyValue(x => x.FollowSystemTheme,
- y => y == true)
- .Subscribe(c =>
- {
- if (_config.UiItem.FollowSystemTheme != FollowSystemTheme)
- {
- _config.UiItem.FollowSystemTheme = FollowSystemTheme;
+ _config.UiItem.CurrentTheme = CurrentTheme;
ModifyTheme();
ConfigHandler.SaveConfig(_config);
}
@@ -96,7 +84,16 @@ namespace v2rayN.Desktop.ViewModels
var app = Application.Current;
if (app is not null)
{
- app.RequestedThemeVariant = FollowSystemTheme ? ThemeVariant.Default : (ColorModeDark ? ThemeVariant.Dark : ThemeVariant.Light);
+ app.RequestedThemeVariant = CurrentTheme switch
+ {
+ nameof(ETheme.Dark) => ThemeVariant.Dark,
+ nameof(ETheme.Light) => ThemeVariant.Light,
+ nameof(ETheme.Aquatic) => SemiTheme.Aquatic,
+ nameof(ETheme.Desert) => SemiTheme.Desert,
+ nameof(ETheme.Dusk) => SemiTheme.Dusk,
+ nameof(ETheme.NightSky) => SemiTheme.NightSky,
+ _ => ThemeVariant.Default,
+ };
}
}
diff --git a/v2rayN/v2rayN.Desktop/Views/BackupAndRestoreView.axaml b/v2rayN/v2rayN.Desktop/Views/BackupAndRestoreView.axaml
index ecd12276..d61dae8a 100644
--- a/v2rayN/v2rayN.Desktop/Views/BackupAndRestoreView.axaml
+++ b/v2rayN/v2rayN.Desktop/Views/BackupAndRestoreView.axaml
@@ -5,11 +5,15 @@
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:resx="clr-namespace:ServiceLib.Resx;assembly=ServiceLib"
- xmlns:vms="clr-namespace:ServiceLib.ViewModels;assembly=ServiceLib"
d:DesignHeight="450"
d:DesignWidth="800"
- x:DataType="vms:BackupAndRestoreViewModel"
mc:Ignorable="d">
+
+
+
+
@@ -23,7 +27,7 @@
+ Theme="{DynamicResource CardBorder}">
-
+
+ Theme="{DynamicResource CardBorder}">
-
-
+
+
-
+
{
- private Window _window;
+ private Window? _window;
+
+ public BackupAndRestoreView()
+ {
+ InitializeComponent();
+ }
public BackupAndRestoreView(Window window)
{
diff --git a/v2rayN/v2rayN.Desktop/Views/CheckUpdateView.axaml b/v2rayN/v2rayN.Desktop/Views/CheckUpdateView.axaml
index f3c6c50e..407a7d9c 100644
--- a/v2rayN/v2rayN.Desktop/Views/CheckUpdateView.axaml
+++ b/v2rayN/v2rayN.Desktop/Views/CheckUpdateView.axaml
@@ -35,11 +35,16 @@
Content="{x:Static resx:ResUI.menuCheckUpdate}" />
-
+
+
+ ItemsSource="{Binding CheckUpdateModels}"
+ Theme="{StaticResource ButtonRadioGroupListBox}">
@@ -47,12 +52,7 @@
-
+
-
+
-
+
-
\ No newline at end of file
diff --git a/v2rayN/v2rayN.Desktop/Views/ClashProxiesView.axaml b/v2rayN/v2rayN.Desktop/Views/ClashProxiesView.axaml
index c260f4ce..98a1d3a6 100644
--- a/v2rayN/v2rayN.Desktop/Views/ClashProxiesView.axaml
+++ b/v2rayN/v2rayN.Desktop/Views/ClashProxiesView.axaml
@@ -95,7 +95,8 @@
+ ItemsSource="{Binding ProxyGroups}"
+ Theme="{StaticResource ButtonRadioGroupListBox}">
@@ -105,24 +106,25 @@
-
-
-
-
-
-
-
-
-
+
+
+
+
+
+
+
-
+
@@ -138,7 +140,7 @@
diff --git a/v2rayN/v2rayN.Desktop/Views/MainWindow.axaml b/v2rayN/v2rayN.Desktop/Views/MainWindow.axaml
index 35f558aa..05943ec0 100644
--- a/v2rayN/v2rayN.Desktop/Views/MainWindow.axaml
+++ b/v2rayN/v2rayN.Desktop/Views/MainWindow.axaml
@@ -150,71 +150,20 @@
x:Name="tabMain1"
Grid.Row="2"
TabStripPlacement="Left">
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
+
+
+
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
+
+
+
+
-
-
\ No newline at end of file
diff --git a/v2rayN/v2rayN.Desktop/Views/MsgView.axaml b/v2rayN/v2rayN.Desktop/Views/MsgView.axaml
index 99dd5121..041c992a 100644
--- a/v2rayN/v2rayN.Desktop/Views/MsgView.axaml
+++ b/v2rayN/v2rayN.Desktop/Views/MsgView.axaml
@@ -65,7 +65,7 @@
Margin="8,0"
HorizontalAlignment="Left"
IsChecked="True"
- Theme="{StaticResource SimpleToggleSwitch}" />
+ Theme="{DynamicResource SimpleToggleSwitch}" />
+ Theme="{DynamicResource SimpleToggleSwitch}" />
+ Theme="{DynamicResource TagLabel}" />
{
private static Config _config;
- private Window _window;
+ private Window? _window;
+
+ public ProfilesView()
+ {
+ InitializeComponent();
+ }
public ProfilesView(Window window)
{
diff --git a/v2rayN/v2rayN.Desktop/Views/QrcodeView.axaml b/v2rayN/v2rayN.Desktop/Views/QrcodeView.axaml
index 1a0e150f..d6a6f70f 100644
--- a/v2rayN/v2rayN.Desktop/Views/QrcodeView.axaml
+++ b/v2rayN/v2rayN.Desktop/Views/QrcodeView.axaml
@@ -4,12 +4,10 @@
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
- xmlns:resx="clr-namespace:ServiceLib.Resx;assembly=ServiceLib"
d:DesignHeight="480"
d:DesignWidth="400"
mc:Ignorable="d">
-
-
\ No newline at end of file
diff --git a/v2rayN/v2rayN.Desktop/Views/QrcodeView.axaml.cs b/v2rayN/v2rayN.Desktop/Views/QrcodeView.axaml.cs
index dc7273be..93c0aaec 100644
--- a/v2rayN/v2rayN.Desktop/Views/QrcodeView.axaml.cs
+++ b/v2rayN/v2rayN.Desktop/Views/QrcodeView.axaml.cs
@@ -5,6 +5,11 @@ namespace v2rayN.Desktop.Views
{
public partial class QrcodeView : UserControl
{
+ public QrcodeView()
+ {
+ InitializeComponent();
+ }
+
public QrcodeView(string? url)
{
InitializeComponent();
diff --git a/v2rayN/v2rayN.Desktop/Views/RoutingRuleDetailsWindow.axaml b/v2rayN/v2rayN.Desktop/Views/RoutingRuleDetailsWindow.axaml
index 62cdd0bf..fa515eb6 100644
--- a/v2rayN/v2rayN.Desktop/Views/RoutingRuleDetailsWindow.axaml
+++ b/v2rayN/v2rayN.Desktop/Views/RoutingRuleDetailsWindow.axaml
@@ -94,7 +94,7 @@
Grid.Column="1"
HorizontalAlignment="Left"
Classes="Margin8"
- SelectionMode="Multiple"
+ SelectionMode="Multiple,Toggle"
Theme="{DynamicResource CardCheckGroupListBox}" />
+ Orientation="Horizontal"
+ Spacing="4">
-
+
-
+
-
-
+
+
-
+
-
+
+ Theme="{DynamicResource SimpleToggleSwitch}" />
+
+
+
+
+
diff --git a/v2rayN/v2rayN.Desktop/Views/ThemeSettingView.axaml.cs b/v2rayN/v2rayN.Desktop/Views/ThemeSettingView.axaml.cs
index efdf1403..601b0958 100644
--- a/v2rayN/v2rayN.Desktop/Views/ThemeSettingView.axaml.cs
+++ b/v2rayN/v2rayN.Desktop/Views/ThemeSettingView.axaml.cs
@@ -16,6 +16,11 @@ namespace v2rayN.Desktop.Views
InitializeComponent();
ViewModel = new ThemeSettingViewModel();
+ foreach (ETheme it in Enum.GetValues(typeof(ETheme)))
+ {
+ cmbCurrentTheme.Items.Add(it.ToString());
+ }
+
for (int i = Global.MinFontSize; i <= Global.MinFontSize + 10; i++)
{
cmbCurrentFontSize.Items.Add(i);
@@ -28,8 +33,7 @@ namespace v2rayN.Desktop.Views
this.WhenActivated(disposables =>
{
- this.Bind(ViewModel, vm => vm.ColorModeDark, v => v.togDarkMode.IsChecked).DisposeWith(disposables);
- this.Bind(ViewModel, vm => vm.FollowSystemTheme, v => v.togFollowSystemTheme.IsChecked).DisposeWith(disposables);
+ this.Bind(ViewModel, vm => vm.CurrentTheme, v => v.cmbCurrentTheme.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);
});
diff --git a/v2rayN/v2rayN/Views/CheckUpdateView.xaml b/v2rayN/v2rayN/Views/CheckUpdateView.xaml
index 887a9644..b619f72b 100644
--- a/v2rayN/v2rayN/Views/CheckUpdateView.xaml
+++ b/v2rayN/v2rayN/Views/CheckUpdateView.xaml
@@ -64,7 +64,6 @@