Skip to content

Commit 4b102dc

Browse files
committed
Don't refresh listview if search term is the same
1 parent 0168aea commit 4b102dc

File tree

1 file changed

+12
-6
lines changed

1 file changed

+12
-6
lines changed

Flow.Launcher/SettingWindow.xaml.cs

Lines changed: 12 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ public SettingWindow(IPublicAPI api, SettingWindowViewModel viewModel)
4444
DataContext = viewModel;
4545
this.viewModel = viewModel;
4646
API = api;
47-
47+
4848
}
4949

5050
#region General
@@ -57,8 +57,8 @@ private void OnLoaded(object sender, RoutedEventArgs e)
5757
HwndSource hwndSource = PresentationSource.FromVisual(this) as HwndSource;
5858
HwndTarget hwndTarget = hwndSource.CompositionTarget;
5959
hwndTarget.RenderMode = RenderMode.SoftwareOnly;
60-
61-
pluginListView = (CollectionView) CollectionViewSource.GetDefaultView(pluginList.ItemsSource);
60+
61+
pluginListView = (CollectionView)CollectionViewSource.GetDefaultView(pluginList.ItemsSource);
6262
pluginListView.Filter = PluginFilter;
6363
}
6464

@@ -393,14 +393,20 @@ private bool PluginFilter(object item)
393393
return false;
394394
}
395395

396+
private string lastSearch = "";
397+
396398
private void RefreshPluginListEventHandler(object sender, RoutedEventArgs e)
397399
{
398-
pluginListView.Refresh();
400+
if (pluginFilterTxb.Text != lastSearch)
401+
{
402+
lastSearch = pluginFilterTxb.Text;
403+
pluginListView.Refresh();
404+
}
399405
}
400406
private void PluginFilterTxb_OnKeyDown(object sender, KeyEventArgs e)
401407
{
402-
if(e.Key == Key.Enter)
403-
pluginListView.Refresh();
408+
if (e.Key == Key.Enter)
409+
RefreshPluginListEventHandler(sender, e);
404410
}
405411
}
406412
}

0 commit comments

Comments
 (0)