diff --git a/v2rayN/v2rayN/Mode/ConfigItems.cs b/v2rayN/v2rayN/Mode/ConfigItems.cs index 62b53974..2f60f0f5 100644 --- a/v2rayN/v2rayN/Mode/ConfigItems.cs +++ b/v2rayN/v2rayN/Mode/ConfigItems.cs @@ -60,6 +60,7 @@ namespace v2rayN.Mode public bool colorModeDark { get; set; } public string? colorPrimaryName { get; set; } public string currentLanguage { get; set; } + public bool enableDragDropSort { get; set; } public Dictionary mainLvColWidth { get; set; } } diff --git a/v2rayN/v2rayN/Resx/ResUI.Designer.cs b/v2rayN/v2rayN/Resx/ResUI.Designer.cs index d0c00c01..6ca2a570 100644 --- a/v2rayN/v2rayN/Resx/ResUI.Designer.cs +++ b/v2rayN/v2rayN/Resx/ResUI.Designer.cs @@ -2392,6 +2392,15 @@ namespace v2rayN.Resx { } } + /// + /// 查找类似 Enable Server Drag Drop Sort(Require restart) 的本地化字符串。 + /// + public static string TbSettingsEnableDragDropSort { + get { + return ResourceManager.GetString("TbSettingsEnableDragDropSort", resourceCulture); + } + } + /// /// 查找类似 Exception 的本地化字符串。 /// diff --git a/v2rayN/v2rayN/Resx/ResUI.resx b/v2rayN/v2rayN/Resx/ResUI.resx index 2df7f7c8..e8a843f3 100644 --- a/v2rayN/v2rayN/Resx/ResUI.resx +++ b/v2rayN/v2rayN/Resx/ResUI.resx @@ -1066,4 +1066,7 @@ Custom Template + + Enable Server Drag Drop Sort(Require restart) + \ 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 fa1ae295..55f45563 100644 --- a/v2rayN/v2rayN/Resx/ResUI.zh-Hans.resx +++ b/v2rayN/v2rayN/Resx/ResUI.zh-Hans.resx @@ -851,7 +851,7 @@ 开机启动(可能会不成功) - 启用统计(实时网速显示,需要重启) + 启用统计(实时网速显示,需重启) 统计刷新频率(单位秒) @@ -1066,4 +1066,7 @@ 自定义配置模板 + + 启用服务器拖放排序(需重启) + \ No newline at end of file diff --git a/v2rayN/v2rayN/ViewModels/OptionSettingViewModel.cs b/v2rayN/v2rayN/ViewModels/OptionSettingViewModel.cs index c1a4968b..062ce32e 100644 --- a/v2rayN/v2rayN/ViewModels/OptionSettingViewModel.cs +++ b/v2rayN/v2rayN/ViewModels/OptionSettingViewModel.cs @@ -55,6 +55,7 @@ namespace v2rayN.ViewModels [Reactive] public bool EnableSecurityProtocolTls13 { get; set; } [Reactive] public bool AutoHideStartup { get; set; } [Reactive] public bool EnableCheckPreReleaseUpdate { get; set; } + [Reactive] public bool EnableDragDropSort { get; set; } [Reactive] public int autoUpdateInterval { get; set; } [Reactive] public int autoUpdateSubInterval { get; set; } [Reactive] public int trayMenuServersLimit { get; set; } @@ -135,6 +136,7 @@ namespace v2rayN.ViewModels EnableSecurityProtocolTls13 = _config.enableSecurityProtocolTls13; AutoHideStartup = _config.autoHideStartup; EnableCheckPreReleaseUpdate = _config.checkPreReleaseUpdate; + EnableDragDropSort = _config.uiItem.enableDragDropSort; autoUpdateInterval = _config.autoUpdateInterval; autoUpdateSubInterval = _config.autoUpdateSubInterval; trayMenuServersLimit = _config.trayMenuServersLimit; @@ -299,6 +301,7 @@ namespace v2rayN.ViewModels _config.autoUpdateInterval = autoUpdateInterval; _config.autoUpdateSubInterval = autoUpdateSubInterval; _config.checkPreReleaseUpdate = EnableCheckPreReleaseUpdate; + _config.uiItem.enableDragDropSort = EnableDragDropSort; _config.trayMenuServersLimit = trayMenuServersLimit; //systemProxy diff --git a/v2rayN/v2rayN/Views/MainWindow.xaml b/v2rayN/v2rayN/Views/MainWindow.xaml index 83c15995..dc525929 100644 --- a/v2rayN/v2rayN/Views/MainWindow.xaml +++ b/v2rayN/v2rayN/Views/MainWindow.xaml @@ -412,7 +412,6 @@ x:Name="lstProfiles" Grid.Row="0" materialDesign:DataGridAssist.CellPadding="1,0" - AllowDrop="True" AutoGenerateColumns="False" BorderThickness="1" CanUserAddRows="False" diff --git a/v2rayN/v2rayN/Views/MainWindow.xaml.cs b/v2rayN/v2rayN/Views/MainWindow.xaml.cs index ff0573a1..9c171f90 100644 --- a/v2rayN/v2rayN/Views/MainWindow.xaml.cs +++ b/v2rayN/v2rayN/Views/MainWindow.xaml.cs @@ -33,10 +33,14 @@ namespace v2rayN.Views lstProfiles.PreviewKeyDown += LstProfiles_PreviewKeyDown; lstProfiles.SelectionChanged += lstProfiles_SelectionChanged; lstProfiles.LoadingRow += LstProfiles_LoadingRow; - lstProfiles.PreviewMouseLeftButtonDown += LstProfiles_PreviewMouseLeftButtonDown; - lstProfiles.MouseMove += LstProfiles_MouseMove; - lstProfiles.DragEnter += LstProfiles_DragEnter; - lstProfiles.Drop += LstProfiles_Drop; + if (_config.uiItem.enableDragDropSort) + { + lstProfiles.AllowDrop = true; + lstProfiles.PreviewMouseLeftButtonDown += LstProfiles_PreviewMouseLeftButtonDown; + lstProfiles.MouseMove += LstProfiles_MouseMove; + lstProfiles.DragEnter += LstProfiles_DragEnter; + lstProfiles.Drop += LstProfiles_Drop; + } ViewModel = new MainWindowViewModel(MainSnackbar.MessageQueue!, UpdateViewHandler); Locator.CurrentMutable.RegisterLazySingleton(() => ViewModel, typeof(MainWindowViewModel)); diff --git a/v2rayN/v2rayN/Views/OptionSettingWindow.xaml b/v2rayN/v2rayN/Views/OptionSettingWindow.xaml index a35d5c8e..1461a39e 100644 --- a/v2rayN/v2rayN/Views/OptionSettingWindow.xaml +++ b/v2rayN/v2rayN/Views/OptionSettingWindow.xaml @@ -415,6 +415,7 @@ + @@ -553,16 +554,30 @@ Margin="{StaticResource SettingItemMargin}" VerticalAlignment="Center" Style="{StaticResource ToolbarTextBlock}" + Text="{x:Static resx:ResUI.TbSettingsEnableDragDropSort}" /> + + + diff --git a/v2rayN/v2rayN/Views/OptionSettingWindow.xaml.cs b/v2rayN/v2rayN/Views/OptionSettingWindow.xaml.cs index e7ed1ad9..3e4ff789 100644 --- a/v2rayN/v2rayN/Views/OptionSettingWindow.xaml.cs +++ b/v2rayN/v2rayN/Views/OptionSettingWindow.xaml.cs @@ -87,6 +87,7 @@ namespace v2rayN.Views this.Bind(ViewModel, vm => vm.EnableSecurityProtocolTls13, v => v.togEnableSecurityProtocolTls13.IsChecked).DisposeWith(disposables); this.Bind(ViewModel, vm => vm.AutoHideStartup, v => v.togAutoHideStartup.IsChecked).DisposeWith(disposables); 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.autoUpdateInterval, v => v.txtautoUpdateInterval.Text).DisposeWith(disposables); this.Bind(ViewModel, vm => vm.autoUpdateSubInterval, v => v.txtautoUpdateSubInterval.Text).DisposeWith(disposables); this.Bind(ViewModel, vm => vm.trayMenuServersLimit, v => v.txttrayMenuServersLimit.Text).DisposeWith(disposables);