12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217121812191220122112221223122412251226122712281229123012311232123312341235123612371238123912401241124212431244124512461247124812491250125112521253125412551256125712581259126012611262126312641265126612671268126912701271127212731274127512761277127812791280128112821283128412851286128712881289129012911292129312941295129612971298129913001301130213031304130513061307130813091310131113121313131413151316131713181319132013211322132313241325132613271328132913301331133213331334133513361337133813391340134113421343134413451346134713481349135013511352135313541355135613571358135913601361136213631364136513661367136813691370137113721373137413751376137713781379138013811382138313841385138613871388138913901391139213931394139513961397139813991400140114021403140414051406140714081409141014111412141314141415141614171418141914201421142214231424142514261427142814291430143114321433143414351436143714381439144014411442144314441445144614471448144914501451145214531454145514561457145814591460146114621463146414651466146714681469147014711472147314741475147614771478147914801481148214831484148514861487148814891490149114921493149414951496149714981499150015011502150315041505150615071508150915101511151215131514151515161517151815191520152115221523152415251526152715281529153015311532153315341535153615371538153915401541154215431544154515461547154815491550155115521553155415551556155715581559156015611562156315641565156615671568156915701571157215731574157515761577157815791580158115821583158415851586158715881589159015911592159315941595159615971598159916001601160216031604160516061607160816091610161116121613161416151616161716181619162016211622162316241625162616271628162916301631163216331634163516361637163816391640164116421643164416451646164716481649165016511652165316541655165616571658165916601661166216631664166516661667166816691670167116721673167416751676167716781679168016811682168316841685168616871688168916901691169216931694169516961697169816991700170117021703170417051706170717081709171017111712171317141715171617171718171917201721172217231724172517261727172817291730173117321733173417351736173717381739174017411742174317441745174617471748174917501751175217531754175517561757175817591760176117621763176417651766176717681769177017711772177317741775177617771778177917801781178217831784178517861787178817891790179117921793179417951796179717981799180018011802180318041805180618071808180918101811181218131814181518161817181818191820182118221823182418251826182718281829183018311832183318341835183618371838183918401841184218431844184518461847184818491850185118521853185418551856185718581859186018611862186318641865186618671868186918701871187218731874187518761877187818791880188118821883188418851886188718881889189018911892189318941895189618971898189919001901190219031904190519061907190819091910191119121913191419151916191719181919192019211922192319241925192619271928192919301931193219331934193519361937193819391940194119421943194419451946194719481949195019511952195319541955195619571958195919601961196219631964196519661967196819691970197119721973197419751976197719781979198019811982198319841985198619871988198919901991199219931994199519961997199819992000200120022003200420052006200720082009201020112012201320142015201620172018201920202021202220232024202520262027202820292030203120322033203420352036203720382039204020412042204320442045204620472048204920502051205220532054205520562057205820592060206120622063206420652066206720682069207020712072207320742075207620772078207920802081208220832084208520862087208820892090209120922093209420952096209720982099210021012102210321042105210621072108 |
- 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
- /// <summary>
- /// 样品台加载
- /// </summary>
- /// <returns></returns>
- public bool StageLoad()
- {
- if (!m_cstagefile.Load( true, !m_b_checkstagefile))
- {
- log.Error("(OTSProgMgrInfoFun.StageLoad) 加载样品台信息失败");
- return false;
- }
- return true;
- }
- #region 构造函数
- /// <summary>
- /// 默认构造函数
- /// </summary>
- 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控件
- /// <summary>
- /// 绑定各combobox控件下拉列表
- /// </summary>
- 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;
- }
- /// <summary>
- /// 获取正在工作的样品台ID
- /// </summary>
- /// <returns></returns>
- public int GetWorkingStageId()
- {
- int stageid = m_cstagefile.GetWorkingStageId();
- return stageid;
- }
- /// <summary>
- /// 获取样品台信息列表
- /// </summary>
- /// <returns></returns>
- public List<CStage> GetStageList()
- {
- List<CStage> l_cstageclr = m_cstagefile.GetStagesList();
- if (null == l_cstageclr)
- {
- log.Error("(OTSProgMgrInfoFun.GetStageList) 获取样品台信息列表失败");
- return l_cstageclr;
- }
- return l_cstageclr;
- }
- /// <summary>
- /// 绑定样品台列表信息
- /// </summary>
- 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<CStage> 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 参数相关方法封装
- /// <summary>
- /// 读取SEM样品台参数信息
- /// </summary>
- 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();
- }
- /// <summary>
- /// 加载图像扫描参数
- /// </summary>
- 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;
- }
- }
- }
- /// <summary>
- /// 加载一般常规参数
- /// </summary>
- 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;
- }
- }
-
- }
- /// <summary>
- /// 加载默认参数
- /// </summary>
- 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;
- }
- }
- }
- /// <summary>
- /// 加载图像处理参数
- /// </summary>
- 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;
- }
- }
- }
- }
- /// <summary>
- /// 加载X-Ray参数
- /// </summary>
- 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();
- }
- /// <summary>
- /// 保存SEM样品台参数
- /// </summary>
- 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));
- }
- /// <summary>
- /// 保存图像扫描参数
- /// </summary>
- 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));
-
- }
- /// <summary>
- /// 保存一般常规参数
- /// </summary>
- 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());
- }
- /// <summary>
- /// 保存图像处理参数
- /// </summary>
- 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));
- }
- /// <summary>
- /// 保存X-Ray参数
- /// </summary>
- 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);
- }
- /// <summary>
- /// 将参数保存到文件
- /// </summary>
- /// <param name="a_nPackId"></param>
- /// <param name="a_pStageData"></param>
- /// <param name="a_pGenParam"></param>
- /// <param name="a_pImageScanParam"></param>
- /// <param name="a_pImageProcParam"></param>
- /// <param name="a_pXRayParam"></param>
- /// <returns></returns>
- public bool SaveInfoToProgMgrFile()
- {
- //SaveInfoToProgMgrFile()
- if (false == m_cotsprogmgrparamfile.SaveInfoToProgMgrFile())
- {
- log.Error("(OTSProgMgrInfoFun.SaveInfoToProgMgrFile) Failed to save parameters to file");
- return false;
- }
- return true;
- }
- /// <summary>
- /// 加载参数各个类
- /// </summary>
- 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;
- }
- }
- /// <summary>
- /// 弹出样品台管理窗体
- /// </summary>
- /// <param name="a_nPackId"></param>
- /// <param name="a_pStageFile"></param>
- /// <returns></returns>
- public void ShowStageDialogExport()
- {
-
- DlgStageMgr dlgStageMgr = new DlgStageMgr(m_cstagefile);
- dlgStageMgr.ShowDialog();
- return;
- }
- /// <summary>
- /// 保存样品台信息
- /// </summary>
- /// <returns></returns>
- 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();
- }
- /// <summary>
- /// 判断各控件值是否正确
- /// </summary>
- /// <returns></returns>
- 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;
- }
- /// <summary>
- /// 判断当前样品台是否在被修改
- /// </summary>
- /// <returns></returns>
- public bool IsModified()
- {
- return m_cstagefile.IsModified();
- }
- /// <summary>
- /// 样品台保存
- /// </summary>
- /// <returns></returns>
- 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();
- }
- /// <summary>
- /// 通过id设置当前正在工作的样品台
- /// </summary>
- /// <param name="id"></param>
- public void SetWorkingStageId(int id)
- {
- m_cstagefile.SetWorkingStageId(id);
- }
- /// <summary>
- /// 设置当前样品台正在被修改中
- /// </summary>
- /// <param name="yn"></param>
- public void SetModify(bool yn)
- {
- m_cstagefile.SetModify(true);
- }
- /// <summary>
- /// 设置当前窗体可以保存了
- /// </summary>
- 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;
- }
- }
- }
|