@@ -47,6 +47,9 @@ public partial class MainWindow : Window
47
47
Updates [ ] updatesSource ;
48
48
49
49
string _filterString = null ;
50
+ bool multiWordSearch = false ;
51
+ string [ ] searchWords ;
52
+
50
53
int lastSelectedProjectIndex = 0 ;
51
54
Mutex myMutex ;
52
55
ThemeEditor themeEditorWindow ;
@@ -252,6 +255,18 @@ void FilterRecentProjects()
252
255
{
253
256
// https://www.wpftutorial.net/DataViews.html
254
257
_filterString = txtSearchBox . Text ;
258
+
259
+ if ( _filterString . IndexOf ( ' ' ) > - 1 )
260
+ {
261
+ multiWordSearch = true ;
262
+ searchWords = _filterString . Split ( ' ' ) ;
263
+ }
264
+ else
265
+ {
266
+ multiWordSearch = false ;
267
+ }
268
+
269
+
255
270
ICollectionView collection = CollectionViewSource . GetDefaultView ( projectsSource ) ;
256
271
collection . Filter = ProjectFilter ;
257
272
// set first row selected, if only 1 row
@@ -297,7 +312,26 @@ void FilterBuildReport()
297
312
private bool ProjectFilter ( object item )
298
313
{
299
314
Project proj = item as Project ;
300
- return ( proj . Title . IndexOf ( _filterString , 0 , StringComparison . CurrentCultureIgnoreCase ) != - 1 ) || ( searchProjectPathAlso && ( proj . Path . IndexOf ( _filterString , 0 , StringComparison . CurrentCultureIgnoreCase ) != - 1 ) ) ;
315
+
316
+ // split search string by space, if it contains space
317
+ if ( multiWordSearch == true )
318
+ {
319
+ bool found = true ;
320
+ foreach ( var word in searchWords )
321
+ {
322
+ bool titleMatched = proj . Title . IndexOf ( word , 0 , StringComparison . CurrentCultureIgnoreCase ) != - 1 ;
323
+ bool pathMatched = searchProjectPathAlso && proj . Path . IndexOf ( word , 0 , StringComparison . CurrentCultureIgnoreCase ) != - 1 ;
324
+ found = found && ( titleMatched || pathMatched ) ;
325
+ }
326
+ return found ;
327
+ }
328
+ else // single word search
329
+ {
330
+ bool titleMatched = proj . Title . IndexOf ( _filterString , 0 , StringComparison . CurrentCultureIgnoreCase ) != - 1 ;
331
+ bool pathMatched = searchProjectPathAlso && proj . Path . IndexOf ( _filterString , 0 , StringComparison . CurrentCultureIgnoreCase ) != - 1 ;
332
+
333
+ return titleMatched || pathMatched ;
334
+ }
301
335
}
302
336
303
337
private bool UpdatesFilter ( object item )
@@ -443,34 +477,34 @@ void LoadSettings()
443
477
}
444
478
445
479
// other setting vars
446
- preferredVersion = Properties . Settings . Default . preferredVersion ;
480
+ preferredVersion = Settings . Default . preferredVersion ;
447
481
448
482
// get last modified date format
449
- chkUseCustomLastModified . IsChecked = Properties . Settings . Default . useCustomLastModified ;
450
- txtCustomDateTimeFormat . Text = Properties . Settings . Default . customDateFormat ;
483
+ chkUseCustomLastModified . IsChecked = Settings . Default . useCustomLastModified ;
484
+ txtCustomDateTimeFormat . Text = Settings . Default . customDateFormat ;
451
485
452
- if ( Properties . Settings . Default . useCustomLastModified )
486
+ if ( Settings . Default . useCustomLastModified )
453
487
{
454
- currentDateFormat = Properties . Settings . Default . customDateFormat ;
488
+ currentDateFormat = Settings . Default . customDateFormat ;
455
489
}
456
490
else // use default
457
491
{
458
492
currentDateFormat = defaultDateFormat ;
459
493
}
460
494
461
- chkHumanFriendlyDateTime . IsChecked = Properties . Settings . Default . useHumandFriendlyLastModified ;
495
+ chkHumanFriendlyDateTime . IsChecked = Settings . Default . useHumandFriendlyLastModified ;
462
496
// if both enabled, then disable custom
463
497
if ( chkHumanFriendlyDateTime . IsChecked == true && chkUseCustomLastModified . IsChecked == true )
464
498
{
465
499
chkUseCustomLastModified . IsChecked = false ;
466
500
}
467
501
468
- useHumanFriendlyDateFormat = Properties . Settings . Default . useHumandFriendlyLastModified ;
469
- searchProjectPathAlso = Properties . Settings . Default . searchProjectPathAlso ;
502
+ useHumanFriendlyDateFormat = Settings . Default . useHumandFriendlyLastModified ;
503
+ searchProjectPathAlso = Settings . Default . searchProjectPathAlso ;
470
504
chkSearchProjectPath . IsChecked = searchProjectPathAlso ;
471
505
472
506
// recent grid column display index order
473
- var order = Properties . Settings . Default . recentColumnsOrder ;
507
+ var order = Settings . Default . recentColumnsOrder ;
474
508
475
509
// if we dont have any values, get & set them now
476
510
// also, if user has disabled optional columns, saved order must be reset to default
@@ -849,6 +883,8 @@ private void OnGetUnityUpdatesClick(object sender, RoutedEventArgs e)
849
883
// refresh installations, if already added some new ones
850
884
UpdateUnityInstallationsList ( ) ;
851
885
txtSearchBoxUpdates . Text = "" ;
886
+ // clear filters, since right now they are not used after updates are loaded
887
+ rdoAll . IsChecked = true ;
852
888
CallGetUnityUpdates ( ) ;
853
889
854
890
button . IsEnabled = true ;
0 commit comments