99using System . IO ;
1010using System . Runtime . InteropServices ;
1111using System . Threading ;
12+ using System . Threading . Tasks ;
1213using System . Windows ;
1314using System . Windows . Controls ;
1415using System . Windows . Data ;
@@ -352,7 +353,7 @@ void AddUnityInstallationRootFolder()
352353 }
353354
354355 // waits for unity update results and assigns to datagrid
355- async void CallGetUnityUpdates ( )
356+ async Task CallGetUnityUpdates ( )
356357 {
357358 dataGridUpdates . ItemsSource = null ;
358359 var task = GetUnityUpdates . Scan ( ) ;
@@ -364,6 +365,32 @@ async void CallGetUnityUpdates()
364365 dataGridUpdates . ItemsSource = updatesSource ;
365366 }
366367
368+ async void GoLookForUpdatesForThisUnity ( )
369+ {
370+ // call for updates list fetch
371+ await CallGetUnityUpdates ( ) ;
372+
373+ var unity = GetSelectedUnity ( ) ;
374+ if ( unity == null ) return ;
375+ // NOTE for now, just select the same version.. then user can see what has been released after this
376+ // NOTE if updates are not loaded, should wait for that
377+ if ( dataGridUpdates . ItemsSource != null )
378+ {
379+ tabControl . SelectedIndex = 2 ;
380+ // find matching version
381+ for ( int i = 0 ; i < dataGridUpdates . Items . Count ; i ++ )
382+ {
383+ Updates row = ( Updates ) dataGridUpdates . Items [ i ] ;
384+ if ( row . Version == unity . Version )
385+ {
386+ dataGridUpdates . SelectedIndex = i ;
387+ dataGridUpdates . ScrollIntoView ( row ) ;
388+ break ;
389+ }
390+ }
391+ }
392+ }
393+
367394 void RefreshRecentProjects ( )
368395 {
369396 // clear search
@@ -636,6 +663,8 @@ private void MenuItemCopyVersion_Click(object sender, RoutedEventArgs e)
636663
637664 private void BtnRefreshProjectList_Click ( object sender , RoutedEventArgs e )
638665 {
666+ // we want to refresh unity installs also, to make sure version colors are correct
667+ UpdateUnityInstallationsList ( ) ;
639668 RefreshRecentProjects ( ) ;
640669 }
641670
@@ -686,27 +715,11 @@ private void BtnReleaseNotes_Click(object sender, RoutedEventArgs e)
686715
687716 private void BtnUpdateUnity_Click ( object sender , RoutedEventArgs e )
688717 {
689- var unity = GetSelectedUnity ( ) ;
690- if ( unity == null ) return ;
691- // NOTE for now, just select the same version.. then user can see what has been released after this
692- // NOTE if updates are not loaded, should wait for that
693- if ( dataGridUpdates . ItemsSource != null )
694- {
695- tabControl . SelectedIndex = 2 ;
696- // find matching version
697- for ( int i = 0 ; i < dataGridUpdates . Items . Count ; i ++ )
698- {
699- Updates row = ( Updates ) dataGridUpdates . Items [ i ] ;
700- if ( row . Version == unity . Version )
701- {
702- dataGridUpdates . SelectedIndex = i ;
703- dataGridUpdates . ScrollIntoView ( row ) ;
704- break ;
705- }
706- }
707- }
718+ GoLookForUpdatesForThisUnity ( ) ;
708719 }
709720
721+
722+
710723 // if press up/down in search box, move to first item in results
711724 private void TxtSearchBox_PreviewKeyDown ( object sender , KeyEventArgs e )
712725 {
@@ -1135,7 +1148,7 @@ private void MenuItemCopyPath_Click(object sender, RoutedEventArgs e)
11351148 {
11361149 var proj = GetSelectedProject ( ) ;
11371150 // fix slashes so that it works in save dialogs
1138- copy = proj ? . Path . Replace ( '/' , '\\ ' ) ;
1151+ copy = proj ? . Path . Replace ( '/' , '\\ ' ) ;
11391152 }
11401153 if ( copy != null ) Clipboard . SetText ( copy ) ;
11411154 }
0 commit comments