Delay running update check. Move Uri object

This commit is contained in:
Travis Nickles 2018-12-29 01:20:33 -06:00
parent 6ed165c29f
commit 795754b480

View File

@ -288,16 +288,6 @@ namespace DS4Windows
nUDUpdateTime.Value = checkwhen;
}
Uri url = new Uri("https://raw.githubusercontent.com/Ryochan7/DS4Windows/jay/DS4Windows/newest.txt"); // Sorry other devs, gonna have to find your own server
if (checkwhen > 0 && DateTime.Now >= LastChecked + TimeSpan.FromHours(checkwhen))
{
WebClient wc = new WebClient();
wc.DownloadFileAsync(url, appdatapath + "\\version.txt");
wc.DownloadFileCompleted += (sender, e) => { TaskRunner.Run(() => Check_Version(sender, e)); };
LastChecked = DateTime.Now;
}
if (File.Exists(exepath + "\\Updater.exe"))
{
Thread.Sleep(2000);
@ -402,6 +392,19 @@ namespace DS4Windows
TaskRunner.Delay(50).ContinueWith((t) =>
{
if (checkwhen > 0 && DateTime.Now >= LastChecked + TimeSpan.FromHours(checkwhen))
{
this.BeginInvoke((System.Action)(() =>
{
// Sorry other devs, gonna have to find your own server
Uri url = new Uri("https://raw.githubusercontent.com/Ryochan7/DS4Windows/jay/DS4Windows/newest.txt");
WebClient wc = new WebClient();
wc.DownloadFileAsync(url, appdatapath + "\\version.txt");
wc.DownloadFileCompleted += (sender, e) => { TaskRunner.Run(() => Check_Version(sender, e)); };
LastChecked = DateTime.Now;
}));
}
UpdateTheUpdater();
});