Эх сурвалжийг харах

测试是否可以打印的进程在测试后关闭

章政 8 жил өмнө
parent
commit
bb7945f506
1 өөрчлөгдсөн 6 нэмэгдсэн , 6 устгасан
  1. 6 6
      UAS-MES/Main.cs

+ 6 - 6
UAS-MES/Main.cs

@@ -83,7 +83,7 @@ namespace UAS_MES
         private void Main_Load(object sender, EventArgs e)
         {
             //杀死全部未关闭的打印进程
-            string[] lines = System.IO.File.ReadAllLines(SystemInf.CacheFolder+ "lblprocess.txt");
+            string[] lines = System.IO.File.ReadAllLines(SystemInf.CacheFolder + "lblprocess.txt");
             foreach (string line in lines)
             {
                 if (line != "")
@@ -93,7 +93,7 @@ namespace UAS_MES
                     try
                     {
                         if (System.Diagnostics.Process.GetProcessById(int.Parse(processid)).ProcessName != System.Diagnostics.Process.GetCurrentProcess().ProcessName)
-                            System.Diagnostics.Process.GetProcessById(int.Parse(lblid)).Kill();   
+                            System.Diagnostics.Process.GetProcessById(int.Parse(lblid)).Kill();
                     }
                     catch (Exception)
                     {
@@ -104,18 +104,18 @@ namespace UAS_MES
                         catch (Exception)
                         {
                         }
-                        FileStream fs = new FileStream(SystemInf.CacheFolder+ "lblprocess.txt", FileMode.Open, FileAccess.Read);
+                        FileStream fs = new FileStream(SystemInf.CacheFolder + "lblprocess.txt", FileMode.Open, FileAccess.Read);
                         StreamReader sr = new StreamReader(fs);
                         String s = sr.ReadToEnd();
                         sr.Close();
                         fs.Close();
                         FileStream fas = new FileStream(SystemInf.CacheFolder + "lblprocess.txt", FileMode.Create, FileAccess.ReadWrite);
                         StreamWriter sw = new StreamWriter(fas);
-                        sw.Write(s.Replace(line+"\r\n",""));
+                        sw.Write(s.Replace(line + "\r\n", ""));
                         sw.Flush();
                         sw.Close();
                         fas.Close();
-                    }              
+                    }
                 }
             }
             thread = new Thread(DeleteLog);
@@ -153,7 +153,7 @@ namespace UAS_MES
             {
                 ApplicationClass lbl = new ApplicationClass();
                 SystemInf.EnablePrint = true;
-                BaseUtil.WriteLbl(lbl);
+                lbl.Quit();
             }
             catch (Exception)
             {