Skip to content

Commit 9efe410

Browse files
committed
update editors and updates list up to date after installing editor update
1 parent f2fc7fa commit 9efe410

File tree

2 files changed

+15
-10
lines changed

2 files changed

+15
-10
lines changed

UnityLauncherPro/MainWindow.xaml.cs

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -864,7 +864,7 @@ private void SaveSettingsOnExit()
864864
File.Copy(FullFileName, FullFileName + ".bak", true);
865865
}
866866

867-
void UpdateUnityInstallationsList()
867+
public void UpdateUnityInstallationsList()
868868
{
869869
// Reset preferred string, if user changed it
870870
//preferredVersion = "none";
@@ -935,7 +935,7 @@ void AddUnityInstallationRootFolder()
935935
}
936936

937937
// waits for unity update results and assigns to datagrid
938-
async Task CallGetUnityUpdates()
938+
public async Task CallGetUnityUpdates()
939939
{
940940
dataGridUpdates.ItemsSource = null;
941941
var task = GetUnityUpdates.FetchAll((bool)useUnofficialReleaseList.IsChecked);
@@ -1105,7 +1105,6 @@ private void OnGetUnityUpdatesClick(object sender, RoutedEventArgs e)
11051105
// clear filters, since right now they are not used after updates are loaded
11061106
rdoAll.IsChecked = true;
11071107
CallGetUnityUpdates();
1108-
11091108
button.IsEnabled = true;
11101109
}
11111110

UnityLauncherPro/Tools.cs

Lines changed: 13 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -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

Comments
 (0)