Optimize server filter

pull/3677/head
2dust 2 years ago
parent 3fa22fdc55
commit b8959c8f12

@ -1411,7 +1411,7 @@ namespace v2rayN.Resx {
}
/// <summary>
/// 查找类似 Servers Filter 的本地化字符串。
/// 查找类似 Servers Filter, press Enter to execute 的本地化字符串。
/// </summary>
public static string MsgServerTitle {
get {

@ -434,7 +434,7 @@
<value>Local</value>
</data>
<data name="MsgServerTitle" xml:space="preserve">
<value>Servers Filter</value>
<value>Servers Filter, press Enter to execute</value>
</data>
<data name="menuCheckUpdate" xml:space="preserve">
<value>Check Update</value>

@ -434,7 +434,7 @@
<value>本地</value>
</data>
<data name="MsgServerTitle" xml:space="preserve">
<value>服务器过滤器</value>
<value>服务器过滤器,按回车执行</value>
</data>
<data name="menuCheckUpdate" xml:space="preserve">
<value>检查更新</value>

@ -718,10 +718,13 @@ namespace v2rayN.ViewModels
return;
}
_serverFilter = ServerFilter;
if (Utils.IsNullOrEmpty(_serverFilter))
{
RefreshServers();
}
}
private void RefreshServers()
public void RefreshServers()
{
List<ProfileItemModel> lstModel = LazyConfig.Instance.ProfileItems(_subId, _serverFilter);

@ -499,6 +499,7 @@
GridLinesVisibility="All"
HeadersVisibility="All"
IsReadOnly="True"
RowHeaderWidth="40"
Style="{StaticResource DefDataGrid}">
<DataGrid.InputBindings>
<KeyBinding Command="ApplicationCommands.NotACommand" Gesture="Ctrl+C" />

@ -30,10 +30,10 @@ namespace v2rayN.Views
this.Closing += MainWindow_Closing;
this.PreviewKeyDown += MainWindow_PreviewKeyDown;
btnAutofitColumnWidth.Click += BtnAutofitColumnWidth_Click;
txtServerFilter.PreviewKeyDown += TxtServerFilter_PreviewKeyDown;
lstProfiles.PreviewKeyDown += LstProfiles_PreviewKeyDown;
lstProfiles.SelectionChanged += lstProfiles_SelectionChanged;
lstProfiles.LoadingRow += LstProfiles_LoadingRow;
lstProfiles.RowHeaderWidth = 30;
if (_config.uiItem.enableDragDropSort)
{
lstProfiles.AllowDrop = true;
@ -408,6 +408,14 @@ namespace v2rayN.Views
it.Width = new DataGridLength(1, DataGridLengthUnitType.Auto);
}
}
private void TxtServerFilter_PreviewKeyDown(object sender, KeyEventArgs e)
{
if (e.Key is Key.Enter or Key.Return)
{
ViewModel?.RefreshServers();
}
}
#endregion
#region UI

Loading…
Cancel
Save