|
@@ -185,101 +185,109 @@ namespace HOZProject
|
|
|
/// </summary>
|
|
|
public void EditConfig()
|
|
|
{
|
|
|
- //设置数据源信息
|
|
|
- //样品类型
|
|
|
- List<String> _sT = sT.ToList();
|
|
|
- if (_sT.IndexOf(cbbWYP.Text) < 0)
|
|
|
- {
|
|
|
- _sT.Add(cbbWYP.Text);
|
|
|
- string wsT = string.Join(",", _sT.ToArray());
|
|
|
- config.AppSettings.Settings["Sample_Type"].Value = wsT;
|
|
|
- }
|
|
|
- //厂商
|
|
|
- List<String> _firms = firms.ToList();
|
|
|
- if (_firms.IndexOf(cbbWCS.Text) < 0)
|
|
|
- {
|
|
|
- _firms.Add(cbbWCS.Text);
|
|
|
- string wFirms = string.Join(",", _firms.ToArray());
|
|
|
- config.AppSettings.Settings["Firm"].Value = wFirms;
|
|
|
- }
|
|
|
- //拍照电压
|
|
|
- List<String> _WPZD = WPZD.ToList();
|
|
|
- if (_WPZD.IndexOf(cbbWPZD.Text) < 0)
|
|
|
- {
|
|
|
- _WPZD.Add(cbbWPZD.Text);
|
|
|
- string wWPZD = string.Join(",", _WPZD.ToArray());
|
|
|
- config.AppSettings.Settings["WPZD"].Value = wWPZD;
|
|
|
- }
|
|
|
- //拍照放大位数
|
|
|
- List<String> _WPZF = WPZF.ToList();
|
|
|
- if (_WPZF.IndexOf(cbbWPZF.Text) < 0)
|
|
|
- {
|
|
|
- _WPZF.Add(cbbWPZF.Text);
|
|
|
- string wWPZF = string.Join(",", _WPZF.ToArray());
|
|
|
- config.AppSettings.Settings["WPZF"].Value = wWPZF;
|
|
|
- }
|
|
|
- //定位切割电压
|
|
|
- List<String> _WQGD = WQGD.ToList();
|
|
|
- if (_WQGD.IndexOf(cbbWQGD.Text) < 0)
|
|
|
- {
|
|
|
- _WQGD.Add(cbbWQGD.Text);
|
|
|
- string wWQGD = string.Join(",", _WQGD.ToArray());
|
|
|
- config.AppSettings.Settings["WQGD"].Value = wWQGD;
|
|
|
- }
|
|
|
- //定位切割放大位数
|
|
|
- List<String> _WQGF = WQGF.ToList();
|
|
|
- if (_WQGF.IndexOf(cbbWQGF.Text) < 0)
|
|
|
- {
|
|
|
- _WQGF.Add(cbbWQGF.Text);
|
|
|
- string wWQGF = string.Join(",", _WQGF.ToArray());
|
|
|
- config.AppSettings.Settings["WQGF"].Value = wWQGF;
|
|
|
- }
|
|
|
- //拉直操作放大位数
|
|
|
- List<String> _WLZ = WLZ.ToList();
|
|
|
- if (_WLZ.IndexOf(cbbWLZ.Text) < 0)
|
|
|
+ try
|
|
|
{
|
|
|
- _WLZ.Add(cbbWLZ.Text);
|
|
|
- string wWLZ = string.Join(",", _WLZ.ToArray());
|
|
|
- config.AppSettings.Settings["WLZ"].Value = wWLZ;
|
|
|
- }
|
|
|
+ //设置数据源信息
|
|
|
+ //样品类型
|
|
|
+ List<String> _sT = sT.ToList();
|
|
|
+ if (_sT.IndexOf(cbbWYP.Text) < 0)
|
|
|
+ {
|
|
|
+ _sT.Add(cbbWYP.Text);
|
|
|
+ string wsT = string.Join(",", _sT.ToArray());
|
|
|
+ config.AppSettings.Settings["Sample_Type"].Value = wsT;
|
|
|
+ }
|
|
|
+ //厂商
|
|
|
+ List<String> _firms = firms.ToList();
|
|
|
+ if (_firms.IndexOf(cbbWCS.Text) < 0)
|
|
|
+ {
|
|
|
+ _firms.Add(cbbWCS.Text);
|
|
|
+ string wFirms = string.Join(",", _firms.ToArray());
|
|
|
+ config.AppSettings.Settings["Firm"].Value = wFirms;
|
|
|
+ }
|
|
|
+ //拍照电压
|
|
|
+ List<String> _WPZD = WPZD.ToList();
|
|
|
+ if (_WPZD.IndexOf(cbbWPZD.Text) < 0)
|
|
|
+ {
|
|
|
+ _WPZD.Add(cbbWPZD.Text);
|
|
|
+ string wWPZD = string.Join(",", _WPZD.ToArray());
|
|
|
+ config.AppSettings.Settings["WPZD"].Value = wWPZD;
|
|
|
+ }
|
|
|
+ //拍照放大位数
|
|
|
+ List<String> _WPZF = WPZF.ToList();
|
|
|
+ if (_WPZF.IndexOf(cbbWPZF.Text) < 0)
|
|
|
+ {
|
|
|
+ _WPZF.Add(cbbWPZF.Text);
|
|
|
+ string wWPZF = string.Join(",", _WPZF.ToArray());
|
|
|
+ config.AppSettings.Settings["WPZF"].Value = wWPZF;
|
|
|
+ }
|
|
|
+ //定位切割电压
|
|
|
+ List<String> _WQGD = WQGD.ToList();
|
|
|
+ if (_WQGD.IndexOf(cbbWQGD.Text) < 0)
|
|
|
+ {
|
|
|
+ _WQGD.Add(cbbWQGD.Text);
|
|
|
+ string wWQGD = string.Join(",", _WQGD.ToArray());
|
|
|
+ config.AppSettings.Settings["WQGD"].Value = wWQGD;
|
|
|
+ }
|
|
|
+ //定位切割放大位数
|
|
|
+ List<String> _WQGF = WQGF.ToList();
|
|
|
+ if (_WQGF.IndexOf(cbbWQGF.Text) < 0)
|
|
|
+ {
|
|
|
+ _WQGF.Add(cbbWQGF.Text);
|
|
|
+ string wWQGF = string.Join(",", _WQGF.ToArray());
|
|
|
+ config.AppSettings.Settings["WQGF"].Value = wWQGF;
|
|
|
+ }
|
|
|
+ //拉直操作放大位数
|
|
|
+ List<String> _WLZ = WLZ.ToList();
|
|
|
+ if (_WLZ.IndexOf(cbbWLZ.Text) < 0)
|
|
|
+ {
|
|
|
+ _WLZ.Add(cbbWLZ.Text);
|
|
|
+ string wWLZ = string.Join(",", _WLZ.ToArray());
|
|
|
+ config.AppSettings.Settings["WLZ"].Value = wWLZ;
|
|
|
+ }
|
|
|
|
|
|
- MeasureParam cfm = new MeasureParam();
|
|
|
- cfm.Is_Photograph = chkWIsP.Checked;
|
|
|
- cfm.PT = chkWPT.Checked;
|
|
|
- cfm.PTTemp = txtWPTF.Text;
|
|
|
- cfm.FIBTemp = txtWFIBF.Text;
|
|
|
- cfm.Stretch_Magnification = Convert.ToDouble(cbbWLZ.Text);
|
|
|
- cfm.Location_Magnification = Convert.ToDouble(cbbWQGF.Text);
|
|
|
- cfm.Location_Voltage = Convert.ToDouble(cbbWQGD.Text);
|
|
|
- cfm.Photograph_Magnification = Convert.ToDouble(cbbWPZF.Text);
|
|
|
- cfm.Photograph_Voltage = Convert.ToDouble(cbbWPZD.Text);
|
|
|
- if (cbbWXZ.SelectedIndex == 0)
|
|
|
- {
|
|
|
- cfm.Correction_Angle = 36.0;
|
|
|
+ MeasureParam cfm = new MeasureParam();
|
|
|
+ cfm.Is_Photograph = chkWIsP.Checked;
|
|
|
+ cfm.PT = chkWPT.Checked;
|
|
|
+ cfm.PTTemp = txtWPTF.Text;
|
|
|
+ cfm.FIBTemp = txtWFIBF.Text;
|
|
|
+ cfm.Stretch_Magnification = Convert.ToDouble(cbbWLZ.Text);
|
|
|
+ cfm.Location_Magnification = Convert.ToDouble(cbbWQGF.Text);
|
|
|
+ cfm.Location_Voltage = Convert.ToDouble(cbbWQGD.Text);
|
|
|
+ cfm.Photograph_Magnification = Convert.ToDouble(cbbWPZF.Text);
|
|
|
+ cfm.Photograph_Voltage = Convert.ToDouble(cbbWPZD.Text);
|
|
|
+ if (cbbWXZ.SelectedIndex == 0)
|
|
|
+ {
|
|
|
+ cfm.Correction_Angle = 36.0;
|
|
|
+ }
|
|
|
+ else
|
|
|
+ {
|
|
|
+ cfm.Correction_Angle = 54.0;
|
|
|
+ }
|
|
|
+
|
|
|
+ cfm.SampleName = cbbWYP.Text;
|
|
|
+ cfm.Firm = cbbWCS.Text;
|
|
|
+ //设置配置文件默认值
|
|
|
+ config.AppSettings.Settings["Is_Photograph"].Value = cfm.Is_Photograph.ToString();
|
|
|
+ config.AppSettings.Settings["PT_Depostion"].Value = cfm.PT.ToString();
|
|
|
+ config.AppSettings.Settings["PT_ELYFile"].Value = cfm.PTTemp;
|
|
|
+ config.AppSettings.Settings["FIB_ELYFile"].Value = cfm.FIBTemp;
|
|
|
+ config.AppSettings.Settings["Stretch_Magnification"].Value = cfm.Stretch_Magnification.ToString();
|
|
|
+ config.AppSettings.Settings["Location_Magnification"].Value = cfm.Location_Magnification.ToString();
|
|
|
+ config.AppSettings.Settings["Location_Voltage"].Value = cfm.Location_Voltage.ToString();
|
|
|
+ config.AppSettings.Settings["Photograph_Magnification"].Value = cfm.Photograph_Magnification.ToString();
|
|
|
+ config.AppSettings.Settings["Photograph_Voltage"].Value = cfm.Photograph_Voltage.ToString();
|
|
|
+ config.AppSettings.Settings["Correction_Angle"].Value = cfm.Correction_Angle.ToString();
|
|
|
+ config.AppSettings.Settings["SampleName"].Value = cfm.SampleName;
|
|
|
+ config.AppSettings.Settings["Firms"].Value = cfm.Firm;
|
|
|
+
|
|
|
+ config.Save(ConfigurationSaveMode.Modified);
|
|
|
+ ConfigurationManager.RefreshSection("appSettings");//重新加载新的配置文件
|
|
|
}
|
|
|
- else
|
|
|
+ catch (Exception ex)
|
|
|
{
|
|
|
- cfm.Correction_Angle = 54.0;
|
|
|
- }
|
|
|
-
|
|
|
- cfm.SampleName = cbbWYP.Text;
|
|
|
- cfm.Firm = cbbWCS.Text;
|
|
|
- //设置配置文件默认值
|
|
|
- config.AppSettings.Settings["Is_Photograph"].Value = cfm.Is_Photograph.ToString();
|
|
|
- config.AppSettings.Settings["PT_Depostion"].Value = cfm.PT.ToString();
|
|
|
- config.AppSettings.Settings["PT_ELYFile"].Value = cfm.PTTemp;
|
|
|
- config.AppSettings.Settings["FIB_ELYFile"].Value = cfm.FIBTemp;
|
|
|
- config.AppSettings.Settings["Stretch_Magnification"].Value = cfm.Stretch_Magnification.ToString();
|
|
|
- config.AppSettings.Settings["Location_Magnification"].Value = cfm.Location_Magnification.ToString();
|
|
|
- config.AppSettings.Settings["Location_Voltage"].Value = cfm.Location_Voltage.ToString();
|
|
|
- config.AppSettings.Settings["Photograph_Magnification"].Value = cfm.Photograph_Magnification.ToString();
|
|
|
- config.AppSettings.Settings["Photograph_Voltage"].Value = cfm.Photograph_Voltage.ToString();
|
|
|
- config.AppSettings.Settings["Correction_Angle"].Value = cfm.Correction_Angle.ToString();
|
|
|
- config.AppSettings.Settings["SampleName"].Value = cfm.SampleName;
|
|
|
- config.AppSettings.Settings["Firms"].Value = cfm.Firm;
|
|
|
|
|
|
- config.Save(ConfigurationSaveMode.Modified);
|
|
|
- ConfigurationManager.RefreshSection("appSettings");//重新加载新的配置文件
|
|
|
+ throw;
|
|
|
+ }
|
|
|
}
|
|
|
|
|
|
/// <summary>
|