From b8644268b37ab4e51271bb6ca7d44aa79d7d4f27 Mon Sep 17 00:00:00 2001
From: 2dust <31833384+2dust@users.noreply.github.com>
Date: Thu, 27 Apr 2023 10:28:20 +0800
Subject: [PATCH] Enter to set active routing rules
---
v2rayN/v2rayN/Resx/ResUI.Designer.cs | 2 +-
v2rayN/v2rayN/Resx/ResUI.resx | 2 +-
v2rayN/v2rayN/Resx/ResUI.zh-Hans.resx | 2 +-
v2rayN/v2rayN/ViewModels/RoutingSettingViewModel.cs | 2 +-
v2rayN/v2rayN/Views/RoutingSettingWindow.xaml.cs | 4 ++++
5 files changed, 8 insertions(+), 4 deletions(-)
diff --git a/v2rayN/v2rayN/Resx/ResUI.Designer.cs b/v2rayN/v2rayN/Resx/ResUI.Designer.cs
index beae407e..950d18bf 100644
--- a/v2rayN/v2rayN/Resx/ResUI.Designer.cs
+++ b/v2rayN/v2rayN/Resx/ResUI.Designer.cs
@@ -1024,7 +1024,7 @@ namespace v2rayN.Resx {
}
///
- /// 查找类似 Set as active rule 的本地化字符串。
+ /// 查找类似 Set as active rule(Enter) 的本地化字符串。
///
public static string menuRoutingAdvancedSetDefault {
get {
diff --git a/v2rayN/v2rayN/Resx/ResUI.resx b/v2rayN/v2rayN/Resx/ResUI.resx
index 6e1dcdc7..cdeb2dc4 100644
--- a/v2rayN/v2rayN/Resx/ResUI.resx
+++ b/v2rayN/v2rayN/Resx/ResUI.resx
@@ -881,7 +881,7 @@
Remove selected
- Set as active rule
+ Set as active rule(Enter)
Basic Function
diff --git a/v2rayN/v2rayN/Resx/ResUI.zh-Hans.resx b/v2rayN/v2rayN/Resx/ResUI.zh-Hans.resx
index f820b5e8..5493598e 100644
--- a/v2rayN/v2rayN/Resx/ResUI.zh-Hans.resx
+++ b/v2rayN/v2rayN/Resx/ResUI.zh-Hans.resx
@@ -881,7 +881,7 @@
移除所选规则
- 设为活动规则
+ 设为活动规则 (Enter)
基础功能
diff --git a/v2rayN/v2rayN/ViewModels/RoutingSettingViewModel.cs b/v2rayN/v2rayN/ViewModels/RoutingSettingViewModel.cs
index a445e705..6a7d51dc 100644
--- a/v2rayN/v2rayN/ViewModels/RoutingSettingViewModel.cs
+++ b/v2rayN/v2rayN/ViewModels/RoutingSettingViewModel.cs
@@ -280,7 +280,7 @@ namespace v2rayN.ViewModels
IsModified = true;
}
- private void RoutingAdvancedSetDefault()
+ public void RoutingAdvancedSetDefault()
{
var item = LazyConfig.Instance.GetRoutingItem(SelectedSource?.id);
if (item is null)
diff --git a/v2rayN/v2rayN/Views/RoutingSettingWindow.xaml.cs b/v2rayN/v2rayN/Views/RoutingSettingWindow.xaml.cs
index 60254194..d430e9c0 100644
--- a/v2rayN/v2rayN/Views/RoutingSettingWindow.xaml.cs
+++ b/v2rayN/v2rayN/Views/RoutingSettingWindow.xaml.cs
@@ -84,6 +84,10 @@ namespace v2rayN.Views
lstRoutings.SelectAll();
}
}
+ else if (e.Key is Key.Enter or Key.Return)
+ {
+ ViewModel?.RoutingAdvancedSetDefault();
+ }
}
private void menuRoutingAdvancedSelectAll_Click(object sender, System.Windows.RoutedEventArgs e)