fix: remove unnecessary _app.Invoke calls around update progress dialog updates

This commit is contained in:
Stone_Red
2026-04-20 17:41:22 +02:00
committed by HueByte
parent 6dbc29818c
commit 5b8df9d505
+10 -16
View File
@@ -71,7 +71,7 @@ public sealed class UpdateChecker : IDisposable
// Create backup before the update starts // Create backup before the update starts
try try
{ {
_app.Invoke(() => _progressDialog?.UpdateProgress(0f, "Creating backup...")); _progressDialog?.UpdateProgress(0f, "Creating backup...");
UpdateBackupService.CreateBackup(); UpdateBackupService.CreateBackup();
} }
catch (Exception ex) catch (Exception ex)
@@ -79,27 +79,21 @@ public sealed class UpdateChecker : IDisposable
Log.Error(ex, "Failed to create pre-update backup"); Log.Error(ex, "Failed to create pre-update backup");
var proceed = false; var proceed = false;
_app.Invoke(() => proceed = MessageBox.Query(
{ _app,
proceed = MessageBox.Query( "Backup Warning",
_app, $"Could not create backup: {ex.Message}\n\nContinue update without backup?",
"Backup Warning", "Continue", "Cancel") == 0;
$"Could not create backup: {ex.Message}\n\nContinue update without backup?",
"Continue", "Cancel") == 0;
});
if (!proceed) if (!proceed)
{ {
_app.Invoke(() => _progressDialog?.Close();
{ _progressDialog = null;
_progressDialog?.Close();
_progressDialog = null;
});
return; return;
} }
} }
_app.Invoke(() => _progressDialog?.UpdateProgress(0f, "Downloading update...")); _progressDialog?.UpdateProgress(0f, "Downloading update...");
await _updater.UpdateAsync(); await _updater.UpdateAsync();
}); });
@@ -118,7 +112,7 @@ public sealed class UpdateChecker : IDisposable
statusText = $"{step}..."; statusText = $"{step}...";
} }
_app.Invoke(() => _progressDialog?.UpdateProgress(fraction, statusText)); _progressDialog?.UpdateProgress(fraction, statusText);
} }
private void OnUpdateStarted(string version) private void OnUpdateStarted(string version)