1备货调整 2在线升级调整

This commit is contained in:
wule committed 2025-07-14 19:05:52 +08:00
1 parent dd52c9b2d3
commit fef54e1f0f
13 files changed
+290 -182

No files matched your search

+22 -1
View File
@@ -31,13 +31,14 @@ namespace Update
SetFormRoundRectRgn(this, 7);
SetFormRoundRectRgn(panel2, 7);
SetFormRoundRectRgn(this.btnOk, 7);
SetFormRoundRectRgn(this.btnCancel, 7);
}
private void btnOk_Click(object sender, EventArgs e)
{
if (lblMessage.Text == "升级完成,点击确定重启程序")
{
string extPath = System.Environment.CurrentDirectory + "\\" + Program.softName;
string extPath = System.Environment.CurrentDirectory + "\\" + Program.softName.Replace(".exe", "") + ".exe";
System.Diagnostics.Process.Start(extPath);
Application.Exit();
return;
@@ -73,6 +74,16 @@ namespace Update
string tempFile = upTempPath + "\\" + Program.updateUrl.Substring(Program.updateUrl.LastIndexOf("/") + 1);
bool result = Program.DownloadFile(Program.updateUrl, tempFile);
while (true)
{
Invoke(new Action(() =>
{
progressBar1.Value = Program.progress;
}));
if (Program.progress == 100)
break;
}
if (result)
{
ZipFile.ExtractToDirectory(tempFile, upTempPath);
@@ -110,6 +121,7 @@ namespace Update
Thread.Sleep(50);
Invoke(new Action(() =>
{
progressBar1.Value = 100;
lblMessage.Text = "升级完成,点击确定重启程序";
btnOk.Enabled = true;
}));
@@ -118,6 +130,7 @@ namespace Update
{
Invoke(new Action(() =>
{
progressBar1.Value = 100;
this.lblMessage.Text = "升级失败,未获取到升级文件";
btnOk.Enabled = true;
}));
@@ -204,10 +217,18 @@ namespace Update
private void CloseMainProgram()
{
string in_sAppName = Program.softName; //(一个word文档程序)
in_sAppName = in_sAppName.Replace(".exe", "");
try
{
System.Diagnostics.Process[] psiNewcas = System.Diagnostics.Process.GetProcessesByName(in_sAppName);
//System.Diagnostics.Process.GetProcessesByName("");
//var pro = System.Diagnostics.Process.GetProcesses();
//foreach(var p in pro)
//{
// Console.WriteLine(p.ProcessName);
//}
foreach (System.Diagnostics.Process p in psiNewcas)
{