Jelajahi Sumber

使用Task运行进程通讯,并且修改OTA请求的参数。

jianfeng1.wang 2 tahun lalu
induk
melakukan
d08041746a
1 mengubah file dengan 20 tambahan dan 17 penghapusan
  1. 20 17
      FactoryTool_CShare/Views/Login.cs

+ 20 - 17
FactoryTool_CShare/Views/Login.cs

@@ -12,6 +12,7 @@ using System.Net;
 using System.Net.Security;
 using System.Security.Cryptography.X509Certificates;
 using System.Text;
+using System.Threading.Tasks;
 using System.Windows.Forms;
 using Utils;
 
@@ -197,26 +198,28 @@ namespace MOKA_Factory_Tools
             #endregion
 
             #region 进程通信
-            // 启动服务;
-            ProcUtils.StartService("FTYService");
-            if (Utils.ProcUtils.IsServiceStart("FTYService"))
-            {
-                PipeClient client = new PipeClient("MOKA_FTYService", "127.0.0.1");
-                if (client != null)
+            Task.Run(() =>
+            {// 启动服务;
+                ProcUtils.StartService("FTYService");
+                if (Utils.ProcUtils.IsServiceStart("FTYService"))
                 {
-                    client.SendData(new ToolInfo()
+                    PipeClient client = new PipeClient("MOKA_FTYService", "127.0.0.1");
+                    if (client != null)
                     {
-                        appName = "SCBC Factory Tools",
-                        devicemodel = "SCBC Factory Tools",
-                        dnum = loginOutput1.factorynum,
-                        factoryname = loginOutput1.factoryname,
-                        procName = Application.ProductName,
-                        toolPath = AppDomain.CurrentDomain.BaseDirectory,
-                        toolVersion = Utils.FileUtils.GetAssemblyVersion(),
-                        type = "pc"
-                    }, 0);
+                        client.SendData(new ToolInfo()
+                        {
+                            appName = "MOKA_Factory_Tools",
+                            devicemodel = "MOKA_Factory_Tools",
+                            dnum = loginOutput1.factorynum,
+                            factoryname = loginOutput1.factoryname,
+                            procName = Application.ProductName,
+                            toolPath = AppDomain.CurrentDomain.BaseDirectory,
+                            toolVersion = Utils.FileUtils.GetAssemblyVersion(),
+                            type = "pc"
+                        }, 0);
+                    }
                 }
-            }
+            });
             #endregion
 
             CommonMethod.FactoryName = loginOutput1.factoryname;