From c07c7ad82fd5bc4e3d21f66b5a9f7c8dddb8ca94 Mon Sep 17 00:00:00 2001 From: 2dust <31833384+2dust@users.noreply.github.com> Date: Mon, 6 May 2024 17:19:29 +0800 Subject: [PATCH] Added reminder that a reboot is required to modify settings --- v2rayN/v2rayN/Resx/ResUI.Designer.cs | 9 ++++++ v2rayN/v2rayN/Resx/ResUI.resx | 3 ++ v2rayN/v2rayN/Resx/ResUI.zh-Hans.resx | 3 ++ v2rayN/v2rayN/Resx/ResUI.zh-Hant.resx | 3 ++ .../ViewModels/OptionSettingViewModel.cs | 31 +++++++++++++------ .../v2rayN/Views/OptionSettingWindow.xaml.cs | 6 ++-- 6 files changed, 42 insertions(+), 13 deletions(-) diff --git a/v2rayN/v2rayN/Resx/ResUI.Designer.cs b/v2rayN/v2rayN/Resx/ResUI.Designer.cs index 4a78a856..5fe8cabb 100644 --- a/v2rayN/v2rayN/Resx/ResUI.Designer.cs +++ b/v2rayN/v2rayN/Resx/ResUI.Designer.cs @@ -1581,6 +1581,15 @@ namespace v2rayN.Resx { } } + /// + /// 查找类似 Successful operation. Click the settings menu to reboot the app. 的本地化字符串。 + /// + public static string NeedRebootTips { + get { + return ResourceManager.GetString("NeedRebootTips", resourceCulture); + } + } + /// /// 查找类似 Non-VMess or ss protocol 的本地化字符串。 /// diff --git a/v2rayN/v2rayN/Resx/ResUI.resx b/v2rayN/v2rayN/Resx/ResUI.resx index feb6e20b..edff8e36 100644 --- a/v2rayN/v2rayN/Resx/ResUI.resx +++ b/v2rayN/v2rayN/Resx/ResUI.resx @@ -1213,4 +1213,7 @@ Custom the rule-set of sing-box + + Successful operation. Click the settings menu to reboot the app. + \ No newline at end of file diff --git a/v2rayN/v2rayN/Resx/ResUI.zh-Hans.resx b/v2rayN/v2rayN/Resx/ResUI.zh-Hans.resx index 6e21268e..73390893 100644 --- a/v2rayN/v2rayN/Resx/ResUI.zh-Hans.resx +++ b/v2rayN/v2rayN/Resx/ResUI.zh-Hans.resx @@ -1210,4 +1210,7 @@ 自定义sing-box rule-set + + 操作成功。请点击设置菜单重启应用。 + \ No newline at end of file diff --git a/v2rayN/v2rayN/Resx/ResUI.zh-Hant.resx b/v2rayN/v2rayN/Resx/ResUI.zh-Hant.resx index 8c1247d1..295b4311 100644 --- a/v2rayN/v2rayN/Resx/ResUI.zh-Hant.resx +++ b/v2rayN/v2rayN/Resx/ResUI.zh-Hant.resx @@ -1183,4 +1183,7 @@ 自訂sing-box rule-set + + 操作成功。 請點選設定選單重啟應用程式。 + \ No newline at end of file diff --git a/v2rayN/v2rayN/ViewModels/OptionSettingViewModel.cs b/v2rayN/v2rayN/ViewModels/OptionSettingViewModel.cs index 564d7518..484338e2 100644 --- a/v2rayN/v2rayN/ViewModels/OptionSettingViewModel.cs +++ b/v2rayN/v2rayN/ViewModels/OptionSettingViewModel.cs @@ -64,9 +64,9 @@ namespace v2rayN.ViewModels [Reactive] public bool EnableCheckPreReleaseUpdate { get; set; } [Reactive] public bool EnableDragDropSort { get; set; } [Reactive] public bool DoubleClick2Activate { get; set; } - [Reactive] public int autoUpdateInterval { get; set; } - [Reactive] public int trayMenuServersLimit { get; set; } - [Reactive] public string currentFontFamily { get; set; } + [Reactive] public int AutoUpdateInterval { get; set; } + [Reactive] public int TrayMenuServersLimit { get; set; } + [Reactive] public string CurrentFontFamily { get; set; } [Reactive] public int SpeedTestTimeout { get; set; } [Reactive] public string SpeedTestUrl { get; set; } [Reactive] public string SpeedPingTestUrl { get; set; } @@ -161,9 +161,9 @@ namespace v2rayN.ViewModels EnableCheckPreReleaseUpdate = _config.guiItem.checkPreReleaseUpdate; EnableDragDropSort = _config.uiItem.enableDragDropSort; DoubleClick2Activate = _config.uiItem.doubleClick2Activate; - autoUpdateInterval = _config.guiItem.autoUpdateInterval; - trayMenuServersLimit = _config.guiItem.trayMenuServersLimit; - currentFontFamily = _config.uiItem.currentFontFamily; + AutoUpdateInterval = _config.guiItem.autoUpdateInterval; + TrayMenuServersLimit = _config.guiItem.trayMenuServersLimit; + CurrentFontFamily = _config.uiItem.currentFontFamily; SpeedTestTimeout = _config.speedTestItem.speedTestTimeout; SpeedTestUrl = _config.speedTestItem.speedTestUrl; SpeedPingTestUrl = _config.speedTestItem.speedPingTestUrl; @@ -259,6 +259,10 @@ namespace v2rayN.ViewModels _noticeHandler?.Enqueue(ResUI.FillLocalListeningPort); return; } + var needReboot = (EnableStatistics != _config.guiItem.enableStatistics + || EnableDragDropSort != _config.uiItem.enableDragDropSort + || EnableHWA != _config.guiItem.enableHWA + || CurrentFontFamily != _config.uiItem.currentFontFamily); //if (Utile.IsNullOrEmpty(Kcpmtu.ToString()) || !Utile.IsNumeric(Kcpmtu.ToString()) // || Utile.IsNullOrEmpty(Kcptti.ToString()) || !Utile.IsNumeric(Kcptti.ToString()) @@ -315,12 +319,12 @@ namespace v2rayN.ViewModels _config.uiItem.enableUpdateSubOnlyRemarksExist = EnableUpdateSubOnlyRemarksExist; _config.guiItem.enableSecurityProtocolTls13 = EnableSecurityProtocolTls13; _config.uiItem.autoHideStartup = AutoHideStartup; - _config.guiItem.autoUpdateInterval = autoUpdateInterval; + _config.guiItem.autoUpdateInterval = AutoUpdateInterval; _config.guiItem.checkPreReleaseUpdate = EnableCheckPreReleaseUpdate; _config.uiItem.enableDragDropSort = EnableDragDropSort; _config.uiItem.doubleClick2Activate = DoubleClick2Activate; - _config.guiItem.trayMenuServersLimit = trayMenuServersLimit; - _config.uiItem.currentFontFamily = currentFontFamily; + _config.guiItem.trayMenuServersLimit = TrayMenuServersLimit; + _config.uiItem.currentFontFamily = CurrentFontFamily; _config.speedTestItem.speedTestTimeout = SpeedTestTimeout; _config.speedTestItem.speedTestUrl = SpeedTestUrl; _config.speedTestItem.speedPingTestUrl = SpeedPingTestUrl; @@ -343,7 +347,14 @@ namespace v2rayN.ViewModels if (ConfigHandler.SaveConfig(_config) == 0) { - _noticeHandler?.Enqueue(ResUI.OperationSuccess); + if (needReboot) + { + _noticeHandler?.Enqueue(ResUI.NeedRebootTips); + } + else + { + _noticeHandler?.Enqueue(ResUI.OperationSuccess); + } _view.DialogResult = true; } else diff --git a/v2rayN/v2rayN/Views/OptionSettingWindow.xaml.cs b/v2rayN/v2rayN/Views/OptionSettingWindow.xaml.cs index 1c37ce9f..14b104e7 100644 --- a/v2rayN/v2rayN/Views/OptionSettingWindow.xaml.cs +++ b/v2rayN/v2rayN/Views/OptionSettingWindow.xaml.cs @@ -178,9 +178,9 @@ namespace v2rayN.Views this.Bind(ViewModel, vm => vm.EnableCheckPreReleaseUpdate, v => v.togEnableCheckPreReleaseUpdate.IsChecked).DisposeWith(disposables); this.Bind(ViewModel, vm => vm.EnableDragDropSort, v => v.togEnableDragDropSort.IsChecked).DisposeWith(disposables); this.Bind(ViewModel, vm => vm.DoubleClick2Activate, v => v.togDoubleClick2Activate.IsChecked).DisposeWith(disposables); - this.Bind(ViewModel, vm => vm.autoUpdateInterval, v => v.txtautoUpdateInterval.Text).DisposeWith(disposables); - this.Bind(ViewModel, vm => vm.trayMenuServersLimit, v => v.txttrayMenuServersLimit.Text).DisposeWith(disposables); - this.Bind(ViewModel, vm => vm.currentFontFamily, v => v.cmbcurrentFontFamily.Text).DisposeWith(disposables); + this.Bind(ViewModel, vm => vm.AutoUpdateInterval, v => v.txtautoUpdateInterval.Text).DisposeWith(disposables); + this.Bind(ViewModel, vm => vm.TrayMenuServersLimit, v => v.txttrayMenuServersLimit.Text).DisposeWith(disposables); + this.Bind(ViewModel, vm => vm.CurrentFontFamily, v => v.cmbcurrentFontFamily.Text).DisposeWith(disposables); this.Bind(ViewModel, vm => vm.SpeedTestTimeout, v => v.cmbSpeedTestTimeout.Text).DisposeWith(disposables); this.Bind(ViewModel, vm => vm.SpeedTestUrl, v => v.cmbSpeedTestUrl.Text).DisposeWith(disposables); this.Bind(ViewModel, vm => vm.SpeedPingTestUrl, v => v.cmbSpeedPingTestUrl.Text).DisposeWith(disposables);