mirror of
https://github.com/ShareX/ShareX.git
synced 2024-10-01 09:47:22 +13:00
ShareX will check for updates every hour
This commit is contained in:
parent
13814e350e
commit
a134dea59e
5 changed files with 34 additions and 20 deletions
|
@ -30,6 +30,7 @@ public static class Links
|
|||
public const string URL_WEBSITE = "http://getsharex.com";
|
||||
public const string URL_PROJECT = "https://github.com/ShareX/ShareX";
|
||||
public const string URL_ISSUES = URL_PROJECT + "/issues";
|
||||
public const string URL_UPDATE = URL_WEBSITE + "/Update.xml";
|
||||
public const string URL_CALLBACK = URL_WEBSITE + "/callback/";
|
||||
public const string URL_VERSION_HISTORY = URL_PROJECT + "/wiki/Changelog";
|
||||
public const string URL_DONATE = "https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick&hosted_button_id=PCNWK2G6ZYJ2E";
|
||||
|
|
|
@ -32,6 +32,8 @@ namespace ShareX.HelpersLib
|
|||
{
|
||||
public partial class UpdateMessageBox : Form
|
||||
{
|
||||
public static bool IsOpen { get; private set; }
|
||||
|
||||
private Rectangle fillRect;
|
||||
|
||||
public UpdateMessageBox()
|
||||
|
@ -48,6 +50,10 @@ public UpdateMessageBox()
|
|||
public static void Start(UpdateChecker updateChecker)
|
||||
{
|
||||
if (updateChecker != null && updateChecker.Status == UpdateStatus.UpdateAvailable)
|
||||
{
|
||||
IsOpen = true;
|
||||
|
||||
try
|
||||
{
|
||||
DialogResult result;
|
||||
|
||||
|
@ -69,6 +75,11 @@ public static void Start(UpdateChecker updateChecker)
|
|||
}
|
||||
}
|
||||
}
|
||||
finally
|
||||
{
|
||||
IsOpen = false;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
protected override bool ShowWithoutActivation
|
||||
|
|
|
@ -46,9 +46,9 @@ public AboutForm()
|
|||
|
||||
uclUpdate.CheckUpdate(TaskHelpers.CheckUpdate);
|
||||
|
||||
rtbShareXInfo.Text = string.Format(@"{0}: http://getsharex.com
|
||||
{1}: https://github.com/ShareX/ShareX
|
||||
{2}: https://github.com/ShareX/ShareX/issues", Resources.AboutForm_AboutForm_Website, Resources.AboutForm_AboutForm_Project_page, Resources.AboutForm_AboutForm_Issues);
|
||||
rtbShareXInfo.Text = string.Format(@"{0}: {1}
|
||||
{2}: {3}
|
||||
{4}: {5}", Resources.AboutForm_AboutForm_Website, Links.URL_WEBSITE, Resources.AboutForm_AboutForm_Project_page, Links.URL_PROJECT, Resources.AboutForm_AboutForm_Issues, Links.URL_ISSUES);
|
||||
|
||||
rtbCredits.Text = string.Format(@"{0}:
|
||||
|
||||
|
|
|
@ -46,6 +46,7 @@ public partial class MainForm : HotkeyForm
|
|||
private bool forceClose;
|
||||
private UploadInfoManager uim;
|
||||
private ToolStripDropDownItem tsmiImageFileUploaders, tsmiTrayImageFileUploaders, tsmiTextFileUploaders, tsmiTrayTextFileUploaders;
|
||||
private System.Threading.Timer updateTimer;
|
||||
|
||||
public MainForm()
|
||||
{
|
||||
|
@ -650,19 +651,20 @@ private void UpdateUploaderMenuNames()
|
|||
|
||||
private void AutoCheckUpdate()
|
||||
{
|
||||
if (Program.Settings.AutoCheckUpdate)
|
||||
if (Program.Settings.AutoCheckUpdate && updateTimer == null)
|
||||
{
|
||||
Thread updateThread = new Thread(CheckUpdate);
|
||||
updateThread.IsBackground = true;
|
||||
updateThread.Start();
|
||||
updateTimer = new System.Threading.Timer(state => CheckUpdate(), null, 0, 1000 * 60 * 60);
|
||||
}
|
||||
}
|
||||
|
||||
private void CheckUpdate()
|
||||
{
|
||||
if (!UpdateMessageBox.IsOpen)
|
||||
{
|
||||
UpdateChecker updateChecker = TaskHelpers.CheckUpdate();
|
||||
UpdateMessageBox.Start(updateChecker);
|
||||
}
|
||||
}
|
||||
|
||||
private void ForceClose()
|
||||
{
|
||||
|
|
|
@ -411,7 +411,7 @@ public static UpdateChecker CheckUpdate()
|
|||
// Fallback if GitHub API fails
|
||||
if (updateChecker.Status == UpdateStatus.None || updateChecker.Status == UpdateStatus.UpdateCheckFailed)
|
||||
{
|
||||
updateChecker = new XMLUpdateChecker("http://getsharex.com/Update.xml", "ShareX");
|
||||
updateChecker = new XMLUpdateChecker(Links.URL_UPDATE, "ShareX");
|
||||
updateChecker.IsBeta = Program.IsBeta;
|
||||
updateChecker.Proxy = ProxyInfo.Current.GetWebProxy();
|
||||
updateChecker.CheckUpdate();
|
||||
|
|
Loading…
Reference in a new issue