Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
F
Ftt_Common
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Administrator
Ftt_Common
Commits
78db6e2a
Commit
78db6e2a
authored
Feb 10, 2022
by
段廷瑞
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
1、自动更新:逻辑优化
parent
a5c81d7c
Changes
4
Show whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
27 additions
and
16 deletions
+27
-16
links.xml
AppHome/config/links.xml
+6
-0
Form1.cs
AutoUpdate/Form1.cs
+1
-0
Program.cs
Tools/Program.cs
+4
-2
wMain.cs
Tools/wMain.cs
+16
-14
No files found.
AppHome/config/links.xml
View file @
78db6e2a
...
...
@@ -144,4 +144,10 @@
<UserId>
sa
</UserId>
<Pwd>
sa
</Pwd>
</links>
<links>
<Link>
119.190.10.248,1800
</Link>
<DbName>
FTT_U6
</DbName>
<UserId>
sa
</UserId>
<Pwd>
a*1
</Pwd>
</links>
</DocumentElement>
\ No newline at end of file
AutoUpdate/Form1.cs
View file @
78db6e2a
...
...
@@ -62,6 +62,7 @@ namespace AutoUpdate
ProcessStartInfo
info
=
new
ProcessStartInfo
()
{
FileName
=
startup
,
Arguments
=
"1"
,
UseShellExecute
=
false
,
RedirectStandardError
=
true
,
};
...
...
Tools/Program.cs
View file @
78db6e2a
...
...
@@ -16,14 +16,16 @@ namespace Tools
/// 应用程序的主入口点。
/// </summary>
[
STAThread
]
static
void
Main
()
static
void
Main
(
string
[]
args
)
{
Application
.
ThreadException
+=
Application_ThreadException
;
AppDomain
.
CurrentDomain
.
UnhandledException
+=
CurrentDomain_UnhandledException
;
Application
.
EnableVisualStyles
();
Application
.
SetCompatibleTextRenderingDefault
(
false
);
Application
.
Run
(
new
wMain
());
bool
isUpdated
=
args
.
Length
>
0
&&
args
[
0
]
==
"1"
;
Application
.
Run
(
new
wMain
(
isUpdated
));
}
//UI未处理异常
...
...
Tools/wMain.cs
View file @
78db6e2a
...
...
@@ -32,14 +32,20 @@ namespace Tools
/// 数据库访问对象
/// </summary>
DBHelper
_db
=
null
;
/// <summary>
/// 是否更新后启动
/// </summary>
bool
IsUpdated
=
false
;
public
wMain
()
public
wMain
(
bool
isUpdated
)
{
InitializeComponent
();
//基础属性设置
this
.
IsMdiContainer
=
true
;
//重置窗体大小
this
.
SetWinMinimized
();
//
this
.
IsUpdated
=
isUpdated
;
//窗体基本事件
this
.
Load
+=
WMain_Load
;
this
.
Shown
+=
WMain_Shown
;
...
...
@@ -263,6 +269,14 @@ namespace Tools
private
void
CheckUpdate
(
bool
IsSilentWhenNotFound
=
false
)
{
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
dt
=
this
.
_db
.
GetDataTable
(
$"SELECT TOP 1 UDate, URemark FROM dbo.FTT_AutoUpdate WHERE UDate > '
{
updateTime
}
' ORDER BY UDate DESC"
,
"FTT_AutoUpdate"
);
if
(
dt
.
DefaultView
.
Count
>
0
)
...
...
@@ -279,19 +293,7 @@ namespace Tools
RedirectStandardError
=
true
,
};
//启动更新程序
Task
.
Run
(()
=>
new
Process
()
{
StartInfo
=
info
}.
Start
())
.
ContinueWith
((
x
)
=>
{
if
(
x
.
IsCompleted
&&
x
.
Exception
==
null
)
{
var
date
=
Convert
.
ToDateTime
(
drv
[
"UDate"
]);
m
.
UpdateTime
=
date
.
ToString
(
"yyyy-MM-dd HH:mm:ss.fff"
);
Utils
.
SaveJsonConfig
(
m
);
}
else
{
Utils
.
Tip
(
x
.
Exception
.
Message
);
}
});
Task
.
Run
(()
=>
new
Process
()
{
StartInfo
=
info
}.
Start
());
//退出运行环境
Application
.
Exit
();
}
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment