mirror of
https://github.com/chylex/TweetDuck.git
synced 2025-05-01 08:34:11 +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 => {
|
}, ex => {
|
||||||
if (!ignoreUpdateCheckError){
|
if (!ignoreUpdateCheckError){
|
||||||
Program.Reporter.HandleException("Update Check Error", "An error occurred while checking for updates.", true, ex);
|
Program.Reporter.HandleException("Update Check Error", "An error occurred while checking for updates.", true, ex);
|
||||||
|
|
||||||
ignoreUpdateCheckError = true;
|
|
||||||
updates.StartTimer();
|
updates.StartTimer();
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
ignoreUpdateCheckError = true;
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -274,7 +274,7 @@ private void updates_UpdateAccepted(object sender, UpdateEventArgs e){
|
|||||||
UpdateInstallerPath = update.InstallerPath;
|
UpdateInstallerPath = update.InstallerPath;
|
||||||
ForceClose();
|
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);
|
BrowserUtils.OpenExternalBrowser(Program.Website);
|
||||||
ForceClose();
|
ForceClose();
|
||||||
}
|
}
|
||||||
|
@ -22,6 +22,7 @@ private void btnCancel_Click(object sender, EventArgs e){
|
|||||||
private void timerDownloadCheck_Tick(object sender, EventArgs e){
|
private void timerDownloadCheck_Tick(object sender, EventArgs e){
|
||||||
if (updateInfo.DownloadStatus.IsFinished()){
|
if (updateInfo.DownloadStatus.IsFinished()){
|
||||||
timerDownloadCheck.Stop();
|
timerDownloadCheck.Stop();
|
||||||
|
DialogResult = DialogResult.OK;
|
||||||
Close();
|
Close();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -2,9 +2,10 @@
|
|||||||
public enum UpdateDownloadStatus{
|
public enum UpdateDownloadStatus{
|
||||||
None = 0,
|
None = 0,
|
||||||
InProgress,
|
InProgress,
|
||||||
|
Canceled,
|
||||||
AssetMissing,
|
AssetMissing,
|
||||||
Done,
|
Failed,
|
||||||
Failed
|
Done
|
||||||
}
|
}
|
||||||
|
|
||||||
public static class UpdateDownloadStatusExtensions{
|
public static class UpdateDownloadStatusExtensions{
|
||||||
|
@ -101,6 +101,10 @@ public void BeginUpdateDownload(Form ownerForm, UpdateInfo updateInfo, Action<Up
|
|||||||
};
|
};
|
||||||
|
|
||||||
downloadForm.FormClosed += (sender, args) => {
|
downloadForm.FormClosed += (sender, args) => {
|
||||||
|
if (downloadForm.DialogResult != DialogResult.OK){
|
||||||
|
updateInfo.CancelDownload();
|
||||||
|
}
|
||||||
|
|
||||||
downloadForm.Dispose();
|
downloadForm.Dispose();
|
||||||
onFinished(updateInfo);
|
onFinished(updateInfo);
|
||||||
};
|
};
|
||||||
|
@ -72,6 +72,11 @@ public void DeleteInstaller(){
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void CancelDownload(){
|
||||||
|
DeleteInstaller();
|
||||||
|
DownloadStatus = UpdateDownloadStatus.Canceled;
|
||||||
|
}
|
||||||
|
|
||||||
public override bool Equals(object obj){
|
public override bool Equals(object obj){
|
||||||
return obj is UpdateInfo info && VersionTag == info.VersionTag;
|
return obj is UpdateInfo info && VersionTag == info.VersionTag;
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user