Browse Source

debug measure thread,save a measure file

HaoShuang 5 năm trước cách đây
mục cha
commit
236213d582

+ 300 - 9
HOZProject/FormMeasureTest.Designer.cs

@@ -1,4 +1,7 @@
-namespace HOZProject
+using System.Drawing;
+using System.Windows.Forms;
+
+namespace HOZProject
 {
     partial class FormMeasureTest
     {
@@ -28,23 +31,52 @@
         /// </summary>
         private void InitializeComponent()
         {
+            System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle1 = new System.Windows.Forms.DataGridViewCellStyle();
             this.NewMeasureFile = new System.Windows.Forms.Button();
             this.LoadCutHole = new System.Windows.Forms.Button();
+            this.CutHoleGridView = new System.Windows.Forms.DataGridView();
+            this.Name = new System.Windows.Forms.DataGridViewTextBoxColumn();
+            this.X = new System.Windows.Forms.DataGridViewTextBoxColumn();
+            this.Y = new System.Windows.Forms.DataGridViewTextBoxColumn();
+            this.Z = new System.Windows.Forms.DataGridViewTextBoxColumn();
+            this.M = new System.Windows.Forms.DataGridViewTextBoxColumn();
+            this.R = new System.Windows.Forms.DataGridViewTextBoxColumn();
+            this.T = new System.Windows.Forms.DataGridViewTextBoxColumn();
+            this.IsPTcheckBox = new System.Windows.Forms.CheckBox();
+            this.SampleNametextBox = new System.Windows.Forms.TextBox();
+            this.SampleNameLabel = new System.Windows.Forms.Label();
+            this.groupBox1 = new System.Windows.Forms.GroupBox();
+            this.ManualFocuscheckBox = new System.Windows.Forms.CheckBox();
+            this.button2 = new System.Windows.Forms.Button();
+            this.button1 = new System.Windows.Forms.Button();
+            this.FIBTemptextBox = new System.Windows.Forms.TextBox();
+            this.label1 = new System.Windows.Forms.Label();
+            this.button3 = new System.Windows.Forms.Button();
+            this.button4 = new System.Windows.Forms.Button();
+            this.button5 = new System.Windows.Forms.Button();
+            this.button6 = new System.Windows.Forms.Button();
+            this.groupBox2 = new System.Windows.Forms.GroupBox();
+            this.groupBox3 = new System.Windows.Forms.GroupBox();
+            this.textBox1 = new System.Windows.Forms.TextBox();
+            ((System.ComponentModel.ISupportInitialize)(this.CutHoleGridView)).BeginInit();
+            this.groupBox1.SuspendLayout();
+            this.groupBox2.SuspendLayout();
+            this.groupBox3.SuspendLayout();
             this.SuspendLayout();
             // 
             // NewMeasureFile
             // 
-            this.NewMeasureFile.Location = new System.Drawing.Point(29, 23);
+            this.NewMeasureFile.Location = new System.Drawing.Point(19, 30);
             this.NewMeasureFile.Name = "NewMeasureFile";
-            this.NewMeasureFile.Size = new System.Drawing.Size(136, 35);
+            this.NewMeasureFile.Size = new System.Drawing.Size(147, 35);
             this.NewMeasureFile.TabIndex = 1;
-            this.NewMeasureFile.Text = "新建测量文件";
+            this.NewMeasureFile.Text = "新建";
             this.NewMeasureFile.UseVisualStyleBackColor = true;
             this.NewMeasureFile.Click += new System.EventHandler(this.button1_Click);
             // 
             // LoadCutHole
             // 
-            this.LoadCutHole.Location = new System.Drawing.Point(199, 23);
+            this.LoadCutHole.Location = new System.Drawing.Point(21, 29);
             this.LoadCutHole.Name = "LoadCutHole";
             this.LoadCutHole.Size = new System.Drawing.Size(147, 35);
             this.LoadCutHole.TabIndex = 2;
@@ -52,21 +84,280 @@
             this.LoadCutHole.UseVisualStyleBackColor = true;
             this.LoadCutHole.Click += new System.EventHandler(this.LoadCutHole_Click);
             // 
+            // CutHoleGridView
+            // 
+            dataGridViewCellStyle1.BackColor = System.Drawing.Color.Beige;
+            dataGridViewCellStyle1.Font = new System.Drawing.Font("Verdana", 8F, System.Drawing.FontStyle.Bold);
+            this.CutHoleGridView.ColumnHeadersDefaultCellStyle = dataGridViewCellStyle1;
+            this.CutHoleGridView.ColumnHeadersHeightSizeMode = System.Windows.Forms.DataGridViewColumnHeadersHeightSizeMode.AutoSize;
+            this.CutHoleGridView.Columns.AddRange(new System.Windows.Forms.DataGridViewColumn[] {
+            this.Name,
+            this.X,
+            this.Y,
+            this.Z,
+            this.M,
+            this.R,
+            this.T});
+            this.CutHoleGridView.Location = new System.Drawing.Point(29, 367);
+            this.CutHoleGridView.Name = "CutHoleGridView";
+            this.CutHoleGridView.ReadOnly = true;
+            this.CutHoleGridView.RowTemplate.Height = 30;
+            this.CutHoleGridView.Size = new System.Drawing.Size(745, 144);
+            this.CutHoleGridView.TabIndex = 3;
+            // 
+            // Name
+            // 
+            this.Name.Name = "Name";
+            this.Name.ReadOnly = true;
+            // 
+            // X
+            // 
+            this.X.Name = "X";
+            this.X.ReadOnly = true;
+            // 
+            // Y
+            // 
+            this.Y.Name = "Y";
+            this.Y.ReadOnly = true;
+            // 
+            // Z
+            // 
+            this.Z.Name = "Z";
+            this.Z.ReadOnly = true;
+            // 
+            // M
+            // 
+            this.M.Name = "M";
+            this.M.ReadOnly = true;
+            // 
+            // R
+            // 
+            this.R.Name = "R";
+            this.R.ReadOnly = true;
+            // 
+            // T
+            // 
+            this.T.Name = "T";
+            this.T.ReadOnly = true;
+            // 
+            // IsPTcheckBox
+            // 
+            this.IsPTcheckBox.AutoSize = true;
+            this.IsPTcheckBox.Location = new System.Drawing.Point(23, 39);
+            this.IsPTcheckBox.Name = "IsPTcheckBox";
+            this.IsPTcheckBox.Size = new System.Drawing.Size(106, 22);
+            this.IsPTcheckBox.TabIndex = 4;
+            this.IsPTcheckBox.Text = "是否有PT";
+            this.IsPTcheckBox.UseVisualStyleBackColor = true;
+            this.IsPTcheckBox.CheckedChanged += new System.EventHandler(this.IsPTcheckBox_CheckedChanged);
+            // 
+            // SampleNametextBox
+            // 
+            this.SampleNametextBox.Location = new System.Drawing.Point(106, 68);
+            this.SampleNametextBox.Name = "SampleNametextBox";
+            this.SampleNametextBox.Size = new System.Drawing.Size(171, 28);
+            this.SampleNametextBox.TabIndex = 5;
+            this.SampleNametextBox.TextChanged += new System.EventHandler(this.textBox1_TextChanged);
+            // 
+            // SampleNameLabel
+            // 
+            this.SampleNameLabel.AutoSize = true;
+            this.SampleNameLabel.Location = new System.Drawing.Point(20, 73);
+            this.SampleNameLabel.Name = "SampleNameLabel";
+            this.SampleNameLabel.Size = new System.Drawing.Size(80, 18);
+            this.SampleNameLabel.TabIndex = 6;
+            this.SampleNameLabel.Text = "样品名称";
+            // 
+            // groupBox1
+            // 
+            this.groupBox1.Controls.Add(this.ManualFocuscheckBox);
+            this.groupBox1.Controls.Add(this.button2);
+            this.groupBox1.Controls.Add(this.button1);
+            this.groupBox1.Controls.Add(this.FIBTemptextBox);
+            this.groupBox1.Controls.Add(this.label1);
+            this.groupBox1.Controls.Add(this.IsPTcheckBox);
+            this.groupBox1.Controls.Add(this.SampleNametextBox);
+            this.groupBox1.Controls.Add(this.SampleNameLabel);
+            this.groupBox1.Location = new System.Drawing.Point(29, 164);
+            this.groupBox1.Name = "groupBox1";
+            this.groupBox1.Size = new System.Drawing.Size(317, 197);
+            this.groupBox1.TabIndex = 7;
+            this.groupBox1.TabStop = false;
+            this.groupBox1.Text = "测量参数";
+            // 
+            // ManualFocuscheckBox
+            // 
+            this.ManualFocuscheckBox.AutoSize = true;
+            this.ManualFocuscheckBox.Location = new System.Drawing.Point(23, 159);
+            this.ManualFocuscheckBox.Name = "ManualFocuscheckBox";
+            this.ManualFocuscheckBox.Size = new System.Drawing.Size(142, 22);
+            this.ManualFocuscheckBox.TabIndex = 11;
+            this.ManualFocuscheckBox.Text = "是否手动对焦";
+            this.ManualFocuscheckBox.UseVisualStyleBackColor = true;
+            this.ManualFocuscheckBox.CheckedChanged += new System.EventHandler(this.ManualFocuscheckBox_CheckedChanged);
+            // 
+            // button2
+            // 
+            this.button2.Location = new System.Drawing.Point(233, 112);
+            this.button2.Name = "button2";
+            this.button2.Size = new System.Drawing.Size(44, 27);
+            this.button2.TabIndex = 10;
+            this.button2.Text = "...";
+            this.button2.UseVisualStyleBackColor = true;
+            this.button2.Click += new System.EventHandler(this.button2_Click);
+            // 
+            // button1
+            // 
+            this.button1.Location = new System.Drawing.Point(135, 28);
+            this.button1.Name = "button1";
+            this.button1.Size = new System.Drawing.Size(142, 30);
+            this.button1.TabIndex = 9;
+            this.button1.Text = "确认";
+            this.button1.UseVisualStyleBackColor = true;
+            this.button1.Click += new System.EventHandler(this.button1_Click_1);
+            // 
+            // FIBTemptextBox
+            // 
+            this.FIBTemptextBox.Location = new System.Drawing.Point(106, 112);
+            this.FIBTemptextBox.Name = "FIBTemptextBox";
+            this.FIBTemptextBox.ReadOnly = true;
+            this.FIBTemptextBox.Size = new System.Drawing.Size(120, 28);
+            this.FIBTemptextBox.TabIndex = 8;
+            // 
+            // label1
+            // 
+            this.label1.AutoSize = true;
+            this.label1.Location = new System.Drawing.Point(20, 115);
+            this.label1.Name = "label1";
+            this.label1.Size = new System.Drawing.Size(80, 18);
+            this.label1.TabIndex = 7;
+            this.label1.Text = "操作模板";
+            // 
+            // button3
+            // 
+            this.button3.Location = new System.Drawing.Point(184, 29);
+            this.button3.Name = "button3";
+            this.button3.Size = new System.Drawing.Size(147, 35);
+            this.button3.TabIndex = 8;
+            this.button3.Text = "启动";
+            this.button3.UseVisualStyleBackColor = true;
+            this.button3.Click += new System.EventHandler(this.button3_Click);
+            // 
+            // button4
+            // 
+            this.button4.Location = new System.Drawing.Point(347, 27);
+            this.button4.Name = "button4";
+            this.button4.Size = new System.Drawing.Size(147, 35);
+            this.button4.TabIndex = 9;
+            this.button4.Text = "停止";
+            this.button4.UseVisualStyleBackColor = true;
+            // 
+            // button5
+            // 
+            this.button5.Location = new System.Drawing.Point(184, 30);
+            this.button5.Name = "button5";
+            this.button5.Size = new System.Drawing.Size(147, 35);
+            this.button5.TabIndex = 10;
+            this.button5.Text = "保存";
+            this.button5.UseVisualStyleBackColor = true;
+            this.button5.Click += new System.EventHandler(this.button5_Click);
+            // 
+            // button6
+            // 
+            this.button6.Location = new System.Drawing.Point(347, 30);
+            this.button6.Name = "button6";
+            this.button6.Size = new System.Drawing.Size(147, 35);
+            this.button6.TabIndex = 11;
+            this.button6.Text = "打开";
+            this.button6.UseVisualStyleBackColor = true;
+            // 
+            // groupBox2
+            // 
+            this.groupBox2.Controls.Add(this.NewMeasureFile);
+            this.groupBox2.Controls.Add(this.button5);
+            this.groupBox2.Controls.Add(this.button6);
+            this.groupBox2.Location = new System.Drawing.Point(29, 6);
+            this.groupBox2.Name = "groupBox2";
+            this.groupBox2.Size = new System.Drawing.Size(745, 71);
+            this.groupBox2.TabIndex = 12;
+            this.groupBox2.TabStop = false;
+            this.groupBox2.Text = "测量文件操作";
+            // 
+            // groupBox3
+            // 
+            this.groupBox3.Controls.Add(this.LoadCutHole);
+            this.groupBox3.Controls.Add(this.button3);
+            this.groupBox3.Controls.Add(this.button4);
+            this.groupBox3.Location = new System.Drawing.Point(29, 83);
+            this.groupBox3.Name = "groupBox3";
+            this.groupBox3.Size = new System.Drawing.Size(745, 75);
+            this.groupBox3.TabIndex = 13;
+            this.groupBox3.TabStop = false;
+            this.groupBox3.Text = "测量流程";
+            // 
+            // textBox1
+            // 
+            this.textBox1.Location = new System.Drawing.Point(352, 164);
+            this.textBox1.Multiline = true;
+            this.textBox1.Name = "textBox1";
+            this.textBox1.Size = new System.Drawing.Size(422, 197);
+            this.textBox1.TabIndex = 14;
+            // 
             // FormMeasureTest
             // 
             this.AutoScaleDimensions = new System.Drawing.SizeF(9F, 18F);
             this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
-            this.ClientSize = new System.Drawing.Size(800, 450);
-            this.Controls.Add(this.LoadCutHole);
-            this.Controls.Add(this.NewMeasureFile);
-            this.Name = "FormMeasureTest";
+            this.ClientSize = new System.Drawing.Size(800, 523);
+            this.Controls.Add(this.textBox1);
+            this.Controls.Add(this.groupBox3);
+            this.Controls.Add(this.groupBox2);
+            this.Controls.Add(this.groupBox1);
+            this.Controls.Add(this.CutHoleGridView);
+            //this.Name = "FormMeasureTest";
             this.Text = "测量流程测试";
+            ((System.ComponentModel.ISupportInitialize)(this.CutHoleGridView)).EndInit();
+            this.groupBox1.ResumeLayout(false);
+            this.groupBox1.PerformLayout();
+            this.groupBox2.ResumeLayout(false);
+            this.groupBox3.ResumeLayout(false);
             this.ResumeLayout(false);
+            this.PerformLayout();
 
         }
 
         #endregion
         private System.Windows.Forms.Button NewMeasureFile;
         private System.Windows.Forms.Button LoadCutHole;
+        private System.Windows.Forms.DataGridView CutHoleGridView;
+        private DataGridViewTextBoxColumn dataGridViewTextBoxColumn1;
+        private DataGridViewTextBoxColumn dataGridViewTextBoxColumn2;
+        private DataGridViewTextBoxColumn dataGridViewTextBoxColumn3;
+        private DataGridViewTextBoxColumn dataGridViewTextBoxColumn4;
+        private DataGridViewTextBoxColumn dataGridViewTextBoxColumn5;
+        private DataGridViewTextBoxColumn dataGridViewTextBoxColumn6;
+        private DataGridViewTextBoxColumn dataGridViewTextBoxColumn7;
+        private CheckBox IsPTcheckBox;
+        private DataGridViewTextBoxColumn Name;
+        private DataGridViewTextBoxColumn X;
+        private DataGridViewTextBoxColumn Y;
+        private DataGridViewTextBoxColumn Z;
+        private DataGridViewTextBoxColumn M;
+        private DataGridViewTextBoxColumn R;
+        private DataGridViewTextBoxColumn T;
+        private TextBox SampleNametextBox;
+        private Label SampleNameLabel;
+        private GroupBox groupBox1;
+        private Button button1;
+        private TextBox FIBTemptextBox;
+        private Label label1;
+        private Button button2;
+        private CheckBox ManualFocuscheckBox;
+        private Button button3;
+        private Button button4;
+        private Button button5;
+        private Button button6;
+        private GroupBox groupBox2;
+        private GroupBox groupBox3;
+        private TextBox textBox1;
     }
 }

