Prechádzať zdrojové kódy

using short connection mode instead of long connection mode.

shiyanshi 3 rokov pred
rodič
commit
e8d5beb5c4

+ 1 - 1
OTSIncAMeasureApp/0-OTSModel/Measure/1-OTSInclution/SmplMeasureInclution.cs

@@ -162,7 +162,7 @@ namespace OTSModelSharp
             // get x-ray parameters
             COTSXRayParam pXRayParam = m_Sample.GetMsrParams().GetXRayParam();
 
-
+           
 
             var listAnalysisparts = curFldData.ListAnalysisParticles;
 

+ 2 - 0
OTSIncAMeasureApp/0-OTSModel/Measure/GetBSEPic/CMsrThread.cs

@@ -164,6 +164,8 @@ namespace OTSModelSharp
             MsrMsg.STMThreadStu.csMsrEndTime = timeEnd.ToShortDateString();
           
             ProgressEvent(MsrMsg);
+            //disconnect the semcontroller when we exit this task.
+            m_SemController.DisConnect();
         }
         void SetWorkingFolderStr()
         {

+ 12 - 10
OTSIncAMeasureApp/4-OTSSamplespaceGraphicsPanel/OTSSamplespaceWindow.cs

@@ -3575,8 +3575,8 @@ namespace OTSMeasureApp
                     CMStrip.Items[(int)MenuIndex.SetSemData].Enabled = true;
                     
                 }
-              
-              
+
+                m_SEMDATAFieldManage.CloseSEM();
             }
            
             #endregion
@@ -3928,6 +3928,7 @@ namespace OTSMeasureApp
                 {
                     return true;
                 }
+                m_SEMDATAFieldManage.CloseSEM();
             }
             return false;
             #endregion
@@ -3949,8 +3950,8 @@ namespace OTSMeasureApp
                 //放大倍数
                 magnification = semParameters[0];
                 WorkingDistance = semParameters[1];
-           
-               
+
+                m_SEMDATAFieldManage.CloseSEM();
                 return true;
             }
             return false;
@@ -4041,7 +4042,7 @@ namespace OTSMeasureApp
                 {
                      bret = m_SEMDATAFieldManage.SetSEMCurrentLocation(m_MouseDownLocation, m_RectangleGDIObjects, m_OTSSampleStageData, IsWidth, Width, Height);
 
-                  
+                m_SEMDATAFieldManage.CloseSEM();
                 }
            
                 return bret;
@@ -4066,9 +4067,10 @@ namespace OTSMeasureApp
                 {
                     bret = (m_SEMDATAFieldManage.DriveSEMToLocation(m_MouseDownLocation, m_RectangleGDIObjects, m_SingleGDIObjects, m_OTSSampleStageData, IsWidth, Width, Height));
 
-              
-                       
-                    
+
+                    m_SEMDATAFieldManage.CloseSEM();
+
+
                 }
                 return bret;
             }
@@ -4096,8 +4098,8 @@ namespace OTSMeasureApp
                 if (m_SEMDATAFieldManage.InitAndConnection())
                 {
                      bret = m_SEMDATAFieldManage.GetSemLocation(ref SemLocation);
-                    
-                   
+
+                m_SEMDATAFieldManage.CloseSEM();
 
                 }
             return bret;

+ 14 - 14
OTSIncAMeasureApp/4-OTSSamplespaceGraphicsPanel/SEMDATAFieldManage.cs

@@ -80,22 +80,22 @@ namespace OTSMeasureApp
         }
         #endregion
 
- 
+
 
         #region 关闭电镜连接
-        //public bool CloseSEM()
-        //{
-        //    try
-        //    {
-        //        cSemfun.DisConnect();
-        //        return true;
-        //    }
-        //    catch (Exception ex)
-        //    {
-        //        log.Error("CloseSEM:--Error:" + ex.ToString() + "");
-        //        return false;
-        //    }
-        //}
+        public bool CloseSEM()
+        {
+            try
+            {
+                cSemfun.DisConnect();
+                return true;
+            }
+            catch (Exception ex)
+            {
+                log.Error("CloseSEM:--Error:" + ex.ToString() + "");
+                return false;
+            }
+        }
         #endregion
 
         #region 获取放大倍数

+ 1 - 1
OTSIncAMeasureApp/5-OTSMeasureStatuImageFun/OTSBSEImageFun.cs

