@@ -320,6 +320,11 @@ Project GetSelectedProject()
320
320
return ( Project ) gridRecent . SelectedItem ;
321
321
}
322
322
323
+ int GetSelectedProjectIndex ( )
324
+ {
325
+ return gridRecent . SelectedIndex ;
326
+ }
327
+
323
328
UnityInstallation GetSelectedUnity ( )
324
329
{
325
330
return ( UnityInstallation ) dataGridUnitys . SelectedItem ;
@@ -359,13 +364,28 @@ async void CallGetUnityUpdates()
359
364
dataGridUpdates . ItemsSource = updatesSource ;
360
365
}
361
366
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
+
362
381
363
382
//
364
383
//
365
384
// EVENTS
366
385
//
367
386
//
368
387
388
+
369
389
//private void OnSearchPreviewKeyDown(object sender, KeyEventArgs e)
370
390
//{
371
391
// switch (e.Key)
@@ -644,8 +664,7 @@ private void MenuItemCopyVersion_Click(object sender, RoutedEventArgs e)
644
664
645
665
private void BtnRefreshProjectList_Click ( object sender , RoutedEventArgs e )
646
666
{
647
- projectsSource = GetProjects . Scan ( getGitBranch : ( bool ) chkShowGitBranchColumn . IsChecked , getArguments : ( bool ) chkShowLauncherArgumentsColumn . IsChecked , showMissingFolders : ( bool ) chkShowMissingFolderProjects . IsChecked ) ;
648
- gridRecent . ItemsSource = projectsSource ;
667
+ RefreshRecentProjects ( ) ;
649
668
}
650
669
651
670
// run unity only
@@ -727,8 +746,19 @@ private void TxtSearchBox_PreviewKeyDown(object sender, KeyEventArgs e)
727
746
break ;
728
747
case Key . Tab :
729
748
case Key . Up :
730
- case Key . Down :
731
749
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
+ // }
732
762
e . Handled = true ; // to stay in first row
733
763
break ;
734
764
default :
@@ -775,11 +805,7 @@ private void GridRecent_PreviewKeyDown(object sender, KeyEventArgs e)
775
805
break ;
776
806
777
807
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 ( ) ;
783
809
break ;
784
810
case Key . Tab :
785
811
if ( ( Keyboard . Modifiers & ModifierKeys . Control ) == ModifierKeys . Control )
0 commit comments