using System;
using System.Collections.Generic;
using System.Linq;
using System.Windows.Forms;
using System.Text.RegularExpressions;
using System.Collections;
using System.Diagnostics;
using OTSDataType;
using OTSModelSharp;
using System.IO;
using static OTSModelSharp.ResourceManage.ResourceData;
using static OTSDataType.otsdataconst;
using OTSModelSharp.Measure.GetStageInfo;
using OTSMeasureApp._0_OTSModel.Measure.ParamData;
using OTSMeasureApp._3_OTSDisplaySourceGridData;
using OTSMeasureApp._7_OTSProgMgrInfo;
using OTSCommon;
using System.Data;
namespace OTSMeasureApp
{
public partial class ProgMgrInfoForm : Form
{
#region 定义变量
//初始化函数功能类
public CStage m_cstage; //样品台类
public CStageParam m_cstagefile; //样品台文件类
public COTSDefaultParam m_cotsprogmgrparamfile; //参数类
public CSEMStageData m_csemstagedata; //SEM样品台处理类
public COTSImgScanPrm m_cotsimgscanprm; //图像扫描类
public COTSGeneralParam m_cgenparam; //一般参数类
public COTSImageProcParam m_cotsimgprocprm; //图像处理类
public COTSXRayParam m_cotsxrayprm;
public bool m_b_checkstagefile = false;
//定位程序管理路径用的变量
public string m_ParameterPath;
MeasureStopMode StopModeDialog;
//国际化
OTSCommon.Language lan;
Hashtable table;
NLog.Logger log ;
#endregion
///
/// 样品台加载
///
///
public bool StageLoad()
{
if (!m_cstagefile.Load( true, !m_b_checkstagefile))
{
log.Error("(OTSProgMgrInfoFun.StageLoad) 加载样品台信息失败");
return false;
}
return true;
}
#region 构造函数
///
/// 默认构造函数
///
public ProgMgrInfoForm()
{
log = NLog.LogManager.GetCurrentClassLogger();
m_cotsprogmgrparamfile = new COTSDefaultParam();
m_cstagefile = new CStageParam();
InitializeComponent();
//国际化
lan = new OTSCommon.Language(this);
table = lan.GetNameTable(this.Name);
}
#endregion
#region 绑定各combobox控件
///
/// 绑定各combobox控件下拉列表
///
public void BindComboBox()
{
//样品台
if (!StageLoad())
{
this.Close();
return;//加载失败返回
}
//绑定样品台列表信息
BindStageCombobox();
//初始化选项,下拉框---------------------------------------------
//绑定标准库
IDC_COMBO_STDSelect.Items.Clear();
string STDLibFolderName = m_cgenparam.GetPartSTDLibFolderName();
string[] files = System.IO.Directory.GetFiles(STDLibFolderName, "*.db");
System.IO.DirectoryInfo folder = new System.IO.DirectoryInfo(STDLibFolderName);
foreach (System.IO.FileInfo file in folder.GetFiles("*.db"))
{
ComboBoxItem cbi = new ComboBoxItem();
string FileNameWithoutExtension = Path.GetFileNameWithoutExtension(file.FullName);
cbi.Text = FileNameWithoutExtension;
//cbi.Value = (int)enum_one;
IDC_COMBO_STDSelect.Items.Add(cbi);
}
//添加下拉列表中null项
ComboBoxItem cbiNull = new ComboBoxItem();
cbiNull.Text = "NoSTDDB";
//cbi.Value = (int)enum_one;
IDC_COMBO_STDSelect.Items.Add(cbiNull);
this.IDC_COMBO_STDSelect.SelectedIndexChanged -= new System.EventHandler(this.IDC_COMBO_STDSelect_SelectedIndexChanged);
if (IDC_COMBO_STDSelect.Items.Count > 0)
IDC_COMBO_STDSelect.SelectedIndex = 0;
//----------------------------------------------------------------------
this.IDC_COMBO_STDSelect.SelectedIndexChanged += new System.EventHandler(this.IDC_COMBO_STDSelect_SelectedIndexChanged);
//x轴方向
IDC_COMBO_XDIREC.Items.Clear();
foreach (otsdataconst.OTS_X_AXIS_DIRECTION enum_one in Enum.GetValues(typeof(otsdataconst.OTS_X_AXIS_DIRECTION)))
{
ComboBoxItem cbi = new ComboBoxItem();
cbi.Text = GetXAxisDirectionIdString(enum_one);
cbi.Value = (int)enum_one;
IDC_COMBO_XDIREC.Items.Add(cbi);
}
this.IDC_COMBO_XDIREC.SelectedIndexChanged -= new System.EventHandler(this.IDC_COMBO_XDIREC_SelectedIndexChanged);
if (IDC_COMBO_XDIREC.Items.Count > 0)
IDC_COMBO_XDIREC.SelectedIndex = 0;
this.IDC_COMBO_XDIREC.SelectedIndexChanged += new System.EventHandler(this.IDC_COMBO_XDIREC_SelectedIndexChanged);
//y轴方向
IDC_COMBO_YDIRECT.Items.Clear();
foreach (otsdataconst.OTS_Y_AXIS_DIRECTION enum_one in Enum.GetValues(typeof(otsdataconst.OTS_Y_AXIS_DIRECTION)))
{
ComboBoxItem cbi = new ComboBoxItem();
cbi.Text = GetYAxisDirectionIdString(enum_one);
cbi.Value = (int)enum_one;
IDC_COMBO_YDIRECT.Items.Add(cbi);
}
this.IDC_COMBO_YDIRECT.SelectedIndexChanged -= new System.EventHandler(this.IDC_COMBO_YDIRECT_SelectedIndexChanged);
if (IDC_COMBO_YDIRECT.Items.Count > 0)
IDC_COMBO_YDIRECT.SelectedIndex = 0;
this.IDC_COMBO_YDIRECT.SelectedIndexChanged += new System.EventHandler(this.IDC_COMBO_YDIRECT_SelectedIndexChanged);
//取图方式
IDC_COMBO_FETCHIMGMODE.Items.Clear();
foreach (otsdataconst.OTS_GET_IMAGE_MODE enum_one in Enum.GetValues(typeof(otsdataconst.OTS_GET_IMAGE_MODE)))
{
ComboBoxItem cbi = new ComboBoxItem();
cbi.Text = GetGetImageIdString(enum_one);
cbi.Value = (int)enum_one;
IDC_COMBO_FETCHIMGMODE.Items.Add(cbi);
}
this.IDC_COMBO_FETCHIMGMODE.SelectedIndexChanged -= new System.EventHandler(this.IDC_COMBO_FETCHIMGMODE_SelectedIndexChanged);
if (IDC_COMBO_FETCHIMGMODE.Items.Count > 0)
IDC_COMBO_FETCHIMGMODE.SelectedIndex = 0;
this.IDC_COMBO_FETCHIMGMODE.SelectedIndexChanged += new System.EventHandler(this.IDC_COMBO_FETCHIMGMODE_SelectedIndexChanged);
//扫描图精度
IDC_COMBO_IMGSCANSPEED.Items.Clear();
foreach (otsdataconst.OTS_IMAGE_SCANSPEED_OPTIONS enum_one in Enum.GetValues(typeof(otsdataconst.OTS_IMAGE_SCANSPEED_OPTIONS)))
{
ComboBoxItem cbi = new ComboBoxItem();
cbi.Text = GetScanSpeedString(enum_one);
cbi.Value = (int)enum_one;
IDC_COMBO_IMGSCANSPEED.Items.Add(cbi);
}
this.IDC_COMBO_IMGSCANSPEED.SelectedIndexChanged -= new System.EventHandler(this.IDC_COMBO_IMGSCANSPEED_SelectedIndexChanged);
if (IDC_COMBO_IMGSCANSPEED.Items.Count > 0)
IDC_COMBO_IMGSCANSPEED.SelectedIndex = 0;
this.IDC_COMBO_IMGSCANSPEED.SelectedIndexChanged += new System.EventHandler(this.IDC_COMBO_IMGSCANSPEED_SelectedIndexChanged);
//扫描图尺寸
IDC_COMBO_IMGSIZE.Items.Clear();
foreach (otsdataconst.OTS_IMAGE_RESULOTION_OPTIONS enum_one in Enum.GetValues(typeof(otsdataconst.OTS_IMAGE_RESULOTION_OPTIONS)))
{
ComboBoxItem cbi = new ComboBoxItem();
cbi.Text = GetImageSizeIdString(enum_one);
cbi.Value = (int)enum_one;
IDC_COMBO_IMGSIZE.Items.Add(cbi);
}
this.IDC_COMBO_IMGSIZE.SelectedIndexChanged -= new System.EventHandler(this.IDC_COMBO_IMGSIZE_SelectedIndexChanged);
if (IDC_COMBO_IMGSIZE.Items.Count > 0)
IDC_COMBO_IMGSIZE.SelectedIndex = 0;
this.IDC_COMBO_IMGSIZE.SelectedIndexChanged += new System.EventHandler(this.IDC_COMBO_IMGSIZE_SelectedIndexChanged);
//搜索X-Ray精度
IDC_COMBO_SEARCHXRAYSPEED.Items.Clear();
foreach (otsdataconst.OTS_IMAGE_SCANSPEED_OPTIONS enum_one in Enum.GetValues(typeof(otsdataconst.OTS_IMAGE_SCANSPEED_OPTIONS)))
{
ComboBoxItem cbi = new ComboBoxItem();
cbi.Text = GetXRaySearchSpeedIdString(enum_one);
cbi.Value = (int)enum_one;
IDC_COMBO_SEARCHXRAYSPEED.Items.Add(cbi);
}
this.IDC_COMBO_SEARCHXRAYSPEED.SelectedIndexChanged -= new System.EventHandler(this.IDC_COMBO_SEARCHXRAYSPEED_SelectedIndexChanged);
if (IDC_COMBO_SEARCHXRAYSPEED.Items.Count > 0)
IDC_COMBO_SEARCHXRAYSPEED.SelectedIndex = 0;
this.IDC_COMBO_SEARCHXRAYSPEED.SelectedIndexChanged += new System.EventHandler(this.IDC_COMBO_SEARCHXRAYSPEED_SelectedIndexChanged);
//去背景方式
IDC_COMBO_BGREMOVETYPE.Items.Clear();
foreach (otsdataconst.OTS_AUTOBGREMOVETYPE enum_one in Enum.GetValues(typeof(otsdataconst.OTS_AUTOBGREMOVETYPE)))
{
ComboBoxItem cbi = new ComboBoxItem();
cbi.Text = GetBGREMOVETYPEString(enum_one);
cbi.Value = (int)enum_one;
IDC_COMBO_BGREMOVETYPE.Items.Add(cbi);
}
this.IDC_COMBO_BGREMOVETYPE.SelectedIndexChanged -= new System.EventHandler(this.IDC_COMBO_BGREMOVETYPE_SelectedIndexChanged);
if (IDC_COMBO_BGREMOVETYPE.Items.Count > 0)
IDC_COMBO_BGREMOVETYPE.SelectedIndex = 0;
this.IDC_COMBO_BGREMOVETYPE.SelectedIndexChanged += new System.EventHandler(this.IDC_COMBO_BGREMOVETYPE_SelectedIndexChanged);
//自动去背景方式
IDC_COMBO_AUTOBGREMOVETYP.Items.Clear();
foreach (otsdataconst.OTS_IMAGE_MODE enum_one in Enum.GetValues(typeof(otsdataconst.OTS_IMAGE_MODE)))
{
ComboBoxItem cbi = new ComboBoxItem();
cbi.Text = GetAUTOBGREMOVETYPEString(enum_one);
cbi.Value = (int)enum_one;
IDC_COMBO_AUTOBGREMOVETYP.Items.Add(cbi);
}
this.IDC_COMBO_AUTOBGREMOVETYP.SelectedIndexChanged -= new System.EventHandler(this.IDC_COMBO_AUTOBGREMOVETYPE_SelectedIndexChanged);
if (IDC_COMBO_AUTOBGREMOVETYP.Items.Count > 0)
IDC_COMBO_AUTOBGREMOVETYP.SelectedIndex = 0;
this.IDC_COMBO_AUTOBGREMOVETYP.SelectedIndexChanged += new System.EventHandler(this.IDC_COMBO_AUTOBGREMOVETYPE_SelectedIndexChanged);
//腐蚀膨胀系数
IDC_COMBO_CorrosionExpansionCoefficient.Items.Clear();
ComboBoxItem ci = new ComboBoxItem();
ci.Text = "0";
ci.Value = 0;
IDC_COMBO_CorrosionExpansionCoefficient.Items.Add(ci);
for (int i=1;i<6;i++)
{
ComboBoxItem cbi = new ComboBoxItem();
cbi.Text = (i*2+1).ToString();
cbi.Value = i;
IDC_COMBO_CorrosionExpansionCoefficient.Items.Add(cbi);
}
//X-Ray扫描方式
IDC_COMBO_XRAYSCANMODE.Items.Clear();
foreach (otsdataconst.OTS_X_RAY_SCAN_MODE enum_one in Enum.GetValues(typeof(otsdataconst.OTS_X_RAY_SCAN_MODE)))
{
ComboBoxItem cbi = new ComboBoxItem();
cbi.Text = GetXRayScanModeIdString(enum_one);
cbi.Value = (int)enum_one;
//只添加点扫描
IDC_COMBO_XRAYSCANMODE.Items.Add(cbi);
}
this.IDC_COMBO_XRAYSCANMODE.SelectedIndexChanged -= new System.EventHandler(this.IDC_COMBO_XRAYSCANMODE_SelectedIndexChanged);
if (IDC_COMBO_XRAYSCANMODE.Items.Count > 0)
IDC_COMBO_XRAYSCANMODE.SelectedIndex = 0;
this.IDC_COMBO_XRAYSCANMODE.SelectedIndexChanged += new System.EventHandler(this.IDC_COMBO_XRAYSCANMODE_SelectedIndexChanged);
//分析X-Ray精度
IDC_COMBO_ANALYXRAYSPEED.Items.Clear();
foreach (otsdataconst.OTS_IMAGE_SCANSPEED_OPTIONS enum_one in Enum.GetValues(typeof(otsdataconst.OTS_IMAGE_SCANSPEED_OPTIONS)))
{
ComboBoxItem cbi = new ComboBoxItem();
cbi.Text = GetXRayAnalySpeedIdString(enum_one);
cbi.Value = (int)enum_one;
IDC_COMBO_ANALYXRAYSPEED.Items.Add(cbi);
}
this.IDC_COMBO_ANALYXRAYSPEED.SelectedIndexChanged -= new System.EventHandler(this.IDC_COMBO_ANALYXRAYSPEED_SelectedIndexChanged);
if (IDC_COMBO_ANALYXRAYSPEED.Items.Count > 0)
IDC_COMBO_ANALYXRAYSPEED.SelectedIndex = 0;
this.IDC_COMBO_ANALYXRAYSPEED.SelectedIndexChanged += new System.EventHandler(this.IDC_COMBO_ANALYXRAYSPEED_SelectedIndexChanged);
//精炼工艺下拉框选项
IDC_COMBO_TECHNOLOGY.Items.Clear();
foreach (STEEL_TECHNOLOGY enum_one in Enum.GetValues(typeof(STEEL_TECHNOLOGY)))
{
ComboBoxItem cbi = new ComboBoxItem();
cbi.Text = GetSteelTechIdString((otsdataconst.STEEL_TECHNOLOGY)enum_one);
cbi.Value = (int)enum_one;
IDC_COMBO_TECHNOLOGY.Items.Add(cbi);
}
this.IDC_COMBO_TECHNOLOGY.SelectedIndexChanged -= new System.EventHandler(this.IDC_COMBO_TECHNOLOGY_SelectedIndexChanged);
if (IDC_COMBO_TECHNOLOGY.Items.Count > 0)
IDC_COMBO_TECHNOLOGY.SelectedIndex = 0;
this.IDC_COMBO_TECHNOLOGY.SelectedIndexChanged += new System.EventHandler(this.IDC_COMBO_TECHNOLOGY_SelectedIndexChanged);
//测量区域形状
cBMeasShape.Items.Clear();
foreach (otsdataconst.MEASURE_SHAPE enum_one in Enum.GetValues(typeof(otsdataconst.MEASURE_SHAPE)))
{
ComboBoxItem cbi = new ComboBoxItem();
cbi.Text = GetAreaShapeString(enum_one);
cbi.Value = (int)enum_one;
cBMeasShape.Items.Add(cbi);
}
this.cBMeasShape.SelectedIndexChanged -= new System.EventHandler(this.cBMeasShape_SelectedIndexChanged);
if (cBMeasShape.Items.Count > 0)
cBMeasShape.SelectedIndex = 0;
this.cBMeasShape.SelectedIndexChanged += new System.EventHandler(this.cBMeasShape_SelectedIndexChanged);
//模式选择
IDC_COMBO_Model.Items.Clear();
foreach (otsdataconst.RunMode enum_one in Enum.GetValues(typeof(otsdataconst.RunMode)))
{
OTSPeriodicTable.ComboBoxItem cbi = new OTSPeriodicTable.ComboBoxItem();
cbi.Text = GetRunModeString(enum_one);
cbi.Value = (int)enum_one;
IDC_COMBO_Model.Items.Add(cbi);
}
this.IDC_COMBO_Model.SelectedIndexChanged -= new System.EventHandler(this.IDC_COMBO_Model_SelectedIndexChanged);
if (IDC_COMBO_Model.Items.Count > 0)
IDC_COMBO_Model.SelectedIndex = 0;
this.IDC_COMBO_Model.SelectedIndexChanged += new System.EventHandler(this.IDC_COMBO_Model_SelectedIndexChanged);
}
public CStage GetWorkingStage()
{
CStage ls_cstageclr = m_cstagefile.GetWorkingStage();
if (null == ls_cstageclr)
{
log.Error("(OTSProgMgrInfoFun.GetWorkingStage) 获取正在工作的样品台类失败");
return ls_cstageclr;
}
return ls_cstageclr;
}
///
/// 获取正在工作的样品台ID
///
///
public int GetWorkingStageId()
{
int stageid = m_cstagefile.GetWorkingStageId();
return stageid;
}
///
/// 获取样品台信息列表
///
///
public List GetStageList()
{
List l_cstageclr = m_cstagefile.GetStagesList();
if (null == l_cstageclr)
{
log.Error("(OTSProgMgrInfoFun.GetStageList) 获取样品台信息列表失败");
return l_cstageclr;
}
return l_cstageclr;
}
///
/// 绑定样品台列表信息
///
private void BindStageCombobox()
{
//先插入正在工作的样品台
int ls_workingstageid = 0;
IDC_COMBO_STAGE.Items.Clear();
CStage ls_cstageclr = GetWorkingStage();
ComboBoxItem ls_cbi = new ComboBoxItem();
ls_cbi.Text = ls_cstageclr.GetName();
ls_workingstageid = GetWorkingStageId();
ls_cbi.Value = ls_workingstageid;
IDC_COMBO_STAGE.Items.Add(ls_cbi);
//添加其它的样品台信息
List l_cstageclr = GetStageList();
for (int i = 0; i < l_cstageclr.Count(); i++)
{
if (ls_workingstageid != i)//将已经插入过的正在工作样品台信息跳过去
{
ComboBoxItem cbi = new ComboBoxItem();
cbi.Text = l_cstageclr[i].GetName().ToString();
cbi.Value = i.ToString();
IDC_COMBO_STAGE.Items.Add(cbi);
}
}
//防止进入窗体后,马上进入下拉项选择事件,先把事件去掉,一会再注册上
this.IDC_COMBO_STAGE.SelectedIndexChanged -= new System.EventHandler(this.IDC_COMBO_STAGE_SelectedIndexChanged);
//默认选择上
if (IDC_COMBO_STAGE.Items.Count > 0)
{
IDC_COMBO_STAGE.SelectedIndex = 0;
}
this.IDC_COMBO_STAGE.SelectedIndexChanged += new System.EventHandler(this.IDC_COMBO_STAGE_SelectedIndexChanged);
}
#endregion
#region 参数相关方法封装
///
/// 读取SEM样品台参数信息
///
public void LoadSEMStageData()
{
//100倍时屏幕尺寸/mm
IDC_EDIT_SCREENWIDTH.Text = m_csemstagedata.GetScanFieldSize100().ToString();
//x轴方向
foreach (ComboBoxItem cbi in IDC_COMBO_XDIREC.Items)
{
if (cbi.Value.ToString() != "")
if (Convert.ToInt32(cbi.Value) == (int)m_csemstagedata.GetXAxisDir())
{
IDC_COMBO_XDIREC.SelectedItem = cbi;
}
}
//x轴行程/mm 起,取值时,乘1000
IDC_EDIT_XSTART.Text = (m_csemstagedata.GetXAxis().GetStart() / 1000).ToString();
//x轴行程/mm 始
IDC_EDIT_XEND.Text = (m_csemstagedata.GetXAxis().GetEnd() / 1000).ToString();
//y轴方向
foreach (ComboBoxItem cbi in IDC_COMBO_YDIRECT.Items)
{
if (cbi.Value.ToString() != "")
if (Convert.ToInt32(cbi.Value) == (int)m_csemstagedata.GetYAxisDir())
{
IDC_COMBO_YDIRECT.SelectedItem = cbi;
}
}
//y轴行程/mm 起
IDC_EDIT_YSTART.Text = (m_csemstagedata.GetYAxis().GetStart() / 1000).ToString();
//y轴行程/mm 始
IDC_EDIT_YEND.Text = (m_csemstagedata.GetYAxis().GetEnd() / 1000).ToString();
//最小放大倍数
IDC_EDIT_MINMAG.Text = m_csemstagedata.GetMinMag().ToString();
}
///
/// 加载图像扫描参数
///
public void LoadImageScanPrm()
{
//测量终止方式
tB_StopMode.Text = m_cotsimgscanprm.GetStopMode().ToString();
//终止时间
IDC_EDIT_STOP_TIME.Text = m_cotsimgscanprm.GetStopParamMeasTime().ToString();
//终止帧图数
IDC_EDIT_STOP_FIELD_NUM.Text = m_cotsimgscanprm.GetStopParamFields().ToString();
//终止夹杂物数
IDC_EDIT_STOP_INCA_NUM.Text = m_cotsimgscanprm.GetStopParamParticles().ToString();
//终止面积
IDC_EDIT_STOP_INCA_AREA.Text = m_cotsimgscanprm.GetStopParamArea().ToString();
//取图方式
foreach (ComboBoxItem cbi in IDC_COMBO_FETCHIMGMODE.Items)
{
if (cbi.Value.ToString() != "")
if (Convert.ToInt32(cbi.Value) == (int)m_cotsimgscanprm.GetFieldStartMode())
{
IDC_COMBO_FETCHIMGMODE.SelectedItem = cbi;
}
}
//扫描图精度
foreach (ComboBoxItem cbi in IDC_COMBO_IMGSCANSPEED.Items)
{
if (cbi.Value.ToString() != "")
if (Convert.ToInt32(cbi.Value) == (int)m_cotsimgscanprm.GetScanImageSpeed())
{
IDC_COMBO_IMGSCANSPEED.SelectedItem = cbi;
}
}
//扫描图尺寸
foreach (ComboBoxItem cbi in IDC_COMBO_IMGSIZE.Items)
{
if (cbi.Value.ToString() != "")
if (Convert.ToInt32(cbi.Value) == (int)m_cotsimgscanprm.GetImageResulotion())
{
IDC_COMBO_IMGSIZE.SelectedItem = cbi;
}
}
}
///
/// 加载一般常规参数
///
public void LoadCGenParam()
{
//样品名
IDC_EDIT_SAMPLENAME.Text = m_cgenparam.GetSampleName().ToString();
//执行开关
IDC_MEAS_SWITCH.Checked = m_cgenparam.GetMeasurementSwitch();
//是否使用系统库开关
IDC_SYS_LIB.Checked = m_cgenparam.GetSysSTD();
//测量参数文件夹
IDC_EDIT_MEASUREPARAMPATH.Text = m_cgenparam.GetMsrParamFileFolderName().ToString();
//颗粒分析标准库文件夹
IDC_EDIT_ANALYSESTDLIBPATH.Text = m_cgenparam.GetPartSTDLibFolderName().ToString();
//选择颗粒分析标准库
foreach (ComboBoxItem cbi in IDC_COMBO_TECHNOLOGY.Items)
{
if (cbi.Value.ToString() != "")
if (Convert.ToInt32(cbi.Value) == m_cgenparam.GetPartStdLibTypeIndex())
{
//IDC_COMBO_TECHNOLOGY.SelectedItem = cbi;
}
}
//精炼工艺选项
foreach (ComboBoxItem cbi in IDC_COMBO_TECHNOLOGY.Items)
{
if (cbi.Value.ToString() != "")
if (Convert.ToInt32(cbi.Value) == m_cgenparam.GetSteelTechnology())
{
IDC_COMBO_TECHNOLOGY.SelectedItem = cbi;
}
}
//测量区域形状
foreach (ComboBoxItem cbi in cBMeasShape.Items)
{
if (cbi.Value.ToString() != "")
if (Convert.ToInt32(cbi.Value) == (int)m_cgenparam.GetShape())
{
cBMeasShape.SelectedItem = cbi;
}
}
//测量区域面积
tBMeasArea.Text = m_cgenparam.GetArea().ToString();
//标准库选择
foreach (ComboBoxItem cbi in IDC_COMBO_STDSelect.Items)
{
if (cbi.Text.ToString() != "")
if (cbi.Text.ToString() == m_cgenparam.GetSTDSelect())
{
IDC_COMBO_STDSelect.SelectedItem = cbi;
}
}
}
///
/// 加载默认参数
///
public void LoadDefaultParam()
{
//模式
foreach (OTSPeriodicTable.ComboBoxItem cbi in IDC_COMBO_Model.Items)
{
if (cbi.Value.ToString() != "")
if (Convert.ToInt32(cbi.Value) == (int)m_cotsprogmgrparamfile.GetRunMode())
{
IDC_COMBO_Model.SelectedItem = cbi;
}
}
}
///
/// 加载图像处理参数
///
public void LoadImageProc()
{
//颗粒面积范围 最小
IDC_EDIT_PARTAREAMIN.Text = m_cotsimgprocprm.GetIncAreaRange().GetStart().ToString();
//颗粒面积范围 最大
IDC_EDIT_PARTAREAMAX.Text = m_cotsimgprocprm.GetIncAreaRange().GetEnd().ToString();
//背景灰度范围 最小
IDC_EDIT_BACKMIN.Text = m_cotsimgprocprm.GetBGGray().GetStart().ToString();
//背景灰度范围 最大
IDC_EDIT_BACKMAX.Text = m_cotsimgprocprm.GetBGGray().GetEnd().ToString();
//颗粒灰度范围 最小
IDC_EDIT_PARTMIN.Text = m_cotsimgprocprm.GetParticleGray().GetStart().ToString();
//颗粒灰度范围 最大
IDC_EDIT_PARTMAX.Text = m_cotsimgprocprm.GetParticleGray().GetEnd().ToString();
//腐蚀膨胀系数
IDC_COMBO_CorrosionExpansionCoefficient.Text=m_cotsimgprocprm.GetErrodDilateParam().ToString();
//去背景方式
foreach (ComboBoxItem cbi in IDC_COMBO_BGREMOVETYPE.Items)
{
if (cbi.Value.ToString() != "")
{
if (Convert.ToInt32(cbi.Value) == (int)m_cotsimgprocprm.GetBGRemoveType())
{
IDC_COMBO_BGREMOVETYPE.SelectedItem = cbi;
break;
}
}
}
foreach (ComboBoxItem cbi in IDC_COMBO_AUTOBGREMOVETYP.Items)
{
if (cbi.Value.ToString() != "")
{
if (Convert.ToInt32(cbi.Value) == (int)m_cotsimgprocprm.GetAutoBGRemoveType())
{
IDC_COMBO_AUTOBGREMOVETYP.SelectedItem = cbi;
break;
}
}
}
}
///
/// 加载X-Ray参数
///
public void LoadXRayParam()
{
//搜索X-ray精度
//foreach (ComboBoxItem cbi in IDC_COMBO_SEARCHXRAYSPEED.Items)
//{
// if (cbi.Value.ToString() != "")
// if (Convert.ToInt32(cbi.Value) == (int)m_cotsxrayprm.GetSearchSpeed())
// {
// IDC_COMBO_SEARCHXRAYSPEED.SelectedItem = cbi;
// }
//}
//搜索X-ray精度对应的时间
IDC_TEXTBOX_SEARCHXRAYSPEED_TIME.Text = m_cotsxrayprm.GetMidSearchAQTime().ToString();
//搜索X-ray最低计数
//IDC_EDIT_SEARCHXRAYCOUNTLIMIT.Text = m_cotsxrayprm.GetXRaySearchCount().ToString();
//X-ray扫描方式
foreach (ComboBoxItem cbi in IDC_COMBO_XRAYSCANMODE.Items)
{
if (cbi.Value.ToString() != "")
if (Convert.ToInt32(cbi.Value) == (int)m_cotsxrayprm.GetScanMode())
{
IDC_COMBO_XRAYSCANMODE.SelectedItem = cbi;
}
}
//是否使用电镜
IDC_USINGXRAY_LIB.Checked = m_cotsxrayprm.GetUsingXray();
//分析X-ray精度
foreach (ComboBoxItem cbi in IDC_COMBO_ANALYXRAYSPEED.Items)
{
if (cbi.Value.ToString() != "")
if (Convert.ToInt32(cbi.Value) == (int)m_cotsxrayprm.GetAnalySpeed())
{
IDC_COMBO_ANALYXRAYSPEED.SelectedItem = cbi;
}
}
//分析X-ray精度对应的时间
IDC_TEXTBOX_ANALYXRAYSPEED_TIME.Text = m_cotsxrayprm.GetMidAnalyAQTime().ToString();
//分析X-ray计数期望值
IDC_EDIT_ANALYXRAYAIMVALUE.Text = m_cotsxrayprm.GetAnalyExpCount().ToString();
IDC_EDIT_QuantifyMinSize.Text = m_cotsxrayprm.GetFeatureModeMinSize().ToString();
IDC_EDIT_SmallPartAQTime.Text = m_cotsxrayprm.GetFastXrayTime().ToString();
IDC_EDIT_XrayLimit.Text = m_cotsxrayprm.GetXrayLimit().ToString();
//IDC_XRAY_MODE_SWITCH.Checked = m_cotsxrayprm.GetShowScanMode();
//IDC_XRAY_TIME_SWITCH.Checked = m_cotsxrayprm.GetShowSpeed();
//IDC_XRAY_COUNT_SWITCH.Checked = m_cotsxrayprm.GetShowExpCount();
}
///
/// 保存SEM样品台参数
///
public void SaveSEMStageData()
{
//100倍时屏幕尺寸/mm
m_csemstagedata.SetScanFieldSize100(Convert.ToInt32(IDC_EDIT_SCREENWIDTH.Text));
//x轴方向
ComboBoxItem cbi_x = (ComboBoxItem)IDC_COMBO_XDIREC.SelectedItem;
m_csemstagedata.SetXAxisDir((otsdataconst.OTS_X_AXIS_DIRECTION)Convert.ToInt32(cbi_x.Value));
//x轴行程/mm 起,始
CIntRange crc_x = new CIntRange(Convert.ToInt32(IDC_EDIT_XSTART.Text) * 1000, Convert.ToInt32(IDC_EDIT_XEND.Text) * 1000);
m_csemstagedata.SetXAxis(crc_x);
//y轴方向
ComboBoxItem cbi_y = (ComboBoxItem)IDC_COMBO_YDIRECT.SelectedItem;
m_csemstagedata.SetYAxisDir((otsdataconst.OTS_Y_AXIS_DIRECTION)Convert.ToInt32(cbi_y.Value));
//y轴行程/mm 起,始
CIntRange crc_y = new CIntRange(Convert.ToInt32(IDC_EDIT_YSTART.Text) * 1000, Convert.ToInt32(IDC_EDIT_YEND.Text) * 1000);
m_csemstagedata.SetYAxis(crc_y);
//最小放大倍数
m_csemstagedata.SetMinMag(Convert.ToDouble(IDC_EDIT_MINMAG.Text));
}
///
/// 保存图像扫描参数
///
public void SaveImageScanPrm()
{
// 保存图像扫描参数");
//测量终止方式
m_cotsimgscanprm.SetStopMode(tB_StopMode.Text);
//终止时间
m_cotsimgscanprm.SetStopParamMeasTime(Convert.ToInt32(IDC_EDIT_STOP_TIME.Text));
//终止帧图数
m_cotsimgscanprm.SetStopParamFields(Convert.ToInt32(IDC_EDIT_STOP_FIELD_NUM.Text));
//终止夹杂物数
m_cotsimgscanprm.SetStopParamParticles(Convert.ToInt32(IDC_EDIT_STOP_INCA_NUM.Text));
//终止面积
m_cotsimgscanprm.SetStopParamArea(Convert.ToInt32(IDC_EDIT_STOP_INCA_AREA.Text));
//取图方式
ComboBoxItem enum_fetchimgmode = (ComboBoxItem)IDC_COMBO_FETCHIMGMODE.SelectedItem;
m_cotsimgscanprm.SetStartImageMode((otsdataconst.OTS_GET_IMAGE_MODE)Convert.ToInt32(enum_fetchimgmode.Value));
//扫描图精度
ComboBoxItem enum_imgscanspeed = (ComboBoxItem)IDC_COMBO_IMGSCANSPEED.SelectedItem;
m_cotsimgscanprm.SetScanImageSpeed((otsdataconst.OTS_IMAGE_SCANSPEED_OPTIONS)Convert.ToInt32(enum_imgscanspeed.Value));
//扫描图尺寸
ComboBoxItem enum_imgsize = (ComboBoxItem)IDC_COMBO_IMGSIZE.SelectedItem;
m_cotsimgscanprm.SetImageResulotion((otsdataconst.OTS_IMAGE_RESULOTION_OPTIONS)Convert.ToInt32(enum_imgsize.Value));
}
///
/// 保存一般常规参数
///
public void SaveCGenParam()
{
//样品名
m_cgenparam.SetSampleName(IDC_EDIT_SAMPLENAME.Text);
//执行开关
m_cgenparam.SetMeasurementSwitch(IDC_MEAS_SWITCH.Checked);
//是否使用系统库
m_cgenparam.SetSysSTD(IDC_SYS_LIB.Checked);
//测量参数文件夹
m_cgenparam.SetMsrParamFileFolderName(IDC_EDIT_MEASUREPARAMPATH.Text);
//颗粒分析标准库文件夹
m_cgenparam.SetPartSTDLibFolderName(IDC_EDIT_ANALYSESTDLIBPATH.Text);
//获取精炼工艺索引
ComboBoxItem cbiTECH = new ComboBoxItem();
cbiTECH = (ComboBoxItem)IDC_COMBO_TECHNOLOGY.SelectedItem;
//设置参数文件类中精炼工艺索引值
m_cgenparam.SetSteelTechnology((int)cbiTECH.Value);
//测量区域形状
ComboBoxItem enum_Shape = (ComboBoxItem)cBMeasShape.SelectedItem;
m_cgenparam.SetShape((otsdataconst.DOMAIN_SHAPE)Convert.ToInt32(enum_Shape.Value));
//测量区域大小
m_cgenparam.SetArea(Convert.ToDouble(tBMeasArea.Text));
//标准库选择
ComboBoxItem enum_STDLIBSELECT = (ComboBoxItem)IDC_COMBO_STDSelect.SelectedItem;
m_cgenparam.SetSTDSelect(enum_STDLIBSELECT.Text.ToString());
}
///
/// 保存图像处理参数
///
public void SaveImageProc()
{
//颗粒面积范围 最小 最大
CDoubleRange crc_partareamin = new CDoubleRange(Math.Round(Convert.ToDouble(IDC_EDIT_PARTAREAMIN.Text), 2), Math.Round(Convert.ToDouble(IDC_EDIT_PARTAREAMAX.Text), 2));
m_cotsimgprocprm.SetIncAreaRange(crc_partareamin);
//背景灰度范围 最小 最大
CIntRange crc_backmin = new CIntRange(Convert.ToInt32(IDC_EDIT_BACKMIN.Text), Convert.ToInt32(IDC_EDIT_BACKMAX.Text));
m_cotsimgprocprm.SetBGGray(crc_backmin);
//颗粒灰度范围 最小 最大
CIntRange crc_partmin = new CIntRange(Convert.ToInt32(IDC_EDIT_PARTMIN.Text), Convert.ToInt32(IDC_EDIT_PARTMAX.Text));
m_cotsimgprocprm.SetParticleGray(crc_partmin);
//去背景方式
ComboBoxItem enum_BGREMOVETYPE = (ComboBoxItem)IDC_COMBO_BGREMOVETYPE.SelectedItem;
m_cotsimgprocprm.SetBGRemoveType((otsdataconst.OTS_BGREMOVE_TYPE)enum_BGREMOVETYPE.Value);
//去背景方式
ComboBoxItem enum_AUTOBGREMOVETYP = (ComboBoxItem)IDC_COMBO_AUTOBGREMOVETYP.SelectedItem;
m_cotsimgprocprm.SetAutoBGRemoveType((otsdataconst.OTS_AUTOBGREMOVE_TYPE)enum_AUTOBGREMOVETYP.Value);
//腐蚀膨胀系数
m_cotsimgprocprm.SetErrodDilateParam(Convert.ToInt32(IDC_COMBO_CorrosionExpansionCoefficient.Text));
}
///
/// 保存X-Ray参数
///
public void SaveXRayParam()
{
//搜索X-ray精度
ComboBoxItem enum_searchxrayspeed = (ComboBoxItem)IDC_COMBO_SEARCHXRAYSPEED.SelectedItem;
//m_cotsxrayprm.SetSearchSpeed((otsdataconst.OTS_IMAGE_SCANSPEED_OPTIONS)Convert.ToInt32(enum_searchxrayspeed.Value));
//搜索X - ray精度对应的时间
m_cotsxrayprm.SetMidSearchAQTime(Convert.ToInt32(IDC_TEXTBOX_SEARCHXRAYSPEED_TIME.Text.Trim()));
//搜索X-ray最低计数
//m_cotsxrayprm.SetXRaySearchCount(Convert.ToInt32(IDC_EDIT_SEARCHXRAYCOUNTLIMIT.Text));
//X-ray扫描方式
ComboBoxItem enum_xrayscanmode = (ComboBoxItem)IDC_COMBO_XRAYSCANMODE.SelectedItem;
m_cotsxrayprm.SetScanMode((otsdataconst.OTS_X_RAY_SCAN_MODE)Convert.ToInt32(enum_xrayscanmode.Value));
//是否使用X-ray
m_cotsxrayprm.SetUsingXray(IDC_USINGXRAY_LIB.Checked);
//分析X-ray精度
ComboBoxItem enum_analyxrayspeed = (ComboBoxItem)IDC_COMBO_ANALYXRAYSPEED.SelectedItem;
m_cotsxrayprm.SetAnalySpeed((otsdataconst.OTS_IMAGE_SCANSPEED_OPTIONS)Convert.ToInt32(enum_analyxrayspeed.Value));
//分析X-ray精度对应的时间
m_cotsxrayprm.SetMidAnalyAQTime(Convert.ToInt32(IDC_TEXTBOX_ANALYXRAYSPEED_TIME.Text.Trim()));
//分析X-ray计数期望值
m_cotsxrayprm.SetAnalyExpCount(Convert.ToInt32(IDC_EDIT_ANALYXRAYAIMVALUE.Text));
m_cotsxrayprm.SetQuantifyMinSize(Convert.ToDouble(IDC_EDIT_QuantifyMinSize.Text));
m_cotsxrayprm.SetFastXrayTime(Convert.ToInt32(IDC_EDIT_SmallPartAQTime.Text));
m_cotsxrayprm.SetXrayLimit(Convert.ToInt32(IDC_EDIT_XrayLimit.Text));
//m_cotsxrayprm.SetShowScanMode(IDC_XRAY_MODE_SWITCH.Checked);
//m_cotsxrayprm.SetShowSpeed(IDC_XRAY_TIME_SWITCH.Checked);
//m_cotsxrayprm.SetShowExpCount(IDC_XRAY_COUNT_SWITCH.Checked);
}
///
/// 将参数保存到文件
///
///
///
///
///
///
///
///
public bool SaveInfoToProgMgrFile()
{
//SaveInfoToProgMgrFile()
if (false == m_cotsprogmgrparamfile.SaveInfoToProgMgrFile())
{
log.Error("(OTSProgMgrInfoFun.SaveInfoToProgMgrFile) Failed to save parameters to file");
return false;
}
return true;
}
///
/// 加载参数各个类
///
public bool LoadParamFun()
{
bool result = m_cotsprogmgrparamfile.LoadInfoFromProgMgrFile();
if (!result)
{
log.Error("(OTSProgMgrInfoFun.LoadParamFun) LoadInfoFromProgMgrFile Failed");
return false;
}
m_csemstagedata = m_cotsprogmgrparamfile.GetStageDataParam();
if (null == m_csemstagedata)
{
log.Error("(OTSProgMgrInfoFun.LoadParamFun) GetStageData Failed");
return false;
}
m_cotsimgscanprm = m_cotsprogmgrparamfile.GetImageScanParam();
if (null == m_cotsimgscanprm)
{
log.Error("(OTSProgMgrInfoFun.LoadParamFun) GetImageScanParam Failed");
return false;
}
m_cgenparam = m_cotsprogmgrparamfile.GetGenParam();
if (null == m_cgenparam)
{
log.Error("(OTSProgMgrInfoFun.LoadParamFun) GetGenParam Failed");
return false;
}
m_cotsimgprocprm = m_cotsprogmgrparamfile.GetImageProcParam();
if (null == m_cotsimgprocprm)
{
log.Error("(OTSProgMgrInfoFun.LoadParamFun) GetImageProcParam Failed");
return false;
}
m_cotsxrayprm = m_cotsprogmgrparamfile.GetXRayParam();
if (null == m_cotsxrayprm)
{
log.Error("(OTSProgMgrInfoFun.LoadParamFun) GetXRayParam Failed");
return false;
}
return true;
}
#endregion
#region 窗体加载
private void ProgMgrInfoForm_Load(object sender, EventArgs e)
{
//加载各参数类
LoadParamFun();
//初始化combobox下拉框列表
BindComboBox();
//加载相关参数信息
LoadDefaultParam();
LoadSEMStageData();
LoadImageScanPrm();
LoadCGenParam();
LoadImageProc();
LoadXRayParam();
if (m_b_checkstagefile == false)
btnok.Enabled = true;
else
btnok.Enabled = false;
//获取特殊颗粒信息
//DataTable dt = XMLoperate.GetXMLRegList(CSpecialGrayRangeParam.GetParamFileFullName(), "XMLData").Tables[0];
//if (dt.Rows.Count != 0)
//{
// if (XMLoperate.GetXMLRegList(CSpecialGrayRangeParam.GetParamFileFullName(), "XMLData").Tables[0].Rows[0]["ToRun"].ToString() == "true")
// {
// checkBox_Run.Checked = true;
// }
// else
// {
// checkBox_Run.Checked = false;
// }
//}
//关于路径定位问题
this.folderBrowserDialog1.SelectedPath = IDC_EDIT_MEASUREPARAMPATH.Text;
string strb = ".\\Config\\SysData\\";
string strc = ".\\Config\\ProData\\";
string m_STDPath = strb;
m_ParameterPath = strc;
this.folderBrowserDialog1.SelectedPath = m_ParameterPath;
IDC_EDIT_MEASUREPARAMPATH.Text = m_ParameterPath;
IDC_EDIT_ANALYSESTDLIBPATH.Text = m_STDPath;
if(m_cotsprogmgrparamfile.GetSysType() == "IncA")
{
label42.Visible = true;
IDC_COMBO_TECHNOLOGY.Visible = true;
}
else
{
label42.Visible = false;
IDC_COMBO_TECHNOLOGY.Visible = false;
}
}
#endregion
#region 各按钮控件点击事件
private void IDC_BUTTON_KLFX_Click(object sender, EventArgs e)
{
try
{
if (IDC_COMBO_STDSelect.Text != "NoSTDDB")
{
Process p = System.Diagnostics.Process.Start(".\\OTSPartA_STDEditor.exe", Application.StartupPath + "\\Config\\SysData\\" + IDC_COMBO_STDSelect.Text+".db");
p.WaitForExit();
}
else
{
string message = table["message55"].ToString();
MessageBox.Show(message, "Tip", MessageBoxButtons.OK, MessageBoxIcon.Information);
}
}
catch (Exception ex)
{
log.Error("OTSPartA_STDEditor:" + ex.ToString());
}
}
private void IDC_BUTTON_MEASPRAMPATHSET_Click(object sender, EventArgs e)
{
if (folderBrowserDialog1.ShowDialog() == DialogResult.OK)
{
IDC_EDIT_MEASUREPARAMPATH.Text = folderBrowserDialog1.SelectedPath;
}
else {
folderBrowserDialog1.SelectedPath = IDC_EDIT_MEASUREPARAMPATH.Text;
}
}
private void IDC_BUTTON_PARTSTDLIBPATHSET_Click(object sender, EventArgs e)
{
if (folderBrowserDialog1.ShowDialog() == DialogResult.OK)
{
IDC_EDIT_ANALYSESTDLIBPATH.Text = folderBrowserDialog1.SelectedPath;
}
else {
folderBrowserDialog1.SelectedPath = IDC_EDIT_ANALYSESTDLIBPATH.Text;
}
}
///
/// 弹出样品台管理窗体
///
///
///
///
public void ShowStageDialogExport()
{
DlgStageMgr dlgStageMgr = new DlgStageMgr(m_cstagefile);
dlgStageMgr.ShowDialog();
return;
}
///
/// 保存样品台信息
///
///
public bool CStageFileClrSave()
{
if (m_cstagefile == null)
{
//报错
log.Error("(OTSProgMgrInfoFun.CStageFileClrSave) Error saving sample station information!");
}
else
{
bool b_ret = m_cstagefile.Save();
if (false == b_ret)
{
log.Error("(OTSProgMgrInfoFun.CStageFileClrSave) Error saving sample table information!");
}
}
return false;
}
private void IDC_BUTTON_STAGE_Click(object sender, EventArgs e)
{
//弹出管理样品台管理窗体
ShowStageDialogExport();
//弹出后再保存样品台信息
CStageFileClrSave();
//刷新绑定样品台列表
BindStageCombobox();
//检测是否已经有修改
ThisSetIsModify();
}
///
/// 判断各控件值是否正确
///
///
private bool CheckSetupValues(int bz)
{
if ("" == IDC_COMBO_STAGE.Text)
{
string message = table["message1"].ToString();
MessageBox.Show(message, "Tip", MessageBoxButtons.OK, MessageBoxIcon.Information);
IDC_COMBO_STAGE.Focus();
IDC_COMBO_STAGE.SelectAll();
return false;
}
if ("" == IDC_EDIT_SCREENWIDTH.Text)
{
string message = table["message2"].ToString();
MessageBox.Show(message, "Tip", MessageBoxButtons.OK, MessageBoxIcon.Information);
IDC_EDIT_SCREENWIDTH.Focus();
IDC_EDIT_SCREENWIDTH.SelectAll();
return false;
}
if ("" == IDC_COMBO_XDIREC.Text)
{
string message = table["message3"].ToString();
MessageBox.Show(message, "Tip", MessageBoxButtons.OK, MessageBoxIcon.Information);
IDC_COMBO_XDIREC.Focus();
IDC_COMBO_XDIREC.SelectAll();
return false;
}
if ("" == IDC_EDIT_XSTART.Text)
{
string message = table["message4"].ToString();
MessageBox.Show(message, "Tip", MessageBoxButtons.OK, MessageBoxIcon.Information);
IDC_EDIT_XSTART.Focus();
IDC_EDIT_XSTART.SelectAll();
return false;
}
if ("" == IDC_EDIT_XEND.Text)
{
string message = table["message4"].ToString();
MessageBox.Show(message, "Tip", MessageBoxButtons.OK, MessageBoxIcon.Information);
IDC_EDIT_XEND.Focus();
IDC_EDIT_XEND.SelectAll();
return false;
}
if ("" == IDC_COMBO_YDIRECT.Text)
{
string message = table["message5"].ToString();
MessageBox.Show(message, "Tip", MessageBoxButtons.OK, MessageBoxIcon.Information);
IDC_COMBO_YDIRECT.Focus();
IDC_COMBO_YDIRECT.SelectAll();
return false;
}
if ("" == IDC_EDIT_YSTART.Text)
{
string message = table["message6"].ToString();
MessageBox.Show(message, "Tip", MessageBoxButtons.OK, MessageBoxIcon.Information);
IDC_EDIT_YSTART.Focus();
IDC_EDIT_YSTART.SelectAll();
return false;
}
if ("" == IDC_EDIT_YEND.Text)
{
string message = table["message6"].ToString();
MessageBox.Show(message, "Tip", MessageBoxButtons.OK, MessageBoxIcon.Information);
IDC_EDIT_YEND.Focus();
IDC_EDIT_YEND.SelectAll();
return false;
}
if ("" == tB_StopMode.Text)
{
string message = table["message7"].ToString();
MessageBox.Show(message, "Tip", MessageBoxButtons.OK, MessageBoxIcon.Information);
IDC_EDIT_STOP_TIME.Focus();
IDC_EDIT_STOP_TIME.SelectAll();
return false;
}
if ("" == IDC_COMBO_FETCHIMGMODE.Text)
{
string message = table["message10"].ToString();
MessageBox.Show(message, "Tip", MessageBoxButtons.OK, MessageBoxIcon.Information);
IDC_COMBO_FETCHIMGMODE.Focus();
IDC_COMBO_FETCHIMGMODE.SelectAll();
return false;
}
if ("" == IDC_COMBO_IMGSCANSPEED.Text)
{
string message = table["message11"].ToString();
MessageBox.Show(message, "Tip", MessageBoxButtons.OK, MessageBoxIcon.Information);
IDC_COMBO_IMGSCANSPEED.Focus();
IDC_COMBO_IMGSCANSPEED.SelectAll();
return false;
}
if ("" == IDC_COMBO_IMGSIZE.Text)
{
string message = table["message12"].ToString();
MessageBox.Show(message, "Tip", MessageBoxButtons.OK, MessageBoxIcon.Information);
IDC_COMBO_IMGSIZE.Focus();
IDC_COMBO_IMGSIZE.SelectAll();
return false;
}
if ("" == IDC_EDIT_MINMAG.Text)
{
string message = table["message13"].ToString();
MessageBox.Show(message, "Tip", MessageBoxButtons.OK, MessageBoxIcon.Information);
IDC_EDIT_MINMAG.Focus();
IDC_EDIT_MINMAG.SelectAll();
return false;
}
if ("" == IDC_EDIT_PARTAREAMIN.Text)
{
string message = table["message14"].ToString();
MessageBox.Show(message, "Tip", MessageBoxButtons.OK, MessageBoxIcon.Information);
IDC_EDIT_PARTAREAMIN.Focus();
IDC_EDIT_PARTAREAMIN.SelectAll();
return false;
}
if ("" == IDC_EDIT_PARTAREAMAX.Text)
{
string message = table["message15"].ToString();
MessageBox.Show(message, "Tip", MessageBoxButtons.OK, MessageBoxIcon.Information);
IDC_EDIT_PARTAREAMAX.Focus();
IDC_EDIT_PARTAREAMAX.SelectAll();
return false;
}
if ("" == IDC_EDIT_BACKMIN.Text)
{
string message = table["message16"].ToString();
MessageBox.Show(message, "Tip", MessageBoxButtons.OK, MessageBoxIcon.Information);
IDC_EDIT_BACKMIN.Focus();
IDC_EDIT_BACKMIN.SelectAll();
return false;
}
if ("" == IDC_EDIT_BACKMAX.Text)
{
string message = table["message17"].ToString();
MessageBox.Show(message, "Tip", MessageBoxButtons.OK, MessageBoxIcon.Information);
IDC_EDIT_BACKMAX.Focus();
IDC_EDIT_BACKMAX.SelectAll();
return false;
}
if ("" == IDC_EDIT_PARTMIN.Text)
{
string message = table["message18"].ToString();
MessageBox.Show(message, "Tip", MessageBoxButtons.OK, MessageBoxIcon.Information);
IDC_EDIT_PARTMIN.Focus();
IDC_EDIT_PARTMIN.SelectAll();
return false;
}
if ("" == IDC_EDIT_PARTMAX.Text)
{
string message = table["message19"].ToString();
MessageBox.Show(message, "Tip", MessageBoxButtons.OK, MessageBoxIcon.Information);
IDC_EDIT_PARTMAX.Focus();
IDC_EDIT_PARTMAX.SelectAll();
return false;
}
if ("" == IDC_COMBO_XRAYSCANMODE.Text)
{
string message = table["message20"].ToString();
MessageBox.Show(message, "Tip", MessageBoxButtons.OK, MessageBoxIcon.Information);
IDC_COMBO_XRAYSCANMODE.Focus();
IDC_COMBO_XRAYSCANMODE.SelectAll();
return false;
}
if ("" == IDC_COMBO_ANALYXRAYSPEED.Text)
{
string message = table["message21"].ToString();
MessageBox.Show(message, "Tip", MessageBoxButtons.OK, MessageBoxIcon.Information);
IDC_COMBO_ANALYXRAYSPEED.Focus();
IDC_COMBO_ANALYXRAYSPEED.SelectAll();
return false;
}
if ("" == IDC_EDIT_ANALYXRAYAIMVALUE.Text)
{
string message = table["message22"].ToString();
MessageBox.Show(message, "Tip", MessageBoxButtons.OK, MessageBoxIcon.Information);
IDC_EDIT_ANALYXRAYAIMVALUE.Focus();
IDC_EDIT_ANALYXRAYAIMVALUE.SelectAll();
return false;
}
if ("" == tBMeasArea.Text)
{
string message = table["message62"].ToString();
MessageBox.Show(message, "Tip", MessageBoxButtons.OK, MessageBoxIcon.Information);
tBMeasArea.Focus();
tBMeasArea.SelectAll();
return false;
}
if ("" == IDC_COMBO_CorrosionExpansionCoefficient.Text)
{
string message = table["message62"].ToString();
MessageBox.Show(message, "Tip", MessageBoxButtons.OK, MessageBoxIcon.Information);
IDC_COMBO_CorrosionExpansionCoefficient.Focus();
IDC_COMBO_CorrosionExpansionCoefficient.SelectAll();
return false;
}
//string pat = @"^(-|\+)?\d{1,8}$";//只能输入1到3位的正负整数
string pat = @"^-?[0-9]\d*$";//只能限定正负整数,包含0
string scope = @"^(\d|[1-9]\d|1\d\d|2[0-4]\d|25[0-5])$";
string PositiveDecimals = @"^(([1-9]\d*)(\.\d+)?)$|^0\.\d*[1-9]$"; //正浮点数
string positiveInteger = @"^?[0-9]\d*$";//只能限定正整数,包含0
string positiveOddNumber = @"[^1,3,5,7,9]";//只能限定正奇数
Regex rg = new Regex(pat);
Regex rgScope = new Regex(scope);
Regex rgPositiveDecimals = new Regex(PositiveDecimals);
Regex rgpositiveInteger = new Regex(positiveInteger);
Regex rgpositiveOddNumber = new Regex(positiveOddNumber);
//是否是正确的数值格式类型判断
if(IDC_COMBO_CorrosionExpansionCoefficient.Text!="0")
{
if (rgpositiveOddNumber.Match(IDC_COMBO_CorrosionExpansionCoefficient.Text.Trim()).Success)
{
IDC_COMBO_CorrosionExpansionCoefficient.Focus();
IDC_COMBO_CorrosionExpansionCoefficient.SelectAll();
string message = table["message66"].ToString();
MessageBox.Show(message, "Tip", MessageBoxButtons.OK, MessageBoxIcon.Information);
return false;
}
}
//100倍时屏幕尺寸
if (false == rg.Match(IDC_EDIT_SCREENWIDTH.Text.Trim()).Success)
{
IDC_EDIT_SCREENWIDTH.Focus();
IDC_EDIT_SCREENWIDTH.SelectAll();
string message = table["message23"].ToString();
MessageBox.Show(message, "Tip", MessageBoxButtons.OK, MessageBoxIcon.Information);
return false;
}
//x轴行程/mm 起
if (false == rg.Match(IDC_EDIT_XSTART.Text.Trim()).Success)
{
IDC_EDIT_XSTART.Focus();
IDC_EDIT_XSTART.SelectAll();
string message = table["message24"].ToString();
MessageBox.Show(message, "Tip", MessageBoxButtons.OK, MessageBoxIcon.Information);
return false;
}
//x轴行程/mm 止
if (false == rg.Match(IDC_EDIT_XEND.Text.Trim()).Success)
{
IDC_EDIT_XEND.Focus();
IDC_EDIT_XEND.SelectAll();
string message = table["message25"].ToString();
MessageBox.Show(message, "Tip", MessageBoxButtons.OK, MessageBoxIcon.Information);
return false;
}
//y轴行程/mm 起
if (false == rg.Match(IDC_EDIT_YSTART.Text.Trim()).Success)
{
IDC_EDIT_YSTART.Focus();
IDC_EDIT_YSTART.SelectAll();
string message = table["message26"].ToString();
MessageBox.Show(message, "Tip", MessageBoxButtons.OK, MessageBoxIcon.Information);
return false;
}
//y轴行程/mm 止
if (false == rg.Match(IDC_EDIT_YEND.Text.Trim()).Success)
{
IDC_EDIT_YEND.Focus();
IDC_EDIT_YEND.SelectAll();
string message = table["message27"].ToString();
MessageBox.Show(message, "Tip", MessageBoxButtons.OK, MessageBoxIcon.Information);
return false;
}
//颗粒面积范围 最小
if (false == rgPositiveDecimals.Match(IDC_EDIT_PARTAREAMIN.Text.Trim()).Success)
{
IDC_EDIT_PARTAREAMIN.Focus();
IDC_EDIT_PARTAREAMIN.SelectAll();
string message = table["message31"].ToString();
MessageBox.Show(message, "Tip", MessageBoxButtons.OK, MessageBoxIcon.Information);
return false;
}
//颗粒面积范围 最大
if (false == rgPositiveDecimals.Match(IDC_EDIT_PARTAREAMAX.Text.Trim()).Success)
{
IDC_EDIT_PARTAREAMAX.Focus();
IDC_EDIT_PARTAREAMAX.SelectAll();
string message = table["message32"].ToString();
MessageBox.Show(message, "Tip", MessageBoxButtons.OK, MessageBoxIcon.Information);
return false;
}
//背景灰度范围 最小
if (false == rg.Match(IDC_EDIT_BACKMIN.Text.Trim()).Success)
{
IDC_EDIT_BACKMIN.Focus();
IDC_EDIT_BACKMIN.SelectAll();
string message = table["message33"].ToString();
MessageBox.Show(message, "Tip", MessageBoxButtons.OK, MessageBoxIcon.Information);
return false;
}
else
{
if (false == rgScope.Match(IDC_EDIT_BACKMIN.Text.Trim()).Success)
{
IDC_EDIT_BACKMIN.Focus();
IDC_EDIT_BACKMIN.SelectAll();
string message = table["message34"].ToString();
MessageBox.Show(message, "Tip", MessageBoxButtons.OK, MessageBoxIcon.Information);
return false;
}
}
//背景灰度范围 最大
if (false == rg.Match(IDC_EDIT_BACKMAX.Text.Trim()).Success)
{
IDC_EDIT_BACKMAX.Focus();
IDC_EDIT_BACKMAX.SelectAll();
string message = table["message35"].ToString();
MessageBox.Show(message, "Tip", MessageBoxButtons.OK, MessageBoxIcon.Information);
return false;
}
else
{
if (false == rgScope.Match(IDC_EDIT_BACKMAX.Text.Trim()).Success)
{
IDC_EDIT_BACKMAX.Focus();
IDC_EDIT_BACKMAX.SelectAll();
string message = table["message36"].ToString();
MessageBox.Show(message, "Tip", MessageBoxButtons.OK, MessageBoxIcon.Information);
return false;
}
}
//颗粒灰度范围 最小
if (false == rg.Match(IDC_EDIT_PARTMIN.Text.Trim()).Success)
{
IDC_EDIT_PARTMIN.Focus();
IDC_EDIT_PARTMIN.SelectAll();
string message = table["message37"].ToString();
MessageBox.Show(message, "Tip", MessageBoxButtons.OK, MessageBoxIcon.Information);
return false;
}
else
{
if (false == rgScope.Match(IDC_EDIT_PARTMIN.Text.Trim()).Success)
{
IDC_EDIT_PARTMIN.Focus();
IDC_EDIT_PARTMIN.SelectAll();
string message = table["message38"].ToString();
MessageBox.Show(message, "Tip", MessageBoxButtons.OK, MessageBoxIcon.Information);
return false;
}
}
//颗粒灰度范围 最大
if (false == rg.Match(IDC_EDIT_PARTMAX.Text.Trim()).Success)
{
IDC_EDIT_PARTMAX.Focus();
IDC_EDIT_PARTMAX.SelectAll();
string message = table["message39"].ToString();
MessageBox.Show(message, "Tip", MessageBoxButtons.OK, MessageBoxIcon.Information);
return false;
}
else
{
if (false == rgScope.Match(IDC_EDIT_PARTMAX.Text.Trim()).Success)
{
IDC_EDIT_PARTMAX.Focus();
IDC_EDIT_PARTMAX.SelectAll();
string message = table["message40"].ToString();
MessageBox.Show(message, "Tip", MessageBoxButtons.OK, MessageBoxIcon.Information);
return false;
}
}
//分析X-ray计数期望值 最大
if (false == rg.Match(IDC_EDIT_ANALYXRAYAIMVALUE.Text.Trim()).Success)
{
IDC_EDIT_ANALYXRAYAIMVALUE.Focus();
IDC_EDIT_ANALYXRAYAIMVALUE.SelectAll();
string message = table["message41"].ToString();
MessageBox.Show(message, "Tip", MessageBoxButtons.OK, MessageBoxIcon.Information);
return false;
}
//分析X-ray精度对应的时间
if (false == rg.Match(IDC_TEXTBOX_ANALYXRAYSPEED_TIME.Text.Trim()).Success)
{
IDC_TEXTBOX_ANALYXRAYSPEED_TIME.Focus();
IDC_TEXTBOX_ANALYXRAYSPEED_TIME.SelectAll();
string message = table["message42"].ToString();
MessageBox.Show(message, "Tip", MessageBoxButtons.OK, MessageBoxIcon.Information);
return false;
}
if (false == rgPositiveDecimals.Match(IDC_EDIT_QuantifyMinSize.Text.Trim()).Success)
{
IDC_EDIT_QuantifyMinSize.Focus();
IDC_EDIT_QuantifyMinSize.SelectAll();
string message = table["message63"].ToString();
MessageBox.Show(message, "Tip", MessageBoxButtons.OK, MessageBoxIcon.Information);
return false;
}
if (false == rg.Match(IDC_EDIT_SmallPartAQTime.Text.Trim()).Success)
{
IDC_EDIT_SmallPartAQTime.Focus();
IDC_EDIT_SmallPartAQTime.SelectAll();
string message = table["message64"].ToString();
MessageBox.Show(message, "Tip", MessageBoxButtons.OK, MessageBoxIcon.Information);
return false;
}
pat = @"^[0-9]+(\.[0-9]{1,3})?$"; //只能输入,1到3位小数的正数
rg = new Regex(pat);
//最小放大倍数
if (false == rg.Match(IDC_EDIT_MINMAG.Text.Trim()).Success)
{
IDC_EDIT_MINMAG.Focus();
IDC_EDIT_MINMAG.SelectAll();
string message = table["message43"].ToString();
MessageBox.Show(message, "Tip", MessageBoxButtons.OK, MessageBoxIcon.Information);
return false;
}
////最小放大倍数不得小于45倍
//if (Convert.ToInt32(IDC_EDIT_MINMAG.Text.Trim()) < 45)
//{
// IDC_EDIT_MINMAG.Focus();
// IDC_EDIT_MINMAG.SelectAll();
// string message = "The minimum magnification cannot be less than 45 times";
// MessageBox.Show(message, "Tip", MessageBoxButtons.OK, MessageBoxIcon.Information);
// return false;
//}
//再限制,x轴,y轴,的起止的,输入长度,因为现在已经有在mm和um之间的转换,所以这里要限制一下
//x轴行程/mm 起
if (IDC_EDIT_XSTART.Text.Length > 4)
{
IDC_EDIT_XSTART.Focus();
IDC_EDIT_XSTART.SelectAll();
string message = table["message44"].ToString();
MessageBox.Show(message, "Tip", MessageBoxButtons.OK, MessageBoxIcon.Information);
return false;
}
//x轴行程/mm 止
if (IDC_EDIT_XEND.Text.Length > 4)
{
IDC_EDIT_XEND.Focus();
IDC_EDIT_XEND.SelectAll();
string message = table["message45"].ToString();
MessageBox.Show(message, "Tip", MessageBoxButtons.OK, MessageBoxIcon.Information);
return false;
}
//y轴行程/mm 起
if (IDC_EDIT_YSTART.Text.Length > 4)
{
IDC_EDIT_YSTART.Focus();
IDC_EDIT_YSTART.SelectAll();
string message = table["message46"].ToString();
MessageBox.Show(message, "Tip", MessageBoxButtons.OK, MessageBoxIcon.Information);
return false;
}
//y轴行程/mm 止
if (IDC_EDIT_YEND.Text.Length > 4)
{
IDC_EDIT_YEND.Focus();
IDC_EDIT_YEND.SelectAll();
string message = table["message47"].ToString();
MessageBox.Show(message, "Tip", MessageBoxButtons.OK, MessageBoxIcon.Information);
return false;
}
if (Convert.ToInt32(IDC_EDIT_XSTART.Text.Trim()) > Convert.ToInt32(IDC_EDIT_XEND.Text.Trim()))
{
IDC_EDIT_XEND.Focus();
IDC_EDIT_XEND.SelectAll();
string message = table["message50"].ToString();
MessageBox.Show(message, "Tip", MessageBoxButtons.OK, MessageBoxIcon.Information);
return false;
}
if (Convert.ToInt32(IDC_EDIT_YSTART.Text.Trim()) > Convert.ToInt32(IDC_EDIT_YEND.Text.Trim()))
{
IDC_EDIT_YEND.Focus();
IDC_EDIT_YEND.SelectAll();
string message = table["message53"].ToString();
MessageBox.Show(message, "Tip", MessageBoxButtons.OK, MessageBoxIcon.Information);
return false;
}
//颗粒尺寸范围
if (Convert.ToDouble(IDC_EDIT_PARTAREAMIN.Text.Trim()) > Convert.ToDouble(IDC_EDIT_PARTAREAMAX.Text.Trim()))
{
IDC_EDIT_PARTAREAMIN.Focus();
IDC_EDIT_PARTAREAMIN.SelectAll();
string message = table["message56"].ToString();
MessageBox.Show(message, "Tip", MessageBoxButtons.OK, MessageBoxIcon.Information);
return false;
}
//背景灰度范围
if (Convert.ToInt32(IDC_EDIT_BACKMIN.Text.Trim()) > Convert.ToInt32(IDC_EDIT_BACKMAX.Text.Trim()))
{
IDC_EDIT_BACKMIN.Focus();
IDC_EDIT_BACKMIN.SelectAll();
string message = table["message57"].ToString();
MessageBox.Show(message, "Tip", MessageBoxButtons.OK, MessageBoxIcon.Information);
return false;
}
//颗粒灰度范围
if (Convert.ToInt32(IDC_EDIT_PARTMIN.Text.Trim()) > Convert.ToInt32(IDC_EDIT_PARTMAX.Text.Trim()))
{
IDC_EDIT_PARTMIN.Focus();
IDC_EDIT_PARTMIN.SelectAll();
string message = table["message58"].ToString();
MessageBox.Show(message, "Tip", MessageBoxButtons.OK, MessageBoxIcon.Information);
return false;
}
//最小放大倍数
if (false == rgpositiveInteger.Match(IDC_EDIT_XrayLimit.Text.Trim()).Success)
{
IDC_EDIT_XrayLimit.Focus();
IDC_EDIT_XrayLimit.SelectAll();
string message = table["message64"].ToString();
MessageBox.Show(message, "Tip", MessageBoxButtons.OK, MessageBoxIcon.Information);
return false;
}
return true;
}
///
/// 判断当前样品台是否在被修改
///
///
public bool IsModified()
{
return m_cstagefile.IsModified();
}
///
/// 样品台保存
///
///
public bool StageSave()
{
if (!m_cstagefile.Save())
{
log.Error("(OTSProgMgrInfoFun.StageLoad) Failed to save sample station information!");
return false;
}
return true;
}
private void btnok_Click(object sender, EventArgs e)
{
//先判断
if (false == CheckSetupValues(1))
{
return;
}
//先把各个值都保存到各类
m_cotsprogmgrparamfile.m_runmode = (RunMode)IDC_COMBO_Model.SelectedIndex;
SaveSEMStageData();
SaveImageScanPrm();
SaveCGenParam();
SaveImageProc();
SaveXRayParam();
//然后再把各类传入到SaveInfoToProgMgrFile函数中
if (false == SaveInfoToProgMgrFile())
{
return;
}
//保存样品台到文件,在被修改时进行保存
if (true == IsModified())
{
if (true == StageSave())
{
this.DialogResult = DialogResult.OK;
this.Close();
return;
}
else
{
string message = table["message54"].ToString();
log.Error("(ProgMgrInfoForm.btnok_Click) " + message);
this.Close();
return;
}
}
}
//关闭窗体
private void btncancel_Click(object sender, EventArgs e)
{
this.Close();
}
#endregion
#region 选择样品台事件
private void IDC_COMBO_STAGE_SelectedIndexChanged(object sender, EventArgs e)
{
//样品台
if (!StageLoad())
{
this.Close();
return;//加载失败返回
}
ThisSetIsModify();
//加载相关参数信息
//StageLoad();
//LoadSEMStageData();
//LoadImageScanPrm();
//LoadCGenParam();
//LoadImageProc();
//LoadXRayParam();
}
///
/// 通过id设置当前正在工作的样品台
///
///
public void SetWorkingStageId(int id)
{
m_cstagefile.SetWorkingStageId(id);
}
///
/// 设置当前样品台正在被修改中
///
///
public void SetModify(bool yn)
{
m_cstagefile.SetModify(true);
}
///
/// 设置当前窗体可以保存了
///
private void ThisSetIsModify()
{
ComboBoxItem cbi = new ComboBoxItem();
if (IDC_COMBO_STAGE.Items.Count > 0)
if (null != IDC_COMBO_STAGE.SelectedItem)
{
cbi = (ComboBoxItem)IDC_COMBO_STAGE.SelectedItem;
SetWorkingStageId(Convert.ToInt32(cbi.Value));
SetModify(true);
btnok.Enabled = true;
}
}
#endregion
#region 监视控件改变状态事件
private void IDC_EDIT_SCREENWIDTH_TextChanged(object sender, EventArgs e)
{
ThisSetIsModify();
}
private void IDC_COMBO_XDIREC_SelectedIndexChanged(object sender, EventArgs e)
{
ThisSetIsModify();
}
private void IDC_EDIT_XSTART_TextChanged(object sender, EventArgs e)
{
ThisSetIsModify();
}
private void IDC_EDIT_XEND_TextChanged(object sender, EventArgs e)
{
ThisSetIsModify();
}
private void IDC_COMBO_YDIRECT_SelectedIndexChanged(object sender, EventArgs e)
{
ThisSetIsModify();
}
private void IDC_EDIT_YSTART_TextChanged(object sender, EventArgs e)
{
ThisSetIsModify();
}
private void IDC_EDIT_YEND_TextChanged(object sender, EventArgs e)
{
ThisSetIsModify();
}
private void IDC_EDIT_MINMAG_TextChanged(object sender, EventArgs e)
{
ThisSetIsModify();
}
private void IDC_COMBO_STOPMODE_SelectedIndexChanged(object sender, EventArgs e)
{
ThisSetIsModify();
}
private void IDC_EDIT_STOP_TIME_TextChanged(object sender, EventArgs e)
{
ThisSetIsModify();
}
private void IDC_EDIT_STOP_FIELD_NUM_TextChanged(object sender, EventArgs e)
{
ThisSetIsModify();
}
private void IDC_EDIT_STOP_INCA_NUM_TextChanged(object sender, EventArgs e)
{
ThisSetIsModify();
}
private void IDC_COMBO_FETCHIMGMODE_SelectedIndexChanged(object sender, EventArgs e)
{
ThisSetIsModify();
}
private void IDC_COMBO_IMGSCANSPEED_SelectedIndexChanged(object sender, EventArgs e)
{
ThisSetIsModify();
}
private void IDC_COMBO_IMGSIZE_SelectedIndexChanged(object sender, EventArgs e)
{
ThisSetIsModify();
}
private void IDC_EDIT_SAMPLENAME_TextChanged(object sender, EventArgs e)
{
ThisSetIsModify();
}
private void IDC_MEAS_SWITCH_CheckedChanged(object sender, EventArgs e)
{
ThisSetIsModify();
}
private void IDC_EDIT_MEASUREPARAMPATH_TextChanged(object sender, EventArgs e)
{
ThisSetIsModify();
}
private void IDC_EDIT_ANALYSESTDLIBPATH_TextChanged(object sender, EventArgs e)
{
ThisSetIsModify();
}
private void IDC_EDIT_STDLIBNAME_TextChanged(object sender, EventArgs e)
{
ThisSetIsModify();
}
private void IDC_EDIT_PARTAREAMIN_TextChanged(object sender, EventArgs e)
{
ThisSetIsModify();
}
private void IDC_EDIT_PARTAREAMAX_TextChanged(object sender, EventArgs e)
{
ThisSetIsModify();
}
private void IDC_EDIT_BACKMIN_TextChanged(object sender, EventArgs e)
{
ThisSetIsModify();
}
private void IDC_EDIT_BACKMAX_TextChanged(object sender, EventArgs e)
{
ThisSetIsModify();
}
private void IDC_EDIT_PARTMIN_TextChanged(object sender, EventArgs e)
{
ThisSetIsModify();
}
private void IDC_EDIT_PARTMAX_TextChanged(object sender, EventArgs e)
{
ThisSetIsModify();
}
private void IDC_COMBO_AUTOBGREMOVETYPE_SelectedIndexChanged(object sender, EventArgs e)
{
ThisSetIsModify();
}
private void IDC_COMBO_BGREMOVETYPE_SelectedIndexChanged(object sender, EventArgs e)
{
ComboBox cbBGREMOVETYPE = (ComboBox)sender;
int selectValue=Convert.ToInt32(((OTSMeasureApp.ComboBoxItem)cbBGREMOVETYPE.Items[cbBGREMOVETYPE.SelectedIndex]).Value);
if (selectValue == (int)otsdataconst.OTS_AUTOBGREMOVETYPE.MANUAL)
{
IDC_COMBO_AUTOBGREMOVETYP.Enabled = false;
}
else
{
IDC_COMBO_AUTOBGREMOVETYP.Enabled = true;
}
ThisSetIsModify();
}
private void IDC_COMBO_SEARCHXRAYSPEED_SelectedIndexChanged(object sender, EventArgs e)
{
ThisSetIsModify();
}
private void IDC_EDIT_SEARCHXRAYCOUNTLIMIT_TextChanged(object sender, EventArgs e)
{
ThisSetIsModify();
}
private void IDC_COMBO_XRAYSCANMODE_SelectedIndexChanged(object sender, EventArgs e)
{
ThisSetIsModify();
}
private void IDC_COMBO_ANALYXRAYSPEED_SelectedIndexChanged(object sender, EventArgs e)
{
ThisSetIsModify();
}
private void IDC_EDIT_ANALYXRAYAIMVALUE_TextChanged(object sender, EventArgs e)
{
ThisSetIsModify();
}
//选择颗粒标准库下拉框
//private void IDC_COMBO_STDLIBSELECT_SelectedIndexChanged(object sender, EventArgs e)
//{
// ComboBoxItem cbi = new ComboBoxItem();
// cbi = (ComboBoxItem)IDC_COMBO_STDLIBSELECT.SelectedItem;
// ThisSetIsModify();
//}
private void IDC_COMBO_TECHNOLOGY_SelectedIndexChanged(object sender, EventArgs e)
{
ThisSetIsModify();
}
private void IDC_STOP_MODE_SWITCH_CheckedChanged(object sender, EventArgs e)
{
ThisSetIsModify();
}
private void IDC_STOP_TIME_SWITCH_CheckedChanged(object sender, EventArgs e)
{
ThisSetIsModify();
}
private void IDC_STOP_FIELD_SWITCH_CheckedChanged(object sender, EventArgs e)
{
ThisSetIsModify();
}
private void IDC_STOP_PARTICAL_SWITCH_CheckedChanged(object sender, EventArgs e)
{
ThisSetIsModify();
}
private void IDC_FETCH_IMAGE_SWITCH_CheckedChanged(object sender, EventArgs e)
{
ThisSetIsModify();
}
private void IDC_SCAN_SPEED_SWITCH_CheckedChanged(object sender, EventArgs e)
{
ThisSetIsModify();
}
private void IDC_IMAGE_SIZE_SWITCH_CheckedChanged(object sender, EventArgs e)
{
ThisSetIsModify();
}
private void IDC_PART_MIN_SWITCH_CheckedChanged(object sender, EventArgs e)
{
ThisSetIsModify();
}
private void IDC_PART_MAX_SWITCH_CheckedChanged(object sender, EventArgs e)
{
ThisSetIsModify();
}
private void IDC_BACK_MIN_SWITCH_CheckedChanged(object sender, EventArgs e)
{
ThisSetIsModify();
}
private void IDC_BACK_MAX_SWITCH_CheckedChanged(object sender, EventArgs e)
{
ThisSetIsModify();
}
private void IDC_PART_GRAY_SWITCH_CheckedChanged(object sender, EventArgs e)
{
ThisSetIsModify();
}
private void IDC_PART_GRAY_MAX_CheckedChanged(object sender, EventArgs e)
{
ThisSetIsModify();
}
private void IDC_XRAY_MODE_SWITCH_CheckedChanged(object sender, EventArgs e)
{
ThisSetIsModify();
}
private void IDC_XRAY_TIME_SWITCH_CheckedChanged(object sender, EventArgs e)
{
ThisSetIsModify();
}
private void IDC_XRAY_COUNT_SWITCH_CheckedChanged(object sender, EventArgs e)
{
ThisSetIsModify();
}
private void cBMeasShape_SelectedIndexChanged(object sender, EventArgs e)
{
ThisSetIsModify();
}
private void tBMeasArea_TextChanged(object sender, EventArgs e)
{
ThisSetIsModify();
}
private void IDC_SYS_LIB_CheckedChanged(object sender, EventArgs e)
{
ThisSetIsModify();
}
#endregion
private void IDC_COMBO_STDSelect_SelectedIndexChanged(object sender, EventArgs e)
{
ThisSetIsModify();
}
private void IDC_COMBO_USINGXRAYS_SelectedIndexChanged(object sender, EventArgs e)
{
ThisSetIsModify();
}
private void IDC_COMBO_Model_SelectedIndexChanged(object sender, EventArgs e)
{
ThisSetIsModify();
}
private void btn_StopMode_Click(object sender, EventArgs e)
{
if (StopModeDialog == null)
{
StopModeDialog = new MeasureStopMode();
StopModeDialog.FieldMode = m_cotsimgscanprm.GetStopParamFields();
StopModeDialog.TimeMode = m_cotsimgscanprm.GetStopParamMeasTime();
StopModeDialog.ParticleMode = m_cotsimgscanprm.GetStopParamParticles();
StopModeDialog.AreaMode = m_cotsimgscanprm.GetStopParamArea();
StopModeDialog.StopMode = tB_StopMode.Text;
}
DialogResult result = StopModeDialog.ShowDialog();
if (result == DialogResult.OK)
{
string[] rst = StopModeDialog.StopMode.Split(',');
string str = "";
for (int k = 0; k < rst.Length; k++)
{
str += rst[k].Split(':')[0] + " + ";
}
tB_StopMode.Text = str.Substring(0, str.Length - 3);
IDC_EDIT_STOP_TIME.Text = StopModeDialog.TimeMode.ToString();
IDC_EDIT_STOP_FIELD_NUM.Text = StopModeDialog.FieldMode.ToString();
IDC_EDIT_STOP_INCA_NUM.Text = StopModeDialog.ParticleMode.ToString();
IDC_EDIT_STOP_INCA_AREA.Text = StopModeDialog.AreaMode.ToString();
}
}
private void IDC_COMBO_CorrosionExpansionCoefficient_TextChanged(object sender, EventArgs e)
{
ThisSetIsModify();
}
private void button_SpPart_Click(object sender, EventArgs e)
{
//System.Diagnostics.Process.Start("notepad.exe", CSpecialGrayRangeParam.GetParamFileFullName());
//SpecialParticleForm specialParticleForm = new SpecialParticleForm(CSpecialGrayRangeParam.GetParamFileFullName());
//specialParticleForm.ShowDialog();
}
private void checkBox_Run_CheckedChanged(object sender, EventArgs e)
{
//if (checkBox_Run.Checked)
//{
// XMLoperate.UpdateXMLRegList(CSpecialGrayRangeParam.GetParamFileFullName(), "XMLData", "0", "ToRun", "true");
//}
//else
//{
// XMLoperate.UpdateXMLRegList(CSpecialGrayRangeParam.GetParamFileFullName(), "XMLData", "0", "ToRun", "false");
//}
}
}
public class ComboBoxItem
{
private string _text = null;
private object _value = null;
public string Text { get { return this._text; } set { this._text = value; } }
public object Value { get { return this._value; } set { this._value = value; } }
public override string ToString()
{
return this._text;
}
}
}