@@ -320,6 +320,11 @@ Project GetSelectedProject()
320320 return ( Project ) gridRecent . SelectedItem ;
321321 }
322322
323+ int GetSelectedProjectIndex ( )
324+ {
325+ return gridRecent . SelectedIndex ;
326+ }
327+
323328 UnityInstallation GetSelectedUnity ( )
324329 {
325330 return ( UnityInstallation ) dataGridUnitys . SelectedItem ;
@@ -359,13 +364,28 @@ async void CallGetUnityUpdates()
359364 dataGridUpdates . ItemsSource = updatesSource ;
360365 }
361366
367+ void RefreshRecentProjects ( )
368+ {
369+ // clear search
370+ txtSearchBox . Text = "" ;
371+ // take currently selected project row
372+ lastSelectedProjectIndex = gridRecent . SelectedIndex ;
373+ // rescan recent projects
374+ projectsSource = GetProjects . Scan ( getGitBranch : ( bool ) chkShowGitBranchColumn . IsChecked , getArguments : ( bool ) chkShowLauncherArgumentsColumn . IsChecked , showMissingFolders : ( bool ) chkShowMissingFolderProjects . IsChecked ) ;
375+ gridRecent . ItemsSource = projectsSource ;
376+ // focus back
377+ Tools . SetFocusToGrid ( gridRecent , lastSelectedProjectIndex ) ;
378+ }
379+
380+
362381
363382 //
364383 //
365384 // EVENTS
366385 //
367386 //
368387
388+
369389 //private void OnSearchPreviewKeyDown(object sender, KeyEventArgs e)
370390 //{
371391 // switch (e.Key)
@@ -644,8 +664,7 @@ private void MenuItemCopyVersion_Click(object sender, RoutedEventArgs e)
644664
645665 private void BtnRefreshProjectList_Click ( object sender , RoutedEventArgs e )
646666 {
647- projectsSource = GetProjects . Scan ( getGitBranch : ( bool ) chkShowGitBranchColumn . IsChecked , getArguments : ( bool ) chkShowLauncherArgumentsColumn . IsChecked , showMissingFolders : ( bool ) chkShowMissingFolderProjects . IsChecked ) ;
648- gridRecent . ItemsSource = projectsSource ;
667+ RefreshRecentProjects ( ) ;
649668 }
650669
651670 // run unity only
@@ -727,8 +746,19 @@ private void TxtSearchBox_PreviewKeyDown(object sender, KeyEventArgs e)
727746 break ;
728747 case Key . Tab :
729748 case Key . Up :
730- case Key . Down :
731749 Tools . SetFocusToGrid ( gridRecent ) ;
750+ e . Handled = true ;
751+ break ;
752+ case Key . Down :
753+ // TODO move to 2nd row if first is already selected
754+ //if (GetSelectedProjectIndex() == 0)
755+ //{
756+ // Tools.SetFocusToGrid(gridRecent, 1);
757+ //}
758+ //else
759+ //{
760+ Tools . SetFocusToGrid ( gridRecent ) ;
761+ // }
732762 e . Handled = true ; // to stay in first row
733763 break ;
734764 default :
@@ -775,11 +805,7 @@ private void GridRecent_PreviewKeyDown(object sender, KeyEventArgs e)
775805 break ;
776806
777807 case Key . F5 : // refresh projects
778- txtSearchBox . Text = "" ;
779- lastSelectedProjectIndex = gridRecent . SelectedIndex ;
780- projectsSource = GetProjects . Scan ( getGitBranch : ( bool ) chkShowGitBranchColumn . IsChecked , getArguments : ( bool ) chkShowLauncherArgumentsColumn . IsChecked , showMissingFolders : ( bool ) chkShowMissingFolderProjects . IsChecked ) ;
781- gridRecent . ItemsSource = projectsSource ;
782- Tools . SetFocusToGrid ( gridRecent , lastSelectedProjectIndex ) ;
808+ RefreshRecentProjects ( ) ;
783809 break ;
784810 case Key . Tab :
785811 if ( ( Keyboard . Modifiers & ModifierKeys . Control ) == ModifierKeys . Control )
0 commit comments