浏览代码

fix bugs when apply the new ipc tech

gsp 3 年之前
父节点
当前提交
103ed4e47f

+ 5 - 5
Bin/x64/Debug/Config/ProData/ReportTemplateConfig.xml

@@ -1,17 +1,17 @@
 <XmlConfig>
   <M_SY>
-    <str_tb_ZBT>Cleanliness Analysis</str_tb_ZBT>
-    <str_tb_FBT>欧波同中国</str_tb_FBT>
+    <str_tb_ZBT>Inclusions Analysis </str_tb_ZBT>
+    <str_tb_FBT>XXXXXXCompany</str_tb_FBT>
     <str_tb_YPBH>0001</str_tb_YPBH>
-    <str_tb_CKBZ>GB/T30834-2014</str_tb_CKBZ>
+    <str_tb_CKBZ>VDA19 ISO16232</str_tb_CKBZ>
     <b_ck_ypsm>True</b_ck_ypsm>
     <b_ck_jggk>True</b_ck_jggk>
   </M_SY>
   <M_YMYJ>
-    <str_tb_ymwb>颗粒分析报告</str_tb_ymwb>
+    <str_tb_ymwb>Inclusion Analysis </str_tb_ymwb>
     <str_tb_KHH>Copi0000123012</str_tb_KHH>
     <b_ck_ym>True</b_ck_ym>
-    <str_tb_yjwb>颗粒分析报告</str_tb_yjwb>
+    <str_tb_yjwb>Inclusion Analysis </str_tb_yjwb>
   </M_YMYJ>
   <M_KLFXJG>
     <b_ck_klcc_xsmk>True</b_ck_klcc_xsmk>

+ 1 - 1
Bin/x64/Debug/Config/SysData/OTSProgMgrParam - 副本.pmf

@@ -1,5 +1,5 @@
 <?xml version="1.0" encoding="UTF-8"?>
-<XMLData RunMode="professional" Modes="professional,Plain" SysType="CleannessA" SysTypes="IncA,Cleanness">
+<XMLData RunMode="professional" Modes="professional,Plain" SysType="CleanlinessA" SysTypes="IncA,CleanlinessA">
   <Member RegName="GenParam" DefaultArea="100" DefaultSampleName="Sample" DefaultShape="0" MeasParamFileFolderName=".\Config\ProData\" MeasSwitch="true" PartSTDLibFolderName=".\Config\SysData\" PropertyDisplayMode="0" StdLibFileName="NoSTDDB" StdLibTypeIndex="0" SteelTechnology="0" UseSysSTD="true" />
   <Member RegName="ImageProcParam" m_autoBGRemoveType="0" m_BGRemoveType="1">
     <Member RegName="BGGray" end="255" start="150" />

+ 1 - 15
Bin/x64/Debug/Config/SysData/OTSStage.stg

@@ -1,5 +1,5 @@
 <?xml version="1.0" encoding="UTF-8"?>
-<XMLData Modify="true" PathName=".\Config\SysData\OTSStage.stg" WorkingStageId="3">
+<XMLData Modify="true" PathName=".\Config\SysData\OTSStage.stg" WorkingStageId="1">
   <Collection RegName="Stagelist">
     <Member strName="圆形九圆孔50mm">
       <Member RegName="boundary" PolygonPoint="" rectDomian="0,0,50000,0" shape="0" />
@@ -41,19 +41,5 @@
         <Member HoleName="4" rectDomian="-25000,-25000,40000,0" shape="0" />
       </Collection>
     </Member>
-    <Member strName="Axia75">
-      <Member RegName="boundary" PolygonPoint="" rectDomian="0,0,75000,0" shape="0" />
-      <Member RegName="std" PolygonPoint="" rectDomian="0,31000,10,0" shape="0" />
-      <Collection RegName="Holes">
-        <Member HoleName="1" rectDomian="0,0,47000,0" shape="0" />
-      </Collection>
-    </Member>
-    <Member strName="Coxem35">
-      <Member RegName="boundary" PolygonPoint="" rectDomian="0,0,35000,35000" shape="1" />
-      <Member RegName="std" PolygonPoint="" rectDomian="11000,11000,1,1" shape="1" />
-      <Collection RegName="Holes">
-        <Member HoleName="1" rectDomian="0,0,20000,0" shape="0" />
-      </Collection>
-    </Member>
   </Collection>
 </XMLData>

+ 8 - 0
OTSCPP/OTSClrInterface/ControlClr/OTSControlFunExport.h

@@ -101,6 +101,14 @@ namespace OTSCLRINTERFACE
 				return true;
 			}
 			BOOL bRev = m_pSem->Connect();
+			if (bRev)
+			{
+				if (ScanInit() && EDSInit())
+				{
+					return true;
+				}
+				
+			}
 			return bRev;
 		}
 		bool DisconnectSem()

+ 7 - 7
OTSIncAMeasureApp/Program.cs