+ 107 - 3
HOZProject/FormMeasureTest.cs

@@ -12,13 +12,15 @@ using System.Threading.Tasks;
 using System.Windows.Forms;
 
 using MeasureData;
+using MeasureThread;
 
 namespace HOZProject
 {
     public partial class FormMeasureTest : Form
     {
         public MeasureFile m_MeasureFile;
-        
+        public Measure m_Ms;
+
         public FormMeasureTest()
         {
             InitializeComponent();
@@ -33,7 +35,8 @@ namespace HOZProject
                 return;
             }
             else
-            {
+            {                
+                this.IsPTcheckBox.Checked = m_MeasureFile.MParam.PT;
                 MessageBox.Show("新建测量文件成功。");
             }
         }
@@ -53,7 +56,108 @@ namespace HOZProject
             }
             else
             {
-                m_MeasureFile.GetCutHolesFromFile("");
+                if (!m_MeasureFile.GetCutHolesFromFile(""))
+                {
+                    MessageBox.Show("导入切孔失败");
+                }
+
+                List<CutHole> listHoles = m_MeasureFile.ListCutHole;
+                foreach (CutHole hole in listHoles)
+                {                    
+                    //在CutHoleGridView中,添加切孔信息
+                    int index = this.CutHoleGridView.Rows.Add();
+                    this.CutHoleGridView.Rows[index].Cells[0].Value = hole.HoleName;
+
+                    SemPosition pos = hole.Position;
+                    this.CutHoleGridView.Rows[index].Cells[1].Value = pos.X;
+                    this.CutHoleGridView.Rows[index].Cells[2].Value = pos.Y;
+                    this.CutHoleGridView.Rows[index].Cells[3].Value = pos.Z;
+                    this.CutHoleGridView.Rows[index].Cells[4].Value = pos.M;
+                    this.CutHoleGridView.Rows[index].Cells[5].Value = pos.R;
+                    this.CutHoleGridView.Rows[index].Cells[6].Value = pos.T;                  
+                }
+            }
+        }
+
+        private void IsPTcheckBox_CheckedChanged(object sender, EventArgs e)
+        {
+           
+        }
+
+        private void textBox1_TextChanged(object sender, EventArgs e)
+        {
+           
+        }
+
+        //测量参数
+        private void button1_Click_1(object sender, EventArgs e)
+        {
+            if (m_MeasureFile == null)
+            {
+                MessageBox.Show("请新建一个测量文件");
+            }
+            else
+            {
+                m_MeasureFile.MParam.PT = this.IsPTcheckBox.Checked;
+                m_MeasureFile.MParam.SampleName = this.SampleNametextBox.Text;
+                m_MeasureFile.MParam.FIBTemp = this.FIBTemptextBox.Text;
+                m_MeasureFile.MParam.FocusMode = this.ManualFocuscheckBox.Checked;
+
+                MessageBox.Show("参数设置成功");
+            }
+        }
+
+        private void ManualFocuscheckBox_CheckedChanged(object sender, EventArgs e)
+        {
+
+        }
+
+        //选择一个模板文件
+        private void button2_Click(object sender, EventArgs e)
+        {
+            string FilePathName;
+            string fileNameWithoutExtension;
+            //新建一个文件对话框
+            OpenFileDialog pOpenFileDialog = new OpenFileDialog();
+            //设置对话框标题
+            pOpenFileDialog.Title = "选择模板文件";
+            //设置打开文件类型
+            pOpenFileDialog.Filter = "ely文件(*.ely)|*.ely";
+            //监测文件是否存在
+            pOpenFileDialog.CheckFileExists = true;
+            //文件打开后执行以下程序
+            if (pOpenFileDialog.ShowDialog() == DialogResult.OK)
+            {
+                FilePathName = System.IO.Path.GetFullPath(pOpenFileDialog.FileName);                             //绝对路径
+                fileNameWithoutExtension = System.IO.Path.GetFileNameWithoutExtension(FilePathName);
+                this.FIBTemptextBox.Text = fileNameWithoutExtension;
+            }            
+        }
+
+        //启动测量
+        private void button3_Click(object sender, EventArgs e)
+        {
+            if (m_MeasureFile == null)
+            {
+                MessageBox.Show("请新建一个测量文件");
+            }
+            else
+            {
+                m_Ms = new Measure();
+                m_Ms.InitMeas(m_MeasureFile);
+                m_Ms.DoMeasure();
+            }
+        }
+
+        private void button5_Click(object sender, EventArgs e)
+        {
+            if (m_MeasureFile == null)
+            {
+                MessageBox.Show("请新建一个测量文件");
+            }
+            else
+            {
+                m_MeasureFile.Save();
             }
         }
     }

