@@ -300,7 +300,7 @@ void UpdateUnityInstallationsList()
300300 for ( int i = 0 , len = unityInstallationsSource . Length ; i < len ; i ++ )
301301 {
302302 var version = unityInstallationsSource [ i ] . Version ;
303- if ( unityInstalledVersions . ContainsKey ( version ) == false )
303+ if ( string . IsNullOrEmpty ( version ) == false && unityInstalledVersions . ContainsKey ( version ) == false )
304304 {
305305 unityInstalledVersions . Add ( version , unityInstallationsSource [ i ] . Path ) ;
306306 }
@@ -339,21 +339,7 @@ void AddUnityInstallationRootFolder()
339339 }
340340 }
341341
342- void SetFocusToGrid ( DataGrid targetGrid , int index = 0 )
343- {
344- //e.Handled = true; // if enabled, we enter to first row initially
345- if ( targetGrid . Items . Count < 1 ) return ;
346- targetGrid . Focus ( ) ;
347- DataGridRow row = ( DataGridRow ) targetGrid . ItemContainerGenerator . ContainerFromIndex ( index ) ;
348- if ( row == null )
349- {
350- gridRecent . UpdateLayout ( ) ;
351- gridRecent . ScrollIntoView ( gridRecent . Items [ index ] ) ;
352- row = ( DataGridRow ) gridRecent . ItemContainerGenerator . ContainerFromIndex ( index ) ;
353- }
354- row . MoveFocus ( new TraversalRequest ( FocusNavigationDirection . Next ) ) ;
355- targetGrid . SelectedIndex = index ;
356- }
342+
357343
358344 async void CallGetUnityUpdates ( )
359345 {
@@ -499,7 +485,7 @@ private void OnWindowKeyDown(object sender, KeyEventArgs e)
499485 case Key . Escape : // clear project search
500486 if ( txtSearchBox . Text == "" )
501487 {
502- SetFocusToGrid ( gridRecent ) ;
488+ Tools . SetFocusToGrid ( gridRecent ) ;
503489 }
504490 txtSearchBox . Text = "" ;
505491 break ;
@@ -671,7 +657,7 @@ private void BtnUpgradeProject_Click(object sender, RoutedEventArgs e)
671657 private void GridRecent_Loaded ( object sender , RoutedEventArgs e )
672658 {
673659 //Console.WriteLine("GridRecent_Loaded");
674- SetFocusToGrid ( gridRecent ) ;
660+ Tools . SetFocusToGrid ( gridRecent ) ;
675661 }
676662
677663 private void BtnExploreUnity_Click ( object sender , RoutedEventArgs e )
@@ -732,7 +718,7 @@ private void TxtSearchBox_PreviewKeyDown(object sender, KeyEventArgs e)
732718 case Key . Tab :
733719 case Key . Up :
734720 case Key . Down :
735- SetFocusToGrid ( gridRecent ) ;
721+ Tools . SetFocusToGrid ( gridRecent ) ;
736722 break ;
737723 default :
738724 break ;
@@ -745,7 +731,7 @@ private void TxtSearchBoxUnity_PreviewKeyDown(object sender, KeyEventArgs e)
745731 {
746732 case Key . Up :
747733 case Key . Down :
748- SetFocusToGrid ( dataGridUnitys ) ;
734+ Tools . SetFocusToGrid ( dataGridUnitys ) ;
749735 break ;
750736 default :
751737 break ;
@@ -782,7 +768,7 @@ private void GridRecent_PreviewKeyDown(object sender, KeyEventArgs e)
782768 lastSelectedProjectIndex = gridRecent . SelectedIndex ;
783769 projectsSource = GetProjects . Scan ( getGitBranch : ( bool ) chkShowGitBranchColumn . IsChecked , getArguments : ( bool ) chkShowLauncherArgumentsColumn . IsChecked , showMissingFolders : ( bool ) chkShowMissingFolderProjects . IsChecked ) ;
784770 gridRecent . ItemsSource = projectsSource ;
785- SetFocusToGrid ( gridRecent , lastSelectedProjectIndex ) ;
771+ Tools . SetFocusToGrid ( gridRecent , lastSelectedProjectIndex ) ;
786772 break ;
787773 case Key . Tab :
788774 if ( ( Keyboard . Modifiers & ModifierKeys . Control ) == ModifierKeys . Control )
@@ -827,7 +813,7 @@ private void TxtSearchBoxUpdates_PreviewKeyDown(object sender, KeyEventArgs e)
827813 {
828814 case Key . Up :
829815 case Key . Down :
830- SetFocusToGrid ( dataGridUpdates ) ;
816+ Tools . SetFocusToGrid ( dataGridUpdates ) ;
831817 break ;
832818 default :
833819 break ;
@@ -1116,5 +1102,15 @@ private void BtnAssetPackages_Click(object sender, RoutedEventArgs e)
11161102 Console . WriteLine ( "Cannot open folder.." + folder ) ;
11171103 }
11181104 }
1105+
1106+ // sets selected unity version as preferred main unity version (to be preselected in case of unknown version projects, when creating new empty project, etc)
1107+ private void MenuItemSetPreferredUnityVersion_Click ( object sender , RoutedEventArgs e )
1108+ {
1109+ Properties . Settings . Default . preferredVersion = GetSelectedUnity ( ) . Version ;
1110+ Properties . Settings . Default . Save ( ) ;
1111+
1112+ // TODO set star icon
1113+
1114+ }
11191115 } // class
11201116} //namespace
0 commit comments