123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245124612471248124912501251125212531254125512561257125812591260126112621263126412651266126712681269127012711272127312741275127612771278127912801281128212831284128512861287128812891290129112921293129412951296129712981299130013011302130313041305130613071308130913101311131213131314131513161317131813191320132113221323132413251326132713281329133013311332133313341335133613371338133913401341134213431344134513461347134813491350135113521353135413551356135713581359136013611362136313641365136613671368136913701371137213731374137513761377137813791380138113821383138413851386138713881389139013911392139313941395139613971398139914001401140214031404140514061407140814091410141114121413141414151416141714181419142014211422142314241425142614271428142914301431143214331434143514361437143814391440144114421443144414451446144714481449145014511452145314541455145614571458145914601461146214631464146514661467146814691470147114721473147414751476147714781479148014811482148314841485148614871488148914901491149214931494149514961497149814991500150115021503150415051506150715081509151015111512151315141515151615171518151915201521152215231524152515261527152815291530153115321533153415351536153715381539154015411542154315441545154615471548154915501551155215531554155515561557155815591560156115621563156415651566156715681569157015711572157315741575157615771578157915801581158215831584158515861587158815891590159115921593159415951596159715981599160016011602160316041605160616071608160916101611161216131614161516161617161816191620162116221623162416251626162716281629163016311632163316341635163616371638163916401641164216431644164516461647164816491650165116521653165416551656165716581659166016611662166316641665166616671668166916701671167216731674167516761677167816791680168116821683168416851686168716881689169016911692169316941695169616971698169917001701170217031704170517061707170817091710171117121713171417151716171717181719172017211722172317241725172617271728172917301731173217331734173517361737173817391740174117421743174417451746174717481749175017511752175317541755175617571758175917601761176217631764176517661767176817691770177117721773177417751776177717781779178017811782178317841785178617871788178917901791179217931794179517961797179817991800180118021803180418051806180718081809181018111812181318141815181618171818181918201821182218231824182518261827182818291830183118321833183418351836183718381839184018411842184318441845184618471848184918501851185218531854185518561857185818591860186118621863186418651866186718681869187018711872187318741875187618771878187918801881188218831884188518861887188818891890189118921893189418951896189718981899190019011902190319041905190619071908190919101911191219131914191519161917191819191920192119221923192419251926192719281929193019311932193319341935193619371938193919401941194219431944194519461947194819491950195119521953195419551956195719581959196019611962196319641965196619671968196919701971197219731974197519761977197819791980198119821983198419851986198719881989199019911992199319941995199619971998199920002001200220032004200520062007200820092010201120122013201420152016201720182019202020212022202320242025202620272028202920302031203220332034203520362037203820392040204120422043204420452046204720482049205020512052205320542055205620572058205920602061206220632064206520662067206820692070207120722073207420752076207720782079208020812082208320842085208620872088208920902091209220932094209520962097209820992100210121022103210421052106210721082109211021112112211321142115211621172118211921202121212221232124212521262127212821292130213121322133213421352136213721382139214021412142214321442145214621472148214921502151215221532154215521562157215821592160216121622163216421652166216721682169217021712172217321742175217621772178217921802181218221832184218521862187218821892190219121922193219421952196219721982199220022012202220322042205220622072208220922102211221222132214221522162217221822192220222122222223222422252226222722282229 |
- 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._3_OTSDisplaySourceGridData;
- using OTSPeriodicTable;
- 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;
- frmMeasureStopMode StopModeDialog;
- _7_OTSProgMgrInfo.OtherSelectionForm otherSelectionForm;
- //国际化
- 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);
-
- //去背景方式
- 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();
- if (StopModeDialog == null)
- {
- StopModeDialog = new frmMeasureStopMode();
- 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;
- }
- //取图方式
- 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();
-
- //精炼工艺选项
- 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();
- //重叠尺寸
- IDC_EDIT_Overlap.Text = m_cotsimgprocprm.GetOverlapParam().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;
- }
- }
- }
- //重叠尺寸
- IDC_EDIT_Overlap.Text = m_cotsimgprocprm.GetOverlapParam().ToString();
- if (m_cotsimgprocprm.GetParticleSelectCondition().ToString() == "")
- {
- IDC_EDIT_OTHERSELECTION.Text = "NoFilter";
- }
- else
- {
- IDC_EDIT_OTHERSELECTION.Text = m_cotsimgprocprm.GetParticleSelectCondition().ToString();
- }
- }
- /// <summary>
- /// 加载X-Ray参数
- /// </summary>
- public void LoadXRayParam()
- {
-
- //搜索X-ray精度对应的时间
- //IDC_TEXTBOX_SEARCHXRAYSPEED_TIME.Text = m_cotsxrayprm.GetMidSearchAQTime().ToString();
-
- 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精度对应的时间
- 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.GetSmallPartXrayTime().ToString();
- IDC_EDIT_XrayLimit.Text = m_cotsxrayprm.GetXrayLimit().ToString();
- if (m_cotsxrayprm.IfAutoId)
- {
- radioButton1.Checked =true;
- }
- else
- {
- radioButton2.Checked = true;
- }
-
- tb_xsys.Text = m_cotsxrayprm.AnalysisElements;
-
- }
- /// <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(StopModeDialog.TimeMode);
- ////终止帧图数
- m_cotsimgscanprm.SetStopParamFields(StopModeDialog.FieldMode);
- ////终止夹杂物数
- m_cotsimgscanprm.SetStopParamParticles(StopModeDialog.ParticleMode);
- ////终止面积
- m_cotsimgscanprm.SetStopParamArea(StopModeDialog.AreaMode);
- //取图方式
- 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);
- //获取精炼工艺索引
- 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.SetOverlapParam(Convert.ToInt32(IDC_EDIT_Overlap.Text));
- if (IDC_EDIT_OTHERSELECTION.Text != "NoFilter")
- {
- m_cotsimgprocprm.SetParticleSelectCondition(IDC_EDIT_OTHERSELECTION.Text);
- }
- else
- {
- m_cotsimgprocprm.SetParticleSelectCondition("");
- }
- }
- /// <summary>
- /// 保存X-Ray参数
- /// </summary>
- public void SaveXRayParam()
- {
-
-
- //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精度对应的时间
- m_cotsxrayprm.SetMidAnalyAQTime(Convert.ToInt32(IDC_TEXTBOX_ANALYXRAYSPEED_TIME.Text.Trim()));
- //分析X-ray计数期望值
- m_cotsxrayprm.SetAnalyExpCount(Convert.ToInt32(IDC_EDIT_ANALYXRAYAIMVALUE.Text));
- m_cotsxrayprm.SetFeatureModeMinSize(Convert.ToDouble(IDC_EDIT_QuantifyMinSize.Text));
- m_cotsxrayprm.SetSmallPartXrayTime(Convert.ToInt32(IDC_EDIT_SmallPartAQTime.Text));
- m_cotsxrayprm.SetXrayLimit(Convert.ToInt32(IDC_EDIT_XrayLimit.Text));
- m_cotsxrayprm.IfAutoId=radioButton1.Checked ;
- m_cotsxrayprm.AnalysisElements=tb_xsys.Text ;
- }
- /// <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;
-
-
- if(m_cotsprogmgrparamfile.GetSysTypeName() == "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());
- }
- }
- /// <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;
- //}
-
-
- 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_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 frmMeasureStopMode();
- 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);
-
- }
- }
- private void IDC_COMBO_CorrosionExpansionCoefficient_TextChanged(object sender, EventArgs e)
- {
- ThisSetIsModify();
- }
- private void button_SpPart_Click(object sender, EventArgs e)
- {
-
- }
- private void checkBox_Run_CheckedChanged(object sender, EventArgs e)
- {
-
- }
- private void btn_otherselection_Click(object sender, EventArgs e)
- {
- if (otherSelectionForm == null)
- {
- otherSelectionForm = new _7_OTSProgMgrInfo.OtherSelectionForm();
- otherSelectionForm.OtherSelection = m_cotsimgprocprm.GetParticleSelectCondition();
- }
- DialogResult result = otherSelectionForm.ShowDialog();
- if (result == DialogResult.OK)
- {
- m_cotsimgprocprm.SetParticleSelectCondition(otherSelectionForm.OtherSelection);
- if (otherSelectionForm.OtherSelection == "")
- {
- IDC_EDIT_OTHERSELECTION.Text = "NoFilter";
- }
- else
- {
- IDC_EDIT_OTHERSELECTION.Text = otherSelectionForm.OtherSelection;
- }
- }
- }
- private void radioButton1_CheckedChanged(object sender, EventArgs e)
- {
- if (radioButton1.Checked)
- {
- elementchoose.Enabled = false;
- }
-
- }
- int ReturnsAtomicNumberByElementName(string ElementName)
- {
- switch (ElementName)
- {
- case "H": return 1;
- case "He": return 2;
- case "Li": return 3;
- case "Be": return 4;
- case "B": return 5;
- case "C": return 6;
- case "N": return 7;
- case "O": return 8;
- case "F": return 9;
- case "Ne": return 10;
- case "Na": return 11;
- case "Mg": return 12;
- case "Al": return 13;
- case "Si": return 14;
- case "P": return 15;
- case "S": return 16;
- case "Cl": return 17;
- case "Ar": return 18;
- case "K": return 19;
- case "Ca": return 20;
- case "Sc": return 21;
- case "Ti": return 22;
- case "V": return 23;
- case "Cr": return 24;
- case "Mn": return 25;
- case "Fe": return 26;
- case "Co": return 27;
- case "Ni": return 28;
- case "Cu": return 29;
- case "Zn": return 30;
- case "Ga": return 31;
- case "Ge": return 32;
- case "As": return 33;
- case "Se": return 34;
- case "Br": return 35;
- case "Kr": return 36;
- case "Rb": return 37;
- case "Sr": return 38;
- case "Y": return 39;
- case "Zr": return 40;
- case "Nb": return 41;
- case "Mo": return 42;
- case "Tc": return 43;
- case "Ru": return 44;
- case "Rh": return 45;
- case "Pd": return 46;
- case "Ag": return 47;
- case "Cd": return 48;
- case "In": return 49;
- case "Sn": return 50;
- case "Sb": return 51;
- case "Te": return 52;
- case "I": return 53;
- case "Xe": return 54;
- case "Cs": return 55;
- case "Ba": return 56;
- case "La": return 57;
- case "Ce": return 58;
- case "Pr": return 59;
- case "Nd": return 60;
- case "Pm": return 61;
- case "Sm": return 62;
- case "Eu": return 63;
- case "Gd": return 64;
- case "Tb": return 65;
- case "Dy": return 66;
- case "Ho": return 67;
- case "Er": return 68;
- case "Tm": return 69;
- case "Yb": return 70;
- case "Lu": return 71;
- case "Hf": return 72;
- case "Ta": return 73;
- case "W": return 74;
- case "Re": return 75;
- case "Os": return 76;
- case "Ir": return 77;
- case "Pt": return 78;
- case "Au": return 79;
- case "Hq": return 80;
- case "TI": return 81;
- case "Pb": return 82;
- case "Bi": return 83;
- case "Po": return 84;
- case "At": return 85;
- case "Rn": return 86;
- case "Fr": return 87;
- case "Ra": return 88;
- case "Ac": return 89;
- case "Th": return 90;
- case "Pa": return 91;
- case "U": return 92;
- case "Np": return 93;
- case "Pu": return 94;
- case "Am": return 95;
- case "Cm": return 96;
- case "Bk": return 97;
- case "Cf": return 98;
- case "Es": return 99;
- case "Fm": return 100;
- case "Mc": return 101;
- case "No": return 102;
- case "Lr": return 103;
- case "Rf": return 104;
- case "Db": return 105;
- case "Sg": return 106;
- case "Bh": return 107;
- case "Hs": return 108;
- case "Mt": return 109;
- case "Ds": return 110;
- case "Rg": return 111;
- case "Unb": return 112;
- default: return 1000;
- }
- }
- private void button1_Click(object sender, EventArgs e)
- {
- OTSPeriodicTable.OTSPeriodicTableForm_Small opts = new OTSPeriodicTable.OTSPeriodicTableForm_Small();
- //获取需要显示的元素列表,并转换成元素周期表窗体可接受的格式,传入----------------------
- string str_xsys = tb_xsys.Text.Trim();
- List<string> list_str = new List<string>();
- string[] strs = str_xsys.Split(',');
- for (int i = 0; i < strs.Length; i++)
- {
- list_str.Add(strs[i]);
- }
- //清除元素周期表中所有的记录
- opts.m_List_Periodic.Clear();
- //将该分类下的元素添加到元素周期表窗体的List_periodic中
- for (int i = 0; i < strs.Length; i++)
- {
- string str_ysm = strs[i];
- Periodic ls_periodic = new Periodic();
- ls_periodic = CListPeriodic.GetPeriodicByEleName(str_ysm);
- opts.m_List_Periodic.Add(ls_periodic);
- }
- //----------------------------------------------------------------------------------------
- opts.StartPosition = FormStartPosition.CenterScreen;
- opts.ShowDialog();
- List<string> PeriodicFH = new List<string>();
- for (int j = 0; j < opts.m_List_Periodic.Count; j++)
- {
- PeriodicFH.Add(opts.m_List_Periodic[j].Symbol);
- }
- PeriodicFH.Sort(delegate (string a, string b) { return ReturnsAtomicNumberByElementName(a).CompareTo(ReturnsAtomicNumberByElementName(b)); });//排序 从小到大原子序数
- list_str = list_str.FindAll(delegate (string a) { return PeriodicFH.Contains(a); });
- PeriodicFH = PeriodicFH.FindAll(delegate (string a) { return !list_str.Contains(a); });
- //先清空元素
- str_xsys = "";
- //然后再将选择的元素,组合起来,返回显示到该窗体上
- for (int i = 0; i < list_str.Count; i++)
- {
- if (str_xsys == "")
- {
- str_xsys = list_str[i];
- }
- else
- {
- str_xsys = str_xsys + "," + list_str[i];
- }
- }
- for (int i = 0; i < PeriodicFH.Count; i++)
- {
- if (str_xsys == "")
- {
- str_xsys = PeriodicFH[i];
- }
- else
- {
- str_xsys = str_xsys + "," + PeriodicFH[i];
- }
- }
- //再对选择的元素进行显示
- tb_xsys.Text = str_xsys;
- }
- private void radioButton2_CheckedChanged(object sender, EventArgs e)
- {
- if (radioButton2.Checked)
- {
- elementchoose.Enabled = true;
- }
- }
- }
- 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;
- }
- }
- }
|