+ 4 - 0
HOZProject/UnitControl.csproj

@@ -117,6 +117,10 @@
       <Project>{12617585-8d9a-4ad4-b6c4-6894a48cee9e}</Project>
       <Name>MeasureData</Name>
     </ProjectReference>
+    <ProjectReference Include="..\MeasureThread\MeasureThread.csproj">
+      <Project>{9a5851e4-73fd-48e1-876c-68bed40a0512}</Project>
+      <Name>MeasureThread</Name>
+    </ProjectReference>
     <ProjectReference Include="..\SmartSEMControl\SmartSEMControl.csproj">
       <Project>{bf7f80b0-a6da-4470-a331-4c96057fc7fa}</Project>
       <Name>SmartSEMControl</Name>

+ 64 - 6
MeasureData/MeasureFile.cs

@@ -59,9 +59,9 @@ namespace MeasureData
         /// <returns>0:失败;1:成功;2:文件已存在</returns>
         public int CreateXml()
         {
-            if (!File.Exists(this.FilePath + "\\" + this.FileName))
+            if (!File.Exists(this.FileName))
             {
-                if( XmlManager.CreateXmlFile(this.FilePath + "\\" + this.FileName))
+                if( XmlManager.CreateXmlFile(this.FileName))
                 {
                     return 1;
                 }
@@ -151,7 +151,7 @@ namespace MeasureData
             //}
 
             // 设置路径为初始默认路径
-            FilePath = UNTITLED_FILE_NAME;
+            this.FileName = UNTITLED_FILE_NAME;
             // Ok, return TRUE
             return true;
         }
@@ -162,14 +162,72 @@ namespace MeasureData
         }
 
         //保存
