@@ -300,7 +300,7 @@ void UpdateUnityInstallationsList()
300
300
for ( int i = 0 , len = unityInstallationsSource . Length ; i < len ; i ++ )
301
301
{
302
302
var version = unityInstallationsSource [ i ] . Version ;
303
- if ( unityInstalledVersions . ContainsKey ( version ) == false )
303
+ if ( string . IsNullOrEmpty ( version ) == false && unityInstalledVersions . ContainsKey ( version ) == false )
304
304
{
305
305
unityInstalledVersions . Add ( version , unityInstallationsSource [ i ] . Path ) ;
306
306
}
@@ -339,21 +339,7 @@ void AddUnityInstallationRootFolder()
339
339
}
340
340
}
341
341
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
+
357
343
358
344
async void CallGetUnityUpdates ( )
359
345
{
@@ -499,7 +485,7 @@ private void OnWindowKeyDown(object sender, KeyEventArgs e)
499
485
case Key . Escape : // clear project search
500
486
if ( txtSearchBox . Text == "" )
501
487
{
502
- SetFocusToGrid ( gridRecent ) ;
488
+ Tools . SetFocusToGrid ( gridRecent ) ;
503
489
}
504
490
txtSearchBox . Text = "" ;
505
491
break ;
@@ -671,7 +657,7 @@ private void BtnUpgradeProject_Click(object sender, RoutedEventArgs e)
671
657
private void GridRecent_Loaded ( object sender , RoutedEventArgs e )
672
658
{
673
659
//Console.WriteLine("GridRecent_Loaded");
674
- SetFocusToGrid ( gridRecent ) ;
660
+ Tools . SetFocusToGrid ( gridRecent ) ;
675
661
}
676
662
677
663
private void BtnExploreUnity_Click ( object sender , RoutedEventArgs e )
@@ -732,7 +718,7 @@ private void TxtSearchBox_PreviewKeyDown(object sender, KeyEventArgs e)
732
718
case Key . Tab :
733
719
case Key . Up :
734
720
case Key . Down :
735
- SetFocusToGrid ( gridRecent ) ;
721
+ Tools . SetFocusToGrid ( gridRecent ) ;
736
722
break ;
737
723
default :
738
724
break ;
@@ -745,7 +731,7 @@ private void TxtSearchBoxUnity_PreviewKeyDown(object sender, KeyEventArgs e)
745
731
{
746
732
case Key . Up :
747
733
case Key . Down :
748
- SetFocusToGrid ( dataGridUnitys ) ;
734
+ Tools . SetFocusToGrid ( dataGridUnitys ) ;
749
735
break ;
750
736
default :
751
737
break ;
@@ -782,7 +768,7 @@ private void GridRecent_PreviewKeyDown(object sender, KeyEventArgs e)
782
768
lastSelectedProjectIndex = gridRecent . SelectedIndex ;
783
769
projectsSource = GetProjects . Scan ( getGitBranch : ( bool ) chkShowGitBranchColumn . IsChecked , getArguments : ( bool ) chkShowLauncherArgumentsColumn . IsChecked , showMissingFolders : ( bool ) chkShowMissingFolderProjects . IsChecked ) ;
784
770
gridRecent . ItemsSource = projectsSource ;
785
- SetFocusToGrid ( gridRecent , lastSelectedProjectIndex ) ;
771
+ Tools . SetFocusToGrid ( gridRecent , lastSelectedProjectIndex ) ;
786
772
break ;
787
773
case Key . Tab :
788
774
if ( ( Keyboard . Modifiers & ModifierKeys . Control ) == ModifierKeys . Control )
@@ -827,7 +813,7 @@ private void TxtSearchBoxUpdates_PreviewKeyDown(object sender, KeyEventArgs e)
827
813
{
828
814
case Key . Up :
829
815
case Key . Down :
830
- SetFocusToGrid ( dataGridUpdates ) ;
816
+ Tools . SetFocusToGrid ( dataGridUpdates ) ;
831
817
break ;
832
818
default :
833
819
break ;
@@ -1116,5 +1102,15 @@ private void BtnAssetPackages_Click(object sender, RoutedEventArgs e)
1116
1102
Console . WriteLine ( "Cannot open folder.." + folder ) ;
1117
1103
}
1118
1104
}
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
+ }
1119
1115
} // class
1120
1116
} //namespace
0 commit comments