浏览代码

添加切换文件路径参数

wb_han 5 年之前
父节点
当前提交
082eda417a
共有 1 个文件被更改,包括 20 次插入8 次删除
  1. 20 8
      HOZProject/UserControls/UControl_Init.cs

+ 20 - 8
HOZProject/UserControls/UControl_Init.cs

@@ -69,12 +69,11 @@ namespace HOZProject
                 {
                     List<CutHole> ListCutHole = FormHOZMainObject.m_MeasureFile.ListCutHole;
                     //文件路径
-                    string filePath = FormHOZMainObject.m_MeasureFile.FilePath;
-                    string fileName = FormHOZMainObject.m_MeasureFile.FileName;
+                    string CutHoleFilePath = FormHOZMainObject.m_MeasureFile.CutHoleFilePath;
                     FormHOZMainObject.CreateCutHoleList(ListCutHole);
                     //显示导入的切孔数量
                     lblCutHoleCount.Text = string.Format("成功导入{0}个切孔", ListCutHole.Count);
-                    tbCutHoleFilePath.Text = filePath + fileName;
+                    tbCutHoleFilePath.Text = CutHoleFilePath;
                 }
             }
         }
@@ -183,7 +182,7 @@ namespace HOZProject
         /// <summary>
         /// 编辑confing 文件信息
         /// </summary>
-        public void EditConfig()
+        public bool EditConfig()
         {
             try
             {
@@ -263,6 +262,7 @@ namespace HOZProject
                 {
                     cfm.Correction_Angle = 54.0;
                 }
+                
 
                 cfm.SampleName = cbbWYP.Text;
                 cfm.Firm = cbbWCS.Text;
@@ -282,11 +282,12 @@ namespace HOZProject
 
                 config.Save(ConfigurationSaveMode.Modified);
                 ConfigurationManager.RefreshSection("appSettings");//重新加载新的配置文件
+                return true;
             }
             catch (Exception ex)
             {
-
-                throw;
+                LogManager.LogError(ex.Message);
+                return false;
             }
         }
 
@@ -426,7 +427,15 @@ namespace HOZProject
             cbbWQGD.Text = config.AppSettings.Settings["Location_Voltage"].Value;
             cbbWPZF.Text = config.AppSettings.Settings["Photograph_Magnification"].Value;
             cbbWPZD.Text = config.AppSettings.Settings["Photograph_Voltage"].Value;
-            cbbWXZ.Text = config.AppSettings.Settings["Correction_Angle"].Value;
+            string Correction_Angle = config.AppSettings.Settings["Correction_Angle"].Value;
+            if (Correction_Angle == "36")
+            {
+                cbbWXZ.SelectedIndex = 0;
+            }
+            else
+            {
+                cbbWXZ.SelectedIndex = 1;
+            }
             cbbWYP.Text = config.AppSettings.Settings["SampleName"].Value;
             cbbWCS.Text = config.AppSettings.Settings["Firms"].Value;
         }
@@ -463,7 +472,10 @@ namespace HOZProject
         /// <param name="e"></param>
         private void btnSaveDefalutPara_Click(object sender, EventArgs e)
         {
-            EditConfig();
+            if (EditConfig())
+            {
+                MessageBox.Show("保存成功!", "提示");
+            }
         }
         #endregion