-        public void Save()
+        public bool Save()
         {
-            //Serialize();
+            //如果是新文件
+            this.FileName.Trim();
+            if (string.Compare(this.FileName,UNTITLED_FILE_NAME) == 0)
+            {
+                return SaveAs();
+            }
+
+            XmlDocument doc = new XmlDocument();
+            if (Directory.Exists(FileName))
+            {
+                doc.Load(this.FileName);//载入xml文件               
+            }
+            else
+            {
+                return SaveAs(); //当前路径不存在               
+            }
+
+            XmlNode root = doc.SelectSingleNode("XMLData");
+            Serialize(true, doc, root);
+            doc.Save(this.FileName);
+
+            return true;
         }
 
         //另存为
-        public void SaveAs()
+        public bool SaveAs()
         {
+            //打开保存文件的对话框
+            this.FileName.Trim();
+            if (!string.IsNullOrEmpty(this.FileName))
+            {
+                this.FilePath = System.IO.Path.GetDirectoryName(this.FileName);
+            }
+
+            SaveFileDialog sfd = new SaveFileDialog();
+            sfd.Title = "保存测量文件";
+            sfd.Filter = "测量文件(*.msf)|*.msf";
+            
+            if (Directory.Exists(this.FilePath))
+            {
+                sfd.InitialDirectory = this.FilePath;
+            }
+
+            if (sfd.ShowDialog() == DialogResult.OK)
+            {
+
+                this.FileName = sfd.FileName.ToString(); //获得文件路径
+                FilePath = System.IO.Path.GetDirectoryName(this.FileName);
+
+                //创建一个新的文件
+                XmlDocument doc = new XmlDocument();
+                if (!Directory.Exists(this.FilePath))
+                {
+                    if (CreateXml() > 0)//创建该文件?
+                    {
+                        return false;
+                    }
+                }
+
+                XmlNode root = doc.SelectSingleNode("XMLData");
+                Serialize(true, doc, root);
+                doc.Save(this.FileName);
+            }
+            return true;
         }
 
         //从文件生成切割孔信息

