@@ -59,7 +59,10 @@ private void OnLoaded(object sender, RoutedEventArgs e)
59
59
hwndTarget . RenderMode = RenderMode . SoftwareOnly ;
60
60
61
61
pluginListView = ( CollectionView ) CollectionViewSource . GetDefaultView ( pluginList . ItemsSource ) ;
62
- pluginListView . Filter = PluginFilter ;
62
+ pluginListView . Filter = PluginListFilter ;
63
+
64
+ pluginStoreView = ( CollectionView ) CollectionViewSource . GetDefaultView ( StoreListBox . ItemsSource ) ;
65
+ pluginStoreView . Filter = PluginStoreFilter ;
63
66
}
64
67
65
68
private void OnAutoStartupChecked ( object sender , RoutedEventArgs e )
@@ -381,8 +384,9 @@ private void Window_StateChanged(object sender, EventArgs e)
381
384
}
382
385
383
386
private CollectionView pluginListView ;
387
+ private CollectionView pluginStoreView ;
384
388
385
- private bool PluginFilter ( object item )
389
+ private bool PluginListFilter ( object item )
386
390
{
387
391
if ( string . IsNullOrEmpty ( pluginFilterTxb . Text ) )
388
392
return true ;
@@ -392,22 +396,48 @@ private bool PluginFilter(object item)
392
396
}
393
397
return false ;
394
398
}
399
+ private bool PluginStoreFilter ( object item )
400
+ {
401
+ if ( string . IsNullOrEmpty ( pluginStoreFilterTxb . Text ) )
402
+ return true ;
403
+ if ( item is UserPlugin model )
404
+ {
405
+ return StringMatcher . FuzzySearch ( pluginStoreFilterTxb . Text , model . Name ) . IsSearchPrecisionScoreMet ( ) ;
406
+ }
407
+ return false ;
408
+ }
395
409
396
- private string lastSearch = "" ;
410
+ private string lastPluginListSearch = "" ;
411
+ private string lastPluginStoreSearch = "" ;
397
412
398
413
private void RefreshPluginListEventHandler ( object sender , RoutedEventArgs e )
399
414
{
400
- if ( pluginFilterTxb . Text != lastSearch )
415
+ if ( pluginFilterTxb . Text != lastPluginListSearch )
401
416
{
402
- lastSearch = pluginFilterTxb . Text ;
417
+ lastPluginListSearch = pluginFilterTxb . Text ;
403
418
pluginListView . Refresh ( ) ;
404
419
}
405
420
}
421
+
422
+ private void RefreshPluginStoreEventHandler ( object sender , RoutedEventArgs e )
423
+ {
424
+ if ( pluginStoreFilterTxb . Text != lastPluginStoreSearch )
425
+ {
426
+ lastPluginStoreSearch = pluginStoreFilterTxb . Text ;
427
+ pluginStoreView . Refresh ( ) ;
428
+ }
429
+ }
406
430
private void PluginFilterTxb_OnKeyDown ( object sender , KeyEventArgs e )
407
431
{
408
432
if ( e . Key == Key . Enter )
409
433
RefreshPluginListEventHandler ( sender , e ) ;
410
434
}
435
+
436
+ private void PluginStoreFilterTxb_OnKeyDown ( object sender , KeyEventArgs e )
437
+ {
438
+ if ( e . Key == Key . Enter )
439
+ RefreshPluginListEventHandler ( sender , e ) ;
440
+ }
411
441
private void OnPluginSettingKeydown ( object sender , KeyEventArgs e )
412
442
{
413
443
if ( ( Keyboard . Modifiers & ModifierKeys . Control ) == ModifierKeys . Control && e . Key == Key . F )
0 commit comments