@@ -47,6 +47,9 @@ public partial class MainWindow : Window
4747 Updates [ ] updatesSource ;
4848
4949 string _filterString = null ;
50+ bool multiWordSearch = false ;
51+ string [ ] searchWords ;
52+
5053 int lastSelectedProjectIndex = 0 ;
5154 Mutex myMutex ;
5255 ThemeEditor themeEditorWindow ;
@@ -252,6 +255,18 @@ void FilterRecentProjects()
252255 {
253256 // https://www.wpftutorial.net/DataViews.html
254257 _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+
255270 ICollectionView collection = CollectionViewSource . GetDefaultView ( projectsSource ) ;
256271 collection . Filter = ProjectFilter ;
257272 // set first row selected, if only 1 row
@@ -297,7 +312,26 @@ void FilterBuildReport()
297312 private bool ProjectFilter ( object item )
298313 {
299314 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+ }
301335 }
302336
303337 private bool UpdatesFilter ( object item )
@@ -443,34 +477,34 @@ void LoadSettings()
443477 }
444478
445479 // other setting vars
446- preferredVersion = Properties . Settings . Default . preferredVersion ;
480+ preferredVersion = Settings . Default . preferredVersion ;
447481
448482 // 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 ;
451485
452- if ( Properties . Settings . Default . useCustomLastModified )
486+ if ( Settings . Default . useCustomLastModified )
453487 {
454- currentDateFormat = Properties . Settings . Default . customDateFormat ;
488+ currentDateFormat = Settings . Default . customDateFormat ;
455489 }
456490 else // use default
457491 {
458492 currentDateFormat = defaultDateFormat ;
459493 }
460494
461- chkHumanFriendlyDateTime . IsChecked = Properties . Settings . Default . useHumandFriendlyLastModified ;
495+ chkHumanFriendlyDateTime . IsChecked = Settings . Default . useHumandFriendlyLastModified ;
462496 // if both enabled, then disable custom
463497 if ( chkHumanFriendlyDateTime . IsChecked == true && chkUseCustomLastModified . IsChecked == true )
464498 {
465499 chkUseCustomLastModified . IsChecked = false ;
466500 }
467501
468- useHumanFriendlyDateFormat = Properties . Settings . Default . useHumandFriendlyLastModified ;
469- searchProjectPathAlso = Properties . Settings . Default . searchProjectPathAlso ;
502+ useHumanFriendlyDateFormat = Settings . Default . useHumandFriendlyLastModified ;
503+ searchProjectPathAlso = Settings . Default . searchProjectPathAlso ;
470504 chkSearchProjectPath . IsChecked = searchProjectPathAlso ;
471505
472506 // recent grid column display index order
473- var order = Properties . Settings . Default . recentColumnsOrder ;
507+ var order = Settings . Default . recentColumnsOrder ;
474508
475509 // if we dont have any values, get & set them now
476510 // 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)
849883 // refresh installations, if already added some new ones
850884 UpdateUnityInstallationsList ( ) ;
851885 txtSearchBoxUpdates . Text = "" ;
886+ // clear filters, since right now they are not used after updates are loaded
887+ rdoAll . IsChecked = true ;
852888 CallGetUnityUpdates ( ) ;
853889
854890 button . IsEnabled = true ;
0 commit comments