@@ -220,7 +220,7 @@ namespace OTSMeasureApp
             finally
             {
                 //cfun.ScanFinishedInstance();
-                //cfun.DisConnectSem();
+                cfun.DisconnectSem();
                 //cfun.FreeHardware();
             }
 

+ 3 - 3
OTSIncAMeasureApp/5-OTSMeasureStatuImageFun/OTSMeasureStatusWindow.cs

@@ -1559,11 +1559,11 @@ namespace OTSMeasureApp
 
                 try
                 {
-                    //cfun.DisConnectSem();
+                    cfun.DisconnectSem();
                     //cfun.FreeHardware();
 
-                    
-                    log.Trace("-------释放单击采集对象------");
+
+                    log.Trace("-------释放controller对象------");
                 }
                 catch (Exception)
                 {

+ 1 - 3
OTSIncAMeasureApp/OTSIncAMeasureAppForm.cs

@@ -209,9 +209,7 @@ namespace OTSMeasureApp
 
         private void rbReport_Click(object sender, EventArgs e)
         {
-            //打开报告之前先关闭电镜连接
-            var sem = NSOTSController.COTSControlFunExport.GetControllerInstance();
-            sem.DisconnectSem();
+           
             //测量结果文件路径列表
             List<string> mrFilePathList = new List<string>();
 

+ 1 - 0
OTSIncAMeasureApp/ServiceCenter/EDSController.cs

@@ -24,6 +24,7 @@ namespace OTSModelSharp.ServiceInterface
         {
          
             eds = SemController.hw;
+            Init();
         }
 
 

+ 3 - 3
OTSIncAReportApp/Control_Graph/Controls/Control_DrawDistrbutionImageAndBSE.cs

@@ -1419,12 +1419,12 @@ namespace OTSIncAReportGraph.Controls
 
                 }
 
-                Thread.Sleep(500);
+                Thread.Sleep(1500);
 
                 //第三步,断开电镜连接
-                //m_OTSIncAReportFun.DisConnectSEM();
+                m_OTSIncAReportFun.DisConnectSEM();
 
-                Thread.Sleep(1000);
+                //Thread.Sleep(1000);
 
                 m_mythread_state = false;
             }

+ 3 - 3
OTSIncAReportApp/Control_Graph/Controls/Control_DrawDistrbutionSortImage.cs

@@ -1142,12 +1142,12 @@ namespace OTSIncAReportGraph.Controls
                     m_OTSIncAReportFun.MoveSemToPointXY(sem_point.X, sem_point.Y);
                 }
 
-                Thread.Sleep(500);
+                Thread.Sleep(1500);
 
                 //第三步,断开电镜连接
-                //m_OTSIncAReportFun.DisConnectSEM();
+                m_OTSIncAReportFun.DisConnectSEM();
 
-                Thread.Sleep(1000);
+                //Thread.Sleep(1000);
 
                 m_mythread_state = false;
             }

+ 13 - 8
OTSIncAReportApp/Control_Graph/OTSIncAReportGraphFuncation/OTSIncAReportFun.cs

@@ -406,15 +406,19 @@ namespace OTSIncAReportGraph.OTSIncAReportGraphFuncation
                 //断开电镜连接
             }
         }
+        public void DisConnectSEM()
+        {
+            m_SEMConnectionState = false;
+            m_cfun.DisConnect();
+        }
 
-      
 
-        /// <summary>
-        /// 移动电镜到指定的X,Y坐标上,R坐标使用原先的值进行移动
-        /// </summary>
-        /// <param name="PositionX"></param>
-        /// <param name="PositionY"></param>
-        public void MoveSemToPointXY(double in_PositionX, double in_PositionY)
+            /// <summary>
+            /// 移动电镜到指定的X,Y坐标上,R坐标使用原先的值进行移动
+            /// </summary>
+            /// <param name="PositionX"></param>
+            /// <param name="PositionY"></param>
+            public void MoveSemToPointXY(double in_PositionX, double in_PositionY)
         {
             
             log.Trace("Begin MoveSemToPointXY:(" +in_PositionX.ToString()+","+in_PositionY.ToString()+")");
@@ -430,7 +434,8 @@ namespace OTSIncAReportGraph.OTSIncAReportGraphFuncation
             }
             else
             {
-                log.Error("Failed to MoveSemToPointXY" );
+                log.Error("Failed to GetSemPositionXY");
+                return;
             }
 
             if (m_SEMConnectionState)

+ 5 - 5
OTSIncAReportApp/Control_Grids/ParticlesGridDevidePage.cs

