Browse Source

轴方向验证增加读取过程

cxs 1 year ago
parent
commit
20570df4cf
1 changed files with 54 additions and 5 deletions
  1. 54 5
      OTSSysMgrApp/ControllerSettingForm.cs

+ 54 - 5
OTSSysMgrApp/ControllerSettingForm.cs

@@ -141,9 +141,9 @@ namespace OTSSysMgrApp
             Control.CheckForIllegalCrossThreadCalls = false;
             ddlDwellTime.SelectedIndex = 2;
             InitXRayData();
-            int width=Convert.ToInt32( tbRWidth.Text);
-            int height =Convert.ToInt32(tbRHeight.Text);
-            m_EDSHardwareMgr = EDSController.GetEDSController(width,height,5000);
+            int width = Convert.ToInt32(tbRWidth.Text);
+            int height = Convert.ToInt32(tbRHeight.Text);
+            m_EDSHardwareMgr = EDSController.GetEDSController(width, height, 5000);
 
             cb_Xdirection.Items.Add("LEFT_TOWARD");
             cb_Xdirection.Items.Add("RIGHT_TOWARD");
@@ -153,8 +153,28 @@ namespace OTSSysMgrApp
             cb_imageresolution.Items.Add("1024*768");
             cb_imageresolution.Items.Add("1024*704");
             cb_imageresolution.Items.Add("1536*1024");
-            cb_Xdirection.SelectedIndex = 0;
-            cb_Ydirection.SelectedIndex = 0;
+            string xmlpath = Application.StartupPath + @"\Config\SysData\OTSProgMgrParam.pmf";
+            string xAxisDir = "";
+            string yAxisDir = "";
+            string scanFieldSize = "";
+            ReadConfigXml(xmlpath, ref xAxisDir, ref yAxisDir, ref scanFieldSize);
+            if (xAxisDir.Split(':')[1] == "LEFT_TOWARD")
+            {
+                cb_Xdirection.SelectedIndex = 0;
+            }
+            else
+            {
+                cb_Xdirection.SelectedIndex = 1;
+            }
+            if (yAxisDir.Split(':')[1] == "UP_TOWARD")
+            {
+                cb_Ydirection.SelectedIndex = 0;
+            }
+            else
+            {
+                cb_Ydirection.SelectedIndex = 1;
+            }
+            tB_scanFieldSize100.Text = scanFieldSize;
             cb_imageresolution.SelectedIndex = 0;
         }
 
@@ -1293,6 +1313,35 @@ namespace OTSSysMgrApp
                 btn_continuousshot.Refresh();
             }
         }
+
+        bool ReadConfigXml(string xmlpath,ref string xAxisDir,ref string yAxisDir,ref string scanFieldSize)
+        {
+            try
+            {
+                XmlDocument xmlDocument = new XmlDocument();
+                xmlDocument.Load(xmlpath);
+                XmlNodeList nodeList = xmlDocument.SelectSingleNode("XMLData").ChildNodes;
+
+                foreach (XmlNode xn in nodeList)
+                {
+                    XmlElement xe = (XmlElement)xn;
+                    if (xe.GetAttribute("RegName") == "StageData")
+                    {
+                        scanFieldSize=xe.GetAttribute("scanFieldSize");
+                        xAxisDir=xe.GetAttribute("xAxisDir");
+                        yAxisDir=xe.GetAttribute("yAxisDir");
+                        break;
+                    }
+                }
+            }
+            catch (Exception ex)
+            {
+                MessageBox.Show(ex.ToString());
+                return false;
+            }
+            return true;
+        }
+
         bool SaveConfigXml(string xmlpath, string xAxisDir, string yAxisDir, string scanFieldSize)
         {
             try