diff --git a/App.config b/App.config
index a0e6050..faec5df 100644
--- a/App.config
+++ b/App.config
@@ -66,7 +66,7 @@
-
+
diff --git a/GeekDesk.csproj b/GeekDesk.csproj
index 8f452c5..d546ec0 100644
--- a/GeekDesk.csproj
+++ b/GeekDesk.csproj
@@ -294,7 +294,7 @@
-
+
diff --git a/MainWindow.xaml.cs b/MainWindow.xaml.cs
index 49fceaa..a356536 100644
--- a/MainWindow.xaml.cs
+++ b/MainWindow.xaml.cs
@@ -366,8 +366,8 @@ namespace GeekDesk
FileWatcher.EnableLinkMenuWatcher(appData);
- //更新线程开启 检测更新
- UpdateThread.Update();
+ //更新任务开启 检测更新
+ UpdateTask.Start();
//建立相对路径
RelativePathThread.MakeRelativePath();
diff --git a/MyThread/UpdateThread.cs b/Task/UpdateTask.cs
similarity index 61%
rename from MyThread/UpdateThread.cs
rename to Task/UpdateTask.cs
index fd1dbb2..1da3586 100644
--- a/MyThread/UpdateThread.cs
+++ b/Task/UpdateTask.cs
@@ -4,47 +4,47 @@ using GeekDesk.Util;
using GeekDesk.ViewModel;
using Newtonsoft.Json.Linq;
using System;
+using System.Collections.Generic;
using System.Configuration;
-using System.Threading;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
-namespace GeekDesk.MyThread
+namespace GeekDesk.Task
{
- public class UpdateThread
+ internal class UpdateTask
{
+
private static AppConfig appConfig = MainWindow.appData.AppConfig;
- public static void Update()
+ public static void Start()
{
- System.Threading.Thread t = new System.Threading.Thread(new ThreadStart(UpdateApp))
+ System.Timers.Timer timer = new System.Timers.Timer
{
- IsBackground = true
+ Enabled = true,
+ Interval = 60 * 1000 * 60 * 12, //60秒 * 60分钟 * 12
+ //Interval = 6000,
};
- t.Start();
+ timer.Start();
+ timer.Elapsed += Timer_Elapsed; ;
}
- private static void UpdateApp()
+ private static void Timer_Elapsed(object sender, System.Timers.ElapsedEventArgs e)
{
try
{
-
- //等待1分钟后再检查更新 有的网络连接过慢
- int sleepTime = 60 * 1000;
- if (Constants.DEV)
- {
- sleepTime = 1;
- }
-
- System.Threading.Thread.Sleep(sleepTime);
-
- string updateUrl;
+ string updateUrl = ConfigurationManager.AppSettings["GiteeUpdateUrl"];
string nowVersion = ConfigurationManager.AppSettings["Version"];
- switch (appConfig.UpdateType)
+ if (appConfig != null)
{
- case UpdateType.GitHub:
- updateUrl = ConfigurationManager.AppSettings["GitHubUpdateUrl"];
- break;
- default:
- updateUrl = ConfigurationManager.AppSettings["GiteeUpdateUrl"];
- break;
+ switch (appConfig.UpdateType)
+ {
+ case UpdateType.GitHub:
+ updateUrl = ConfigurationManager.AppSettings["GitHubUpdateUrl"];
+ break;
+ default:
+ updateUrl = ConfigurationManager.AppSettings["GiteeUpdateUrl"];
+ break;
+ }
}
string updateInfo = HttpUtil.Get(updateUrl);
if (!StringUtil.IsEmpty(updateInfo))
@@ -63,9 +63,10 @@ namespace GeekDesk.MyThread
HttpUtil.Get(statisticUrl);
}
}
- } catch (Exception){}
+ }
+ catch (Exception) { }
+
-
string onlineVersion = jo["version"].ToString();
if (onlineVersion.CompareTo(nowVersion) > 0)
diff --git a/Update.json b/Update.json
index 45b404b..96fd8c4 100644
--- a/Update.json
+++ b/Update.json
@@ -2,7 +2,7 @@
"title": "GeekDesk版本更新",
"subTitle": "V2.5.15",
"msgTitle": "本次更新内容如下",
- "msg": "['鸽了挺久, 我终于又来更新了, 废话不多说, 看下本次更新内容', '增加多文件备份, 数据文件损坏会自动寻找最近的一次备份数据, 不用担心数据文件损坏了, 备份数据默认为最近7天, 可以通过打开根目录下GeekDesk.exe.config, 找到BakDays修改', '修复高分屏缩放导致的鼠标追随bug', 'UI假死的情况, 由于并不是每个用户都出现这个bug, 这次做了尝试性修复, 各位可以看下是否还会出现切换菜单出现不会出现图标的情况']",
+ "msg": "['鸽了挺久, 我终于又来更新了, 废话不多说, 看下本次更新内容, 没有点star的记得给我star哦^_^', '增加多文件备份, 数据文件损坏会自动寻找最近的一次备份数据, 不用担心数据文件损坏了, 备份数据默认为最近7天, 可以通过打开根目录下GeekDesk.exe.config, 找到BakDays修改', '修复多块屏幕下高分屏缩放比例不同导致的鼠标追随bug, 显示时可以正确的追随鼠标位置了', '修复多块屏幕下高分屏缩放比例不同导致的拾色器bug, 可以正常拾色了', '另外UI假死的情况, 由于并不是每个用户都出现这个bug, 这次做了尝试性修复, 各位可以看下是否还会出现切换菜单出现不会出现图标的情况', '其它优化']",
"githubUrl": "https://github.com/BookerLiu/GeekDesk/releases",
"giteeUrl": "https://gitee.com/BookerLiu/GeekDesk/releases",
"statisticUrl": "http://43.138.23.39:8989/bookerService/geekDeskController/userCountStatistic",