@@ -13,13 +13,13 @@ namespace OTSMeasureApp
         static void Main()
         {
             //判断是否有授权
-            var reg = new CRegistration();
-            if (!reg.RegistrationVerification())
-            {
-                MessageBox.Show("Error: missing authorization");
-                System.Environment.Exit(0);
-                return;
-            }
+            //var reg = new CRegistration();
+            //if (!reg.RegistrationVerification())
+            //{
+            //    MessageBox.Show("Error: missing authorization");
+            //    System.Environment.Exit(0);
+            //    return;
+            //}
             //--------------------------只运行一个测量程序--------------------------------
 
             bool flag = false;

+ 2 - 2
OTSIncAReportApp/1-UI/Control_Graph/OTSIncAReportGraphFuncation/OTSImageDisHelp.cs

@@ -74,7 +74,7 @@ namespace OTSIncAReportGraph.OTSIncAReportGraphFuncation
     
 
         //电镜设置对象
-        public  ServiceInterface.SemController m_cfun = null;
+        public  ServiceInterface.HardwareController m_cfun = null;
 
         //是否已经连接到了电镜
         public bool m_SEMConnectionState = false;
@@ -93,7 +93,7 @@ namespace OTSIncAReportGraph.OTSIncAReportGraphFuncation
 
             m_original_list_baseobject = new List<BaseObject>();
             resultFile = result;
-            m_cfun =new ServiceInterface.SemController();
+            m_cfun = ServiceInterface.HardwareController.GetSemController();
             log = NLog.LogManager.GetCurrentClassLogger();
         }
 

+ 2 - 2
OTSIncAReportApp/1-UI/Control_Grids/OTSIncAReportGridsFuncation/OTSReportGridsFun.cs

@@ -33,7 +33,7 @@ namespace OTSIncAReportGrids.OTSIncAReportGridsFuncation
         Hashtable table;
 
         OTSIncAReportApp.frmReportApp m_frmReportApp = null;
-        public SemController m_cfun = null;
+        public HardwareController m_cfun = null;
 
         #endregion
 
@@ -52,7 +52,7 @@ namespace OTSIncAReportGrids.OTSIncAReportGridsFuncation
 
             m_frmReportApp = in_frmReportApp;
 
-            m_cfun = new SemController();//  It's better to reinitialize, but it's not good to uninitialize
+            m_cfun = HardwareController.GetSemController();//  It's better to reinitialize, but it's not good to uninitialize
 
         }
 

+ 27 - 11
OTSIncAReportApp/3-ServiceCenter/SemController.cs → OTSIncAReportApp/3-ServiceCenter/HardwareController.cs

@@ -12,13 +12,23 @@ using OTSMeasureApp.ServiceCenter;
 
 namespace ServiceInterface
 {
-    public class SemController 
+    public class HardwareController 
     {
        
         //[DllImport("user32.dll", EntryPoint = "SendMessage")]
         //private static extern int SendMessage(IntPtr hwnd, int wMsg, int wParam, int lParam);
         private IpcSEMController remoteObj;
-        public SemController()
+        private bool ifConnect = false;
+        static HardwareController sem = null;
+       public static HardwareController GetSemController()
+        {
+            if (sem == null)
+            {
+                sem = new HardwareController();
+            }
+            return sem;
+        }
+        private HardwareController()
         {
        
          
@@ -27,22 +37,28 @@ namespace ServiceInterface
 
         public bool Connect()
         {
-            IpcClientChannel channel = new IpcClientChannel();
-            //Register the channel with ChannelServices.
-            ChannelServices.RegisterChannel(channel, false);
-            remoteObj = (IpcSEMController)Activator.GetObject(typeof(IpcSEMController), "ipc://ServerChannel/RemoteObject");
-   
-            if (remoteObj == null)
+            if (!ifConnect)
             {
-                return false;
-            
+                IpcClientChannel channel = new IpcClientChannel();
+                //Register the channel with ChannelServices.
+                ChannelServices.RegisterChannel(channel, false);
+                remoteObj = (IpcSEMController)Activator.GetObject(typeof(IpcSEMController), "ipc://ServerChannel/RemoteObject");
+
+                if (remoteObj == null)
+                {
+                    return false;
+
+                }
+
+                ifConnect = true;
             }
+           
             return true;
         }
 
         public bool DisConnect()
         {
-            remoteObj = null;
+            //remoteObj = null;
 
             return true;
         }

+ 1 - 1
OTSIncAReportApp/OTSIncAReportApp.csproj

@@ -528,7 +528,7 @@
     <Compile Include="1-UI\OutputNlog.Designer.cs">
       <DependentUpon>OutputNlog.cs</DependentUpon>
     </Compile>
-    <Compile Include="3-ServiceCenter\SemController.cs" />
+    <Compile Include="3-ServiceCenter\HardwareController.cs" />
     <Compile Include="Help.cs">
       <SubType>Form</SubType>
     </Compile>