@@ -42,11 +42,14 @@ private async void UserControl_Loaded(object sender, RoutedEventArgs e)
4242 }
4343 public async Task RestoreInstalledGames ( )
4444 {
45+ if ( gamesRestored )
46+ {
47+ InstallViewModel . Instance . InstalledGames . Clear ( ) ; // Clear here because the double entry code won't allow to refresh
48+ //File watchers are already protected against double entries and dont care, if the same code runs again
49+ }
4550 Dictionary < int , string > foundGames = new Dictionary < int , string > ( ) ;
4651 Game [ ] ? games = await Task < Game [ ] > . Run ( async ( ) =>
4752 {
48-
49- //string installationPath = Path.Combine(SettingsViewModel.Instance.RootPath, "GameVault\\Installations");
5053 if ( SettingsViewModel . Instance . RootDirectories . Count > 0 )
5154 {
5255
@@ -156,6 +159,10 @@ public async Task RestoreInstalledGames()
156159 }
157160 InstallViewModel . Instance . InstalledGames = await SortInstalledGamesByLastPlayed ( TempInstalledGames ) ;
158161 InstallViewModel . Instance . InstalledGamesFilter = CollectionViewSource . GetDefaultView ( InstallViewModel . Instance . InstalledGames ) ;
162+ if ( gamesRestored )
163+ {
164+ SearchFilterInputTimerElapsed ( null , null ) ; //Keep the filter
165+ }
159166 }
160167 gamesRestored = true ;
161168 App . Instance . SetJumpListGames ( ) ;
@@ -288,13 +295,13 @@ private void Search_TextChanged(object sender, TextChangedEventArgs e)
288295 inputTimer . Data = ( ( TextBox ) sender ) . Text ;
289296 inputTimer . Start ( ) ;
290297 }
291- private void InputTimerElapsed ( object sender , EventArgs e )
298+ private void SearchFilterInputTimerElapsed ( object sender , EventArgs e )
292299 {
293300 inputTimer . Stop ( ) ;
294301 if ( InstallViewModel . Instance . InstalledGamesFilter == null ) return ;
295302 InstallViewModel . Instance . InstalledGamesFilter . Filter = item =>
296303 {
297- return ( ( KeyValuePair < Game , string > ) item ) . Key . Title . Contains ( inputTimer . Data , StringComparison . OrdinalIgnoreCase ) ;
304+ return ( ( KeyValuePair < Game , string > ) item ) . Key . Title . Contains ( inputTimer . Data ?? "" , StringComparison . OrdinalIgnoreCase ) ;
298305 } ;
299306 }
300307
@@ -384,7 +391,7 @@ private void InitTimer()
384391 {
385392 inputTimer = new InputTimer ( ) ;
386393 inputTimer . Interval = TimeSpan . FromMilliseconds ( 400 ) ;
387- inputTimer . Tick += InputTimerElapsed ;
394+ inputTimer . Tick += SearchFilterInputTimerElapsed ;
388395 }
389396
390397 private void InstalledGames_Toggled ( object sender , RoutedEventArgs e )
0 commit comments