@@ -193,7 +193,7 @@ namespace OTSIncAReportGrids
             //string str2 = "加载颗粒列表,开始从底层加载数据....";
             //str2 = table["str2"].ToString();
             //m_frm_userprogress.SetProgressValueAndText(1, str2);
-            m_OTSIncAReportGridsFun = new OTSIncAReportGridsFun(m_ReportApp, this);
+    
             //初始化底层操作类
             m_OTSIncAReportGridsFun = new OTSIncAReportGridsFun(m_ReportApp, this);
 
@@ -971,16 +971,16 @@ namespace OTSIncAReportGrids
                 //第二步,移动到指定位置,先读取再设置
                 if (m_OTSIncAReportGridsFun.m_SEMConnectionState == true)
                 {
-                    //m_OTSIncAReportGridsFun.MoveSemToPointXY_ForParticlesGrid(sem_point.X, sem_point.Y);
-                    bool MoveFlag = m_OTSIncAReportGridsFun.m_cfun.SetSemPositionXY(sem_point.X, sem_point.Y, 0);
+                    m_OTSIncAReportGridsFun.MoveSemToPointXY_ForParticlesGrid(sem_point.X, sem_point.Y);
+                
                 }
 
-                Thread.Sleep(500);
+                Thread.Sleep(1500);
 
                 //第三步,断开电镜连接
                 m_OTSIncAReportGridsFun.DisConnectSEM_ForParticlesGrid();
 
-                Thread.Sleep(1000);
+                //Thread.Sleep(500);
 
                 m_mythread_state = false;
             }

+ 1 - 1
OTSPartA_STDEditor/Form_STDConstantsEditor.cs

@@ -3524,7 +3524,7 @@ namespace OTSPartA_STDEditor
             {
                 if (null == m_cfun)
                 {
-                    m_cfun = new COTSControlFunExport();
+                    m_cfun = COTSControlFunExport.GetControllerInstance();
                 }
                 if (ConnectionSem(connectionEnumType.EDSOnlyPointXRay))
                 {

+ 1 - 1
OTSPartA_STDEditor/STDEditor.cs

@@ -523,7 +523,7 @@ namespace OTSPartA_STDEditor
             {
                 if (null == m_cfun)
                 {
-                    m_cfun = new COTSControlFunExport();
+                    m_cfun = COTSControlFunExport.GetControllerInstance();
                 }
                 if (ConnectionSem(connectionEnumType.EDSOnlyPointXRay))
                 {

+ 1 - 1
OTSPartA_STDEditor/XrayContrastForm.cs

@@ -669,7 +669,7 @@ namespace OTSPartA_STDEditor
             {
                 if (null == m_cfun)
                 {
-                    m_cfun = new COTSControlFunExport();
+                    m_cfun = COTSControlFunExport.GetControllerInstance();
                 }
                 if (ConnectionSem(connectionEnumType.EDSOnlyPointXRay))
                 {

+ 4 - 4
OTSSysMgrApp/ControllerSettingForm.cs

@@ -358,7 +358,7 @@ namespace OTSSysMgrApp
                 //EDS过程结束
                 //cfun.EDSFinishedInstance();
                 //关闭连接
-                //DisConnectSem(connectionEnumType.EDSOnlyPointXRay);
+                DisConnectSem(connectionEnumType.EDSOnlyPointXRay);
             }
         }
 
@@ -931,7 +931,7 @@ namespace OTSSysMgrApp
                 //EDS过程结束
                 //cfun.EDSFinishedInstance();
                 //关闭连接
-                //DisConnectSem(connectionEnumType.EDSMultiPointXRay);
+                DisConnectSem(connectionEnumType.EDSMultiPointXRay);
             }
         }
         private void btnAreaRay_Click(object sender, EventArgs e)
@@ -1005,7 +1005,7 @@ namespace OTSSysMgrApp
                 //EDS过程结束
                 //cfun.EDSFinishedInstance();
                 //关闭连接
-                //DisConnectSem(connectionEnumType.EDSAreaXRay);
+                DisConnectSem(connectionEnumType.EDSAreaXRay);
             }
         }
         private void btnClearData_Click(object sender, EventArgs e)
@@ -1137,7 +1137,7 @@ namespace OTSSysMgrApp
                 //EDS过程结束
                 //cfun.EDSFinishedInstance();
                 //关闭连接
-                //DisConnectSem(connectionEnumType.EDSAreaXRay);
+                DisConnectSem(connectionEnumType.EDSAreaXRay);
             }
         }
         #endregion