Commit 6fe49ab4 authored by 段廷瑞's avatar 段廷瑞

1、更新日期记录逻辑优化

parent 0922e5ac
...@@ -24,8 +24,15 @@ namespace Tools ...@@ -24,8 +24,15 @@ namespace Tools
Application.EnableVisualStyles(); Application.EnableVisualStyles();
Application.SetCompatibleTextRenderingDefault(false); Application.SetCompatibleTextRenderingDefault(false);
bool isUpdated = args.Length > 0 && args[0] == "1"; //自动更新重启后,记录更新日期
Application.Run(new wMain(isUpdated)); if (args.Length > 0 && args[0] == "1")
{
var m = Utils.GetJsonConfig<LoginMemory>();
m.UpdateTime = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss.fff");
Utils.SaveJsonConfig(m);
}
Application.Run(new wMain());
} }
//UI未处理异常 //UI未处理异常
......
...@@ -32,20 +32,14 @@ namespace Tools ...@@ -32,20 +32,14 @@ namespace Tools
/// 数据库访问对象 /// 数据库访问对象
/// </summary> /// </summary>
DBHelper _db = null; DBHelper _db = null;
/// <summary>
/// 是否更新后启动
/// </summary>
bool IsUpdated = false;
public wMain(bool isUpdated) public wMain()
{ {
InitializeComponent(); InitializeComponent();
//基础属性设置 //基础属性设置
this.IsMdiContainer = true; this.IsMdiContainer = true;
//重置窗体大小 //重置窗体大小
this.SetWinMinimized(); this.SetWinMinimized();
//
this.IsUpdated = isUpdated;
//窗体基本事件 //窗体基本事件
this.Load += WMain_Load; this.Load += WMain_Load;
this.Shown += WMain_Shown; this.Shown += WMain_Shown;
...@@ -269,13 +263,6 @@ namespace Tools ...@@ -269,13 +263,6 @@ namespace Tools
private void CheckUpdate(bool IsSilentWhenNotFound = false) private void CheckUpdate(bool IsSilentWhenNotFound = false)
{ {
var m = Utils.GetJsonConfig<LoginMemory>(); var m = Utils.GetJsonConfig<LoginMemory>();
//更新后打开,记录更新日期,并返回
if (IsUpdated)
{
m.UpdateTime = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss.fff");
Utils.SaveJsonConfig(m);
return;
}
//检查更新 //检查更新
var updateTime = m.UpdateTime; var updateTime = m.UpdateTime;
var dt =this._db.GetDataTable($"SELECT TOP 1 UDate, URemark FROM dbo.FTT_AutoUpdate WHERE UDate > '{updateTime}' ORDER BY UDate DESC", "FTT_AutoUpdate"); var dt =this._db.GetDataTable($"SELECT TOP 1 UDate, URemark FROM dbo.FTT_AutoUpdate WHERE UDate > '{updateTime}' ORDER BY UDate DESC", "FTT_AutoUpdate");
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment