@@ -754,7 +754,6 @@ public static async void DownloadAndInstall(string version)
754754 string unityHash = ParseHashCodeFromURL ( downloadURL ) ;
755755 exeURL = ParseDownloadURLFromWebpage ( version , unityHash , false , true ) ;
756756 }
757-
758757 }
759758
760759 Console . WriteLine ( "download exeURL= (" + exeURL + ")" ) ;
@@ -787,19 +786,19 @@ public static async void DownloadAndInstall(string version)
787786 process . StartInfo . FileName = tempFile ;
788787 process . StartInfo . Arguments = targetPathArgs ;
789788 process . EnableRaisingEvents = true ;
790- process . Exited += ( sender , e ) => DeleteTempFile ( tempFile ) ;
789+ process . Exited += ( sender , e ) => InstallationCompleted ( tempFile ) ;
791790 process . Start ( ) ;
792791 }
793792 catch ( Win32Exception ex ) when ( ex . NativeErrorCode == 1223 ) // ERROR_CANCELLED
794793 {
795794 // User declined the UAC prompt
796795 Console . WriteLine ( "User cancelled elevation (UAC)." ) ;
797- DeleteTempFile ( tempFile ) ;
796+ InstallationCompleted ( tempFile ) ;
798797 }
799798 catch ( Exception ex )
800799 {
801800 Console . WriteLine ( "Failed to run exe: " + tempFile + " - " + ex . Message ) ;
802- DeleteTempFile ( tempFile ) ;
801+ InstallationCompleted ( tempFile ) ;
803802 }
804803
805804 // TODO refresh upgrade dialog after installer finished
@@ -893,12 +892,19 @@ public static async Task DownloadInitScript(string currentInitScriptFullPath, st
893892 }
894893 }
895894
896- static void DeleteTempFile ( string path )
895+ static void InstallationCompleted ( string path )
897896 {
898897 if ( File . Exists ( path ) == true )
899898 {
900- Console . WriteLine ( "DeleteTempFile: " + path ) ;
899+ // delete temp installer file
901900 File . Delete ( path ) ;
901+
902+ // refresh installed versions list
903+ mainWindow . Dispatcher . Invoke ( ( ) =>
904+ {
905+ mainWindow . UpdateUnityInstallationsList ( ) ;
906+ mainWindow . CallGetUnityUpdates ( ) ;
907+ } ) ;
902908 }
903909 }
904910
@@ -2722,7 +2728,7 @@ private static async Task<bool> DownloadFileAsync(string fileUrl, string destina
27222728 {
27232729 if ( ! result )
27242730 {
2725- DeleteTempFile ( destinationPath ) ;
2731+ InstallationCompleted ( destinationPath ) ;
27262732 }
27272733 progressWindow . Close ( ) ;
27282734 }
0 commit comments