mirror of
https://github.com/chylex/TweetDuck.git
synced 2025-04-15 15:15:46 +02:00
Warn when checking updates outside TweetDeck & fix visual and unlikely issues
This commit is contained in:
parent
833e42f455
commit
b6cff40f1e
@ -163,6 +163,11 @@ private void btnCheckUpdates_Click(object sender, EventArgs e){
|
||||
|
||||
btnCheckUpdates.Enabled = false;
|
||||
updateCheckEventId = updates.Check(true);
|
||||
|
||||
if (updateCheckEventId == UpdateHandler.CheckCodeNotOnTweetDeck){
|
||||
FormMessage.Error("Update Check", "Updates can only be checked once TweetDeck is fully loaded.", FormMessage.OK);
|
||||
btnCheckUpdates.Enabled = true;
|
||||
}
|
||||
}
|
||||
|
||||
private void updates_CheckFinished(object sender, UpdateEventArgs e){
|
||||
|
@ -300,6 +300,13 @@
|
||||
});
|
||||
};
|
||||
|
||||
//
|
||||
// Block: Check updates on startup.
|
||||
//
|
||||
$(document).one("TD.ready", function(){
|
||||
$TDU.triggerUpdateCheck();
|
||||
});
|
||||
|
||||
//
|
||||
// Block: Setup global functions.
|
||||
//
|
||||
|
@ -8,6 +8,9 @@
|
||||
|
||||
namespace TweetDuck.Updates{
|
||||
sealed class UpdateHandler{
|
||||
public const int CheckCodeUpdatesDisabled = -1;
|
||||
public const int CheckCodeNotOnTweetDeck = -2;
|
||||
|
||||
private readonly ITweetDeckBrowser browser;
|
||||
private readonly UpdaterSettings settings;
|
||||
|
||||
@ -15,7 +18,7 @@ sealed class UpdateHandler{
|
||||
public event EventHandler<UpdateEventArgs> UpdateDismissed;
|
||||
public event EventHandler<UpdateEventArgs> CheckFinished;
|
||||
|
||||
private int lastEventId;
|
||||
private ushort lastEventId;
|
||||
private UpdateInfo lastUpdateInfo;
|
||||
|
||||
public UpdateHandler(ITweetDeckBrowser browser, UpdaterSettings settings){
|
||||
@ -28,7 +31,6 @@ public UpdateHandler(ITweetDeckBrowser browser, UpdaterSettings settings){
|
||||
|
||||
private void OnFrameLoaded(IFrame frame){
|
||||
ScriptLoader.ExecuteFile(frame, "update.js");
|
||||
Check(false);
|
||||
}
|
||||
|
||||
public int Check(bool force){
|
||||
@ -36,12 +38,16 @@ public int Check(bool force){
|
||||
if (force){
|
||||
settings.DismissedUpdate = null;
|
||||
}
|
||||
|
||||
if (!browser.IsTweetDeckWebsite){
|
||||
return CheckCodeNotOnTweetDeck;
|
||||
}
|
||||
|
||||
browser.ExecuteFunction("TDUF_runUpdateCheck", ++lastEventId, Program.VersionTag, settings.DismissedUpdate ?? string.Empty, settings.AllowPreReleases);
|
||||
browser.ExecuteFunction("TDUF_runUpdateCheck", (int)unchecked(++lastEventId), Program.VersionTag, settings.DismissedUpdate ?? string.Empty, settings.AllowPreReleases);
|
||||
return lastEventId;
|
||||
}
|
||||
|
||||
return 0;
|
||||
return CheckCodeUpdatesDisabled;
|
||||
}
|
||||
|
||||
public void BeginUpdateDownload(Form ownerForm, UpdateInfo updateInfo, Action<UpdateInfo> onSuccess){
|
||||
|
Loading…
Reference in New Issue
Block a user