ソースを参照

添加关闭打印进程处理类

章政 8 年 前
コミット
171162f0d8
1 ファイル変更23 行追加1 行削除
  1. 23 1
      UAS-MES/PublicMethod/BaseUtil.cs

+ 23 - 1
UAS-MES/PublicMethod/BaseUtil.cs

@@ -11,6 +11,7 @@ using System.Net.Sockets;
 using System.Reflection;
 using System.Text;
 using System.Text.RegularExpressions;
+using System.Threading;
 using System.Windows.Forms;
 using System.Windows.Forms.DataVisualization.Charting;
 using System.Xml;
@@ -125,7 +126,7 @@ namespace UAS_MES.PublicMethod
                     string controlName = collection[i].Name;
                     string controlsTag = collection[i].Tag == null ? "" : collection[i].Tag.ToString();
                     //默认给TextBox和Label赋值
-                    if (collection[i] is TextBox || collection[i] is Label || collection[i] is SearchTextBox || collection[i] is MaCodeSearchTextBox || collection[i] is EnterTextBox || collection[i] is TextBoxGeneratePaCode||collection[i] is NumericUpDown)
+                    if (collection[i] is TextBox || collection[i] is Label || collection[i] is SearchTextBox || collection[i] is MaCodeSearchTextBox || collection[i] is EnterTextBox || collection[i] is TextBoxGeneratePaCode || collection[i] is NumericUpDown)
                     {
                         for (int j = 0; j < dt.Columns.Count; j++)
                         {
@@ -1071,5 +1072,26 @@ namespace UAS_MES.PublicMethod
             reader.Close();
             doc.Save(Environment.GetEnvironmentVariable("windir").Substring(0, 1) + @":\Log\cacheInfo\cacheInfo.xml");
         }
+
+        public static void ClosePrint(ApplicationClass lbl)
+        {
+            lblpro = lbl;
+            Thread close = new Thread(ClosePrintProcess);
+            close.Start();
+        }
+
+        static ApplicationClass lblpro;
+
+        private static void ClosePrintProcess()
+        {
+            try
+            {
+                lblpro.Quit();
+            }
+            catch (Exception)
+            {
+
+            }
+        }
     }
 }