Parcourir la source

添加Utils类库和NamePipeClient类库,在登录时与服务进程通信。

jianfeng1.wang il y a 2 ans
Parent
commit
b2c6edac7b

+ 8 - 3
FactoryTool_CShare/MOKA Factory Tools.csproj

@@ -86,9 +86,11 @@
       <SpecificVersion>False</SpecificVersion>
       <HintPath>Lib\CSkin\CSkin.dll</HintPath>
     </Reference>
-    <Reference Include="Newtonsoft.Json, Version=6.0.0.0, Culture=neutral, PublicKeyToken=30ad4fe6b2a6aeed, processorArchitecture=MSIL">
-      <SpecificVersion>False</SpecificVersion>
-      <HintPath>Lib\Newtonsoft.Json\Newtonsoft.Json.dll</HintPath>
+    <Reference Include="NamePipeClient">
+      <HintPath>..\..\NamePipeClient\NamePipeClient\bin\Release\NamePipeClient.dll</HintPath>
+    </Reference>
+    <Reference Include="Newtonsoft.Json, Version=13.0.0.0, Culture=neutral, PublicKeyToken=30ad4fe6b2a6aeed, processorArchitecture=MSIL">
+      <HintPath>packages\Newtonsoft.Json.13.0.3\lib\net45\Newtonsoft.Json.dll</HintPath>
     </Reference>
     <Reference Include="System" />
     <Reference Include="System.Configuration" />
@@ -108,6 +110,9 @@
     <Reference Include="System.Drawing" />
     <Reference Include="System.Windows.Forms" />
     <Reference Include="System.Xml" />
+    <Reference Include="Utils">
+      <HintPath>..\..\Utils\Utils\bin\Release\Utils.dll</HintPath>
+    </Reference>
   </ItemGroup>
   <ItemGroup>
     <Compile Include="BLL\NTFBLL.cs" />

+ 26 - 0
FactoryTool_CShare/Views/Login.cs

@@ -1,4 +1,6 @@
 using CCWin;
+using NamePipeClient;
+using NamePipeClient.Model;
 using Newtonsoft.Json;
 using Newtonsoft.Json.Linq;
 using SufeiUtil;
@@ -11,6 +13,7 @@ using System.Net.Security;
 using System.Security.Cryptography.X509Certificates;
 using System.Text;
 using System.Windows.Forms;
+using Utils;
 
 namespace MOKA_Factory_Tools
 {
@@ -193,6 +196,29 @@ 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)
+                {
+                    client.SendData(new ToolInfo()
+                    {
+                        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);
+                }
+            }
+            #endregion
+
             CommonMethod.FactoryName = loginOutput1.factoryname;
             UpgradeMsgList upgradeMsgList = new UpgradeMsgList();
             var FactoryNum = loginOutput1.factorynum;

+ 1 - 0
FactoryTool_CShare/packages.config

@@ -1,5 +1,6 @@
 <?xml version="1.0" encoding="utf-8"?>
 <packages>
+  <package id="Newtonsoft.Json" version="13.0.3" targetFramework="net48" />
   <package id="Stub.System.Data.SQLite.Core.NetFramework" version="1.0.115.5" targetFramework="net48" />
   <package id="System.Data.SQLite.Core" version="1.0.115.5" targetFramework="net48" />
 </packages>