mirror of
https://github.com/chylex/TweetDuck.git
synced 2025-04-22 00:15:48 +02:00
Fix wrong behavior when an update is canceled during download & multiple check errors in some cases
This commit is contained in:
parent
b6c17eb05e
commit
06bd65b7f8
@ -250,11 +250,11 @@ private void updates_CheckFinished(object sender, UpdateCheckEventArgs e){
|
||||
}, ex => {
|
||||
if (!ignoreUpdateCheckError){
|
||||
Program.Reporter.HandleException("Update Check Error", "An error occurred while checking for updates.", true, ex);
|
||||
|
||||
ignoreUpdateCheckError = true;
|
||||
updates.StartTimer();
|
||||
}
|
||||
});
|
||||
|
||||
ignoreUpdateCheckError = true;
|
||||
});
|
||||
}
|
||||
|
||||
@ -274,7 +274,7 @@ private void updates_UpdateAccepted(object sender, UpdateEventArgs e){
|
||||
UpdateInstallerPath = update.InstallerPath;
|
||||
ForceClose();
|
||||
}
|
||||
else if (FormMessage.Error("Update Has Failed", "Could not automatically download the update: "+(update.DownloadError?.Message ?? "unknown error")+"\n\nWould you like to open the website and try downloading the update manually?", FormMessage.Yes, FormMessage.No)){
|
||||
else if (status != UpdateDownloadStatus.Canceled && FormMessage.Error("Update Has Failed", "Could not automatically download the update: "+(update.DownloadError?.Message ?? "unknown error")+"\n\nWould you like to open the website and try downloading the update manually?", FormMessage.Yes, FormMessage.No)){
|
||||
BrowserUtils.OpenExternalBrowser(Program.Website);
|
||||
ForceClose();
|
||||
}
|
||||
|
@ -22,6 +22,7 @@ private void btnCancel_Click(object sender, EventArgs e){
|
||||
private void timerDownloadCheck_Tick(object sender, EventArgs e){
|
||||
if (updateInfo.DownloadStatus.IsFinished()){
|
||||
timerDownloadCheck.Stop();
|
||||
DialogResult = DialogResult.OK;
|
||||
Close();
|
||||
}
|
||||
}
|
||||
|
@ -2,9 +2,10 @@
|
||||
public enum UpdateDownloadStatus{
|
||||
None = 0,
|
||||
InProgress,
|
||||
Canceled,
|
||||
AssetMissing,
|
||||
Done,
|
||||
Failed
|
||||
Failed,
|
||||
Done
|
||||
}
|
||||
|
||||
public static class UpdateDownloadStatusExtensions{
|
||||
|
@ -101,6 +101,10 @@ public void BeginUpdateDownload(Form ownerForm, UpdateInfo updateInfo, Action<Up
|
||||
};
|
||||
|
||||
downloadForm.FormClosed += (sender, args) => {
|
||||
if (downloadForm.DialogResult != DialogResult.OK){
|
||||
updateInfo.CancelDownload();
|
||||
}
|
||||
|
||||
downloadForm.Dispose();
|
||||
onFinished(updateInfo);
|
||||
};
|
||||
|
@ -72,6 +72,11 @@ public void DeleteInstaller(){
|
||||
}
|
||||
}
|
||||
|
||||
public void CancelDownload(){
|
||||
DeleteInstaller();
|
||||
DownloadStatus = UpdateDownloadStatus.Canceled;
|
||||
}
|
||||
|
||||
public override bool Equals(object obj){
|
||||
return obj is UpdateInfo info && VersionTag == info.VersionTag;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user