9
9
using System . IO ;
10
10
using System . Runtime . InteropServices ;
11
11
using System . Threading ;
12
+ using System . Threading . Tasks ;
12
13
using System . Windows ;
13
14
using System . Windows . Controls ;
14
15
using System . Windows . Data ;
@@ -352,7 +353,7 @@ void AddUnityInstallationRootFolder()
352
353
}
353
354
354
355
// waits for unity update results and assigns to datagrid
355
- async void CallGetUnityUpdates ( )
356
+ async Task CallGetUnityUpdates ( )
356
357
{
357
358
dataGridUpdates . ItemsSource = null ;
358
359
var task = GetUnityUpdates . Scan ( ) ;
@@ -364,6 +365,32 @@ async void CallGetUnityUpdates()
364
365
dataGridUpdates . ItemsSource = updatesSource ;
365
366
}
366
367
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
+
367
394
void RefreshRecentProjects ( )
368
395
{
369
396
// clear search
@@ -636,6 +663,8 @@ private void MenuItemCopyVersion_Click(object sender, RoutedEventArgs e)
636
663
637
664
private void BtnRefreshProjectList_Click ( object sender , RoutedEventArgs e )
638
665
{
666
+ // we want to refresh unity installs also, to make sure version colors are correct
667
+ UpdateUnityInstallationsList ( ) ;
639
668
RefreshRecentProjects ( ) ;
640
669
}
641
670
@@ -686,27 +715,11 @@ private void BtnReleaseNotes_Click(object sender, RoutedEventArgs e)
686
715
687
716
private void BtnUpdateUnity_Click ( object sender , RoutedEventArgs e )
688
717
{
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 ( ) ;
708
719
}
709
720
721
+
722
+
710
723
// if press up/down in search box, move to first item in results
711
724
private void TxtSearchBox_PreviewKeyDown ( object sender , KeyEventArgs e )
712
725
{
@@ -1135,7 +1148,7 @@ private void MenuItemCopyPath_Click(object sender, RoutedEventArgs e)
1135
1148
{
1136
1149
var proj = GetSelectedProject ( ) ;
1137
1150
// fix slashes so that it works in save dialogs
1138
- copy = proj ? . Path . Replace ( '/' , '\\ ' ) ;
1151
+ copy = proj ? . Path . Replace ( '/' , '\\ ' ) ;
1139
1152
}
1140
1153
if ( copy != null ) Clipboard . SetText ( copy ) ;
1141
1154
}
0 commit comments