+ 6 - 11
MeasureData/MeasureParam.cs

@@ -15,11 +15,6 @@ namespace MeasureData
 {
     public class MeasureParam : ISlo
     {
-        public enum FMode
-        {
-            Manual,
-            Auto
-        }
 
         #region 内容
         //工作条件,一次测量的全部切孔都是一类的
@@ -56,9 +51,9 @@ namespace MeasureData
             set { this.m_ptTemp = value; }
         }
 
-        //对焦方式,自动对焦还是手动对焦
-        private FMode m_fMode;
-        public FMode FocusMode
+        //对焦方式,自动对焦还是手动对焦,手动对焦是1,自动对焦0
+        private bool m_fMode;
+        public bool FocusMode
         {
             get { return m_fMode; }
             set { m_fMode = value; }
@@ -88,13 +83,13 @@ namespace MeasureData
             xBool pt = new xBool();
             xString FIBtemp = new xString();
             xString PTtemp = new xString();
-            xInt FocMode = new xInt();
+            xBool FocMode = new xBool();
 
             sampleName.AssignValue(this.SampleName);
             pt.AssignValue(this.PT);
             FIBtemp.AssignValue(this.FIBTemp);
             PTtemp.AssignValue(this.PTTemp);
-            FocMode.AssignValue((int)this.FocusMode);
+            FocMode.AssignValue(this.FocusMode);
 
             slo_msparam.Register("SampleName", sampleName);
             slo_msparam.Register("PT", pt);
@@ -114,7 +109,7 @@ namespace MeasureData
                 this.PT = pt.value();
                 this.FIBTemp = FIBtemp.value();
                 this.PTTemp = PTtemp.value();
-                this.FocusMode = (FMode)FocMode.value();
+                this.FocusMode = FocMode.value();
             }
         }
 

+ 17 - 29
MeasureThread/Measure.cs

@@ -81,13 +81,15 @@ namespace MeasureThread
             Init();
         }
 
-        public void Init()
+        private void Init()
         {
-            
+            MeasParam = new MeasureParam();
+            TStatus = new ThreadStatus();
+            cutHoles = new List<MeasureData.CutHole>();
         }
 
-        //初始化测量业务, 读测量文件,判断是否有可测试的切孔
-        public bool InitMeas(MeasureFile a_measureFile)
+    //初始化测量业务, 读测量文件,判断是否有可测试的切孔
+    public bool InitMeas(MeasureFile a_measureFile)
         {
             m_measureFile = a_measureFile;
             List<CutHole> listHoles = m_measureFile.ListCutHole;
@@ -206,18 +208,14 @@ namespace MeasureThread
                 }
 
                 //2.控制SEM自动对焦、亮度、对比度
-                if (FocusMode == FMode.Manual)
+                if (!MeasParam.FocusMode)
                 {
                     //弹出手动对焦的窗口
                 }
-                else if (FocusMode == FMode.Auto)
+                else 
                 {
                     //调用自动对焦模块
-                }
-                else
-                {
-                    return false;
-                }
+                }                
 
                 //3.设置SEM进行角度补偿54度
                 if (!TiltCorrection(54))
@@ -318,17 +316,13 @@ namespace MeasureThread
                     return false;
                 }
                 //2.控制SEM自动对焦、亮度、对比度-接口
-                if (FocusMode == FMode.Manual)
+                if (!MeasParam.FocusMode)
                 {
                     //弹出手动对焦的窗口
                 }
-                else if (FocusMode == FMode.Auto)
-                {
-                    //调用自动对焦模块
-                }
                 else
                 {
-                    return false;
+                    //调用自动对焦模块
                 }
 
                 //3.控制SEM拍照
@@ -368,18 +362,15 @@ namespace MeasureThread
                     return false;
                 }
                 //2.控制SEM自动对焦、消像散、亮度、对比度
-                if (FocusMode == FMode.Manual)
+                if (!MeasParam.FocusMode)
                 {
                     //弹出手动对焦的窗口
                 }
-                else if (FocusMode == FMode.Auto)
-                {
-                    //调用自动对焦模块
-                }
                 else
                 {
-                    return false;
+                    //调用自动对焦模块
                 }
+
                 //3.设置SEM角度补偿cos36度
                 if (!TiltCorrection(36))
                 {
@@ -431,19 +422,16 @@ namespace MeasureThread
                 }
 
                 //11.控制SEM自动对焦、消像散、亮度、对比度
-                if (FocusMode == FMode.Manual)
+                if (!MeasParam.FocusMode)
                 {
                     //弹出手动对焦的窗口
                 }
-                else if (FocusMode == FMode.Auto)
-                {
-                    //调用自动对焦模块
-                }
                 else
                 {
-                    return false;
+                    //调用自动对焦模块
                 }
 
+
                 //12.控制SEM对分析位置拍照
                 String fileName6 = WorkingFolder + ImageName6;
                 if (!GetImage(ImageMode.SEM, fileName6))