소스 검색

处理程序打开中未更新的情况

章政 7 년 전
부모
커밋
2bbb55af8e
1개의 변경된 파일16개의 추가작업 그리고 0개의 파일을 삭제
  1. 16 0
      UAS_AutoUpdate/CheckUpdateWindow.cs

+ 16 - 0
UAS_AutoUpdate/CheckUpdateWindow.cs

@@ -47,6 +47,22 @@ namespace UAS_AutoUpdate
             //进行版本的比较
             if (ver1 > ver2)
             {
+                Process[] pro = Process.GetProcessesByName("UAS_MES");
+                if (pro.Length > 0)
+                {
+                    string CloseProcess = MessageBox.Show(this.ParentForm, "当前程序仍在运行,是否关闭", "提示", MessageBoxButtons.YesNo, MessageBoxIcon.Question).ToString();
+                    if (CloseProcess == "Yes")
+                    {
+                        for (int i = 0; i < pro.Length; i++)
+                        {
+                            Process.GetProcessById(pro[i].Id).Kill();
+                        }
+                    }
+                    else
+                    {
+                        return;
+                    }
+                }
                 wc.DownloadProgressChanged += Wc_DownloadProgressChanged;
                 wc.DownloadFileAsync(new Uri(GetCacheData(ConfigFile, "UpdatePath").ToString()), "UAS_MES.zip");
                 SetCacheData(ConfigFile, "Version", ver1.ToString());