| 12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127 | using System;using System.Collections;using System.IO;using System.Windows.Forms;using System.Xml;using OTSModelSharp.ServiceCenter;namespace OTSSysMgrApp{    public partial class SemTestForms : Form    {        #region 全部变量声明        //连接状态        bool ConnectionState = false;          static string xmlFilePath = System.Configuration.ConfigurationManager.ConnectionStrings["XMLFilePath"].ConnectionString;         static NLog.Logger log = NLog.LogManager.GetCurrentClassLogger();        ISemController m_SemHardwareMgr = null;        //国际化        Language lan;        //国际化存储信息        Hashtable table;        #endregion        #region 构造方法        public SemTestForms()        {            InitializeComponent();            //控制类对象初始化                      m_SemHardwareMgr = SemController.GetSEMController();            //国际化            lan = new Language(this);            table = lan.GetNameTable(this.Name);        }            #endregion        #region 保存设置        /// <summary>        /// 保存设置        /// </summary>        /// <param name="Name">节点名称</param>        /// <param name="Value">节点参数值</param>        public void SaveSetting(string Name, string Value)        {            try            {                //判断XML文件中是否存在                if (!XMLOperationClass.ExistsXmlInfo(Name))                {                    //调用添加XML节点功能                    XMLOperationClass.AddXmlInfo(Name, Value);                }                else                {                    //调用修改XML节点功能                    XMLOperationClass.EditXmlInfo(Name, Value);                }            }            catch (Exception ex)            {                //记录日志信息                log.Error(ex.Message.ToString());            }        }        #endregion        #region 修改设置        public void EditSetting(string Name, string Value)        {            try            {                //调用修改XML节点功能                XMLOperationClass.EditXmlInfo(Name, Value);            }            catch (Exception ex)            {                //记录日志信息                log.Error(ex.Message.ToString());            }        }        #endregion        #region 判断文件路径        /// <summary>        /// 判断文件路径        /// </summary>        /// <param name="path"></param>        /// <returns></returns>        public bool CreateFile(string path)        {            Directory.CreateDirectory(path);            return false;        }        #endregion        #region 判断文件是否存在        /// <summary>        /// 判断文件是否存在        /// </summary>        /// <param name="path">文件路径</param>        /// <returns></returns>        public bool ExistsFile(string path)        {            try            {                if (File.Exists(path))                {                    return true;                }                return false;            }            catch (Exception ex)            {                //记录日志信息                log.Error(ex.Message.ToString());                return false;            }        }        #endregion        public void GetBtnState(bool btnState)        {                       foreach (Control item in gbGetMethods.Controls)            {                if (item is Button)                {                                  ((Button)item).Enabled = btnState;                                  }            }            foreach (Control item in gbSetMethods.Controls)            {                if (item is Button)                {                                ((Button)item).Enabled = btnState;                                  }            }        }        #region 用户信息提示        /// <summary>        /// 提示        /// </summary>        /// <param name="Message"></param>        private void ShowMessage(int MessageType)        {            string message1 = table["message1"].ToString();            string message2 = table["message2"].ToString();            string message3 = table["message3"].ToString();            string message4 = table["message4"].ToString();            string message5 = table["message5"].ToString();            string message6 = table["message6"].ToString();            string message7 = table["message7"].ToString();            string message8 = table["message8"].ToString();            string message9 = table["message9"].ToString();            string message10 = table["message10"].ToString();            string MessageInfo = string.Empty;            switch (MessageType)            {                case 0:                    MessageInfo = message1;                    break;                case 1:                    MessageInfo = message2;                    break;                case 2:                    MessageInfo = message3;                    break;                case 3:                    MessageInfo = message4;                    break;                case 4:                    MessageInfo = message5;                    break;                case 5:                    MessageInfo = message6;                    break;                case 6:                    MessageInfo = message7;                    break;                case 7:                    MessageInfo = message8;                    break;                case 8:                    MessageInfo = message9;                    break;                case 9:                    MessageInfo = message10;                    break;            }            MessageBox.Show(MessageInfo, "Tip");        }        #endregion        #region 判断控制内容是否为空 与 判断输入的格式是否正确        /// <summary>        /// 判断控制内容是否为空        /// </summary>        /// <param name="tbContent"></param>        /// <returns></returns>        public bool IsNull(TextBox tbContent)        {            if (tbContent.Text.Trim().Equals(""))            {                //为空提示                ShowMessage(0);                //获取焦点                tbContent.Focus();                return false;            }            return true;        }        /// <summary>        ///         /// </summary>        /// <param name="objValue"></param>        /// <param name="objType"></param>        /// <returns></returns>        public bool IsType(object ObjValue, int ObjType)        {            try            {                switch (ObjType)                {                    case 1:                        int intValue = Convert.ToInt32(ObjValue);                        break;                    case 2:                        double douValue = Convert.ToDouble(ObjValue);                        break;                    case 3:                        float floValue = Convert.ToSingle(ObjValue);                        break;                }                return true;            }            catch (Exception)            {                //为空提示                ShowMessage(7);                return false;            }        }        /// <summary>        /// 判断是否连接        /// </summary>        /// <returns></returns>        public bool IsConnection()        {            try            {                if (ConnectionState)                {                    return true;                }                return false;            }            catch (Exception)            {                //为空提示                ShowMessage(7);                return false;            }        }        #endregion        #region 窗体控制的事件汇总        private void SemTestForms_Load(object sender, EventArgs e)        {            ////循环窗体中            foreach (Control item in gbGetMethods.Controls)            {                if (item is Button)                {                    //绑定按钮点击事件                    //item.Click += new System.EventHandler(btnGetInfo_Click);                    ((Button)item).Enabled = false;                }            }            foreach (Control item in gbSetMethods.Controls)            {                if (item is Button)                {                    //绑定按钮点击事件                    //item.Click += new System.EventHandler(btnSetInfo_Click);                    ((Button)item).Enabled = false;                }            }                  }        private void btnDone_Click(object sender, EventArgs e)        {                      //返回关闭窗口返回值            this.DialogResult = DialogResult.OK;        }        private void btnGetInfo_Click(object sender, EventArgs e)        {            if (!IsConnection())            {                return;            }            //获取响应按钮            Button btnTest = (Button)sender;            try            {                //节点名称与节点参数值                string Name = string.Empty;                string Value = string.Empty;                //判断本地中是否存在文件路径                if (ExistsFile(xmlFilePath))                {                    //遍历tabHardwareSet标签中所有的ComboBox控件                     foreach (Control control in this.gbGetMethods.Controls)                    {                        //判断类型名称                        if (control is TextBox)                        {                            Name = (control as TextBox).Name.Substring(2);                            if (btnTest.Name.Contains(Name))                            {                                //获取节点名称与节点参数值                                System.Xml.XmlNode xmlNode = XMLOperationClass.GetXMLInformationValue("S" + Name);                                (control as TextBox).Text = ((XmlElement)xmlNode).GetAttribute("Value");                            }                        }                        //判断类型名称                        if (control is CheckBox)                        {                            Name = (control as CheckBox).Name.Substring(2);                            if (btnTest.Name.Contains(Name))                            {                                //获取节点名称与节点参数值                                System.Xml.XmlNode xmlNode = XMLOperationClass.GetXMLInformationValue(Name);                                (control as CheckBox).Checked = ((XmlElement)xmlNode).GetAttribute("Value").Equals("true") ? true : false;                            }                        }                    }                }                else                {                    //如果文件不存在,则创建文件                    CreateFile(xmlFilePath);                }            }            catch (Exception ex)            {                //记录日志信息                log.Error(ex.Message.ToString());            }        }        private void btnSetInfo_Click(object sender, EventArgs e)        {            if (!IsConnection())            {                return;            }            //获取响应按钮            Button btnTest = (Button)sender;            try            {                //节点名称与节点参数值                string Name = string.Empty;                string Value = string.Empty;                //判断本地中是否存在文件路径                if (ExistsFile(xmlFilePath))                {                    //遍历tabHardwareSet标签中所有的TextBox控件                     foreach (Control control in this.gbSetMethods.Controls)                    {                        //判断类型名称                        if (control is TextBox)                        {                            Name = (control as TextBox).Name.Substring(2);                            if (btnTest.Name.Contains(Name))                            {                                //获取节点名称与节点参数值                                Value = (control as TextBox).Text;                                SaveSetting(Name, Value);                            }                        }                        //判断类型名称                        if (control is CheckBox)                        {                            Name = (control as CheckBox).Name.Substring(2);                            if (btnTest.Name.Contains(Name))                            {                                //获取节点名称与节点参数值                                Value = (control as CheckBox).Checked ? "true" : "false";                                SaveSetting(Name, Value);                            }                        }                    }                }                else                {                    //如果文件不存在,则创建文件                    CreateFile(xmlFilePath);                }            }            catch (Exception ex)            {                //记录日志信息                log.Error(ex.Message.ToString());            }        }        private void btnGetAll_Click(object sender, EventArgs e)        {                 }        private void BtnConnect_Click(object sender, EventArgs e)        {            if (!ConnectionState)            {                //和电镜建立通讯连接                ConnectionState = m_SemHardwareMgr.Connect();                ///获取当前电镜的ID号                //SemType = cfun.GetSemType();                if (!ConnectionState)                {                    ShowMessage(2);                    log.Error(table["message3"].ToString());                }                else                {                    string str = table["str1"].ToString();                                        BtnConnect.Text = str;                    GetBtnState(true);                    log.Info("The energy spectrum is connected");                }            }            else            {                string str = table["str2"].ToString();                               BtnConnect.Text = str;                ConnectionState = false;                GetBtnState(false);            }        }        private void SemTestForms_FormClosing(object sender, FormClosingEventArgs e)        {            //m_SemHardwareMgr.DisConnect();        }        private void btnGPositionXYR_Click(object sender, EventArgs e)        {            try            {                //赋值                double PositionX = 0;                double PositionY = 0;                double PositionR = 0;                //获取参数                bool result = m_SemHardwareMgr.GetSemPositionXY(ref PositionX, ref PositionY, ref PositionR);                if (result)                {                    //赋值 显示                    tbPositionX.Text = Convert.ToDouble(PositionX).ToString();                    tbPositionY.Text = Convert.ToDouble(PositionY).ToString();                    tbPositionR.Text = Convert.ToDouble(PositionR).ToString();                    log.Info("X,Y-axis coordinates:(" + tbPositionX.Text + "," + tbPositionY.Text+")");                }                else                {                    //配置结果提示                    ShowMessage(6);                    log.Error("Failed to obtain the X and Y coordinates");                }            }            catch (Exception ex)            {                //记录日志信息(异常日志)                log.Error(ex.Message.ToString());            }        }        private void btnSPositionXYR_Click(object sender, EventArgs e)        {            try            {                //判断是否为空                if (!IsNull(tbSPositionX))                {                    this.Focus();                    return;                }                if (!IsType(tbSPositionX.Text, 2))                {                    this.Focus();                    return;                }                if (!IsNull(tbSPositionY))                {                    this.Focus();                    return;                }                if (!IsType(tbSPositionY.Text, 2))                {                    this.Focus();                    return;                }                //if (!IsNull(tbSPositionR))                //{                //    this.Focus();                //    return;                //}                //if (!IsType(tbSPositionR.Text, 2))                //{                //    this.Focus();                //    return;                //}                //赋值                double PositionX = Convert.ToDouble(tbSPositionX.Text);                double PositionY = Convert.ToDouble(tbSPositionY.Text);                //double PositionR = Convert.ToDouble(tbSPositionR.Text);                bool result = m_SemHardwareMgr.MoveSEMToPoint(PositionX, PositionY);                if (result)                {                    //配置结果提示                    ShowMessage(3);                    log.Info("Set successfully, current X and Y coordinates should be:(" + PositionX.ToString() + "," + PositionY.ToString() + ")");                }                else                {                    ShowMessage(4);                    log.Error("Failed to set X and Y coordinates!");                }            }            catch (Exception ex)            {                //记录日志信息                log.Error(ex.Message.ToString());            }        }        private void btnMoveSEMToPoint_Click(object sender, EventArgs e)        {            try            {                //判断是否为空                if (!IsNull(tbSPositionX))                {                    this.Focus();                    return;                }                if (!IsType(tbSPositionX.Text, 2))                {                    this.Focus();                    return;                }                if (!IsNull(tbSPositionY))                {                    this.Focus();                    return;                }                if (!IsType(tbSPositionY.Text, 2))                {                    this.Focus();                    return;                }                if (!IsNull(tbSPositionR))                {                    this.Focus();                    return;                }                if (!IsType(tbSPositionR.Text, 2))                {                    this.Focus();                    return;                }                //赋值                double PositionX = Convert.ToDouble(tbSPositionX.Text);                double PositionY = Convert.ToDouble(tbSPositionY.Text);                double PositionR = Convert.ToDouble(tbSPositionR.Text);                bool result = m_SemHardwareMgr.MoveSEMToPoint(PositionX, PositionY, PositionR);            }            catch (Exception ex)            {                //记录日志信息                log.Error(ex.Message.ToString());            }        }        private void btnGBeamBlank_Click(object sender, EventArgs e)        {            try            {                int a_nBeamBlank = 0;                               bool result = m_SemHardwareMgr.GetSemBeamBlank(ref a_nBeamBlank);                if (result)                {                    //赋值 显示                    tbBeamBlank.Text = Convert.ToString(a_nBeamBlank);                    log.Info("Beam baffle:" + a_nBeamBlank.ToString());                }                else                {                    //配置结果提示                    ShowMessage(6);                    log.Error("Failed to obtain the Beam baffle!");                }            }            catch (Exception ex)            {                //记录日志信息(异常日志)                log.Error(ex.Message.ToString());            }        }        private void btnSBeamBlank_Click(object sender, EventArgs e)        {            try            {                bool a_nBeamBlank = false;                //判断是否为空与类型                if (!IsNull(tbSBeamBlank))                {                    tbSBeamBlank.Focus();                    return;                }                if (!IsType(tbSBeamBlank.Text, 1))                {                    tbSBeamBlank.Focus();                    return;                }                              bool result = m_SemHardwareMgr.SetSemBeamBlank(true);            }            catch (Exception ex)            {                //记录日志信息(异常日志)                log.Error(ex.Message.ToString());            }        }        private void btnGBrightness_Click(object sender, EventArgs e)        {            try            {                double a_dBrightness = 0;                //获取参数                bool result = m_SemHardwareMgr.GetSemBrightness(ref a_dBrightness);                if (result)                {                    //赋值 显示                    tbBrightness.Text = Convert.ToString(a_dBrightness);                    log.Info("Brightness:" + tbBrightness.Text);                }                else                {                    //配置结果提示                    ShowMessage(6);                    log.Error("Failed to obtain the Brightness");                }            }            catch (Exception ex)            {                //记录日志信息(异常日志)                log.Error(ex.Message.ToString());            }        }        private void btnSBrightness_Click(object sender, EventArgs e)        {            try            {                double a_dBrightness = 0;                //判断是否为空与类型                if (!IsNull(tbSBrightness))                {                    tbSBrightness.Focus();                    return;                }                if (!IsType(tbSBrightness.Text, 2))                {                    tbSBrightness.Focus();                    return;                }                //获取参数与设置参数                a_dBrightness = Convert.ToInt32(tbSBrightness.Text);                //获取参数                bool result = m_SemHardwareMgr.SetSemBrightness(a_dBrightness);                if (result)                {                    //配置结果提示                    ShowMessage(3);                    log.Info("Setting successful!, the current brightness should be:" + tbSBrightness.Text);                }                else                {                    ShowMessage(4);                    log.Error("Brightness setting failed!");                }            }            catch (Exception ex)            {                //记录日志信息(异常日志)                log.Error(ex.Message.ToString());            }        }        private void btnGContrast_Click(object sender, EventArgs e)        {            try            {                double a_dContrast = 0;                //获取参数                bool result = m_SemHardwareMgr.GetSemContrast(ref a_dContrast);                if (result)                {                    //赋值 显示                    tbContrast.Text = Convert.ToString(a_dContrast);                    log.Info("Contrast:" + tbContrast.Text);                }                else                {                    //配置结果提示                    ShowMessage(6);                    log.Error("Failed to obtain contrast!");                }            }            catch (Exception ex)            {                //记录日志信息(异常日志)                log.Error(ex.Message.ToString());            }        }        private void btnSContrast_Click(object sender, EventArgs e)        {            try            {                double a_dContrast = 0;                //判断是否为空与类型                if (!IsNull(tbSContrast))                {                    tbSContrast.Focus();                    return;                }                if (!IsType(tbSContrast.Text, 2))                {                    tbSContrast.Focus();                    return;                }                //赋值                a_dContrast = Convert.ToInt32(tbSContrast.Text);                //获取结果参数                bool result = m_SemHardwareMgr.SetSemContrast(a_dContrast);                if (result)                {                    //配置结果提示                    ShowMessage(3);                    log.Info("Set successfully, the current contrast should be:" + tbSContrast.Text);                }                else                {                    ShowMessage(4);                    log.Error("Contrast setting failed!");                }            }            catch (Exception ex)            {                //记录日志信息(异常日志)                log.Error(ex.Message.ToString());            }        }        private void btnGFWD_Click(object sender, EventArgs e)        {            try            {                double a_dWorkingDistance = 0;                //获取参数                bool result = m_SemHardwareMgr.GetWorkingDistance(ref a_dWorkingDistance);                if (result)                {                    //赋值 显示                    tbFWD.Text = Convert.ToString(a_dWorkingDistance);                    log.Info("WorkingDistance:" + tbFWD.Text);                }                else                {                    //配置结果提示                    ShowMessage(6);                    log.Error("Fail to obtain the WorkingDistance!");                }            }            catch (Exception ex)            {                //记录日志信息(异常日志)                log.Error(ex.Message.ToString());            }        }        private void btnSFWD_Click(object sender, EventArgs e)        {            try            {                double a_dWorkingDistance = 0;                //判断是否为空与类型                if (!IsNull(tbSFWD))                {                    tbSFWD.Focus();                    return;                }                if (!IsType(tbSFWD.Text, 2))                {                    tbSFWD.Focus();                    return;                }                //赋值                a_dWorkingDistance = Convert.ToDouble(tbSFWD.Text);                //获取结果参数                bool result = m_SemHardwareMgr.SetWorkingDistance(a_dWorkingDistance);                if (result)                {                    //配置结果提示                    ShowMessage(3);                    log.Info("Setting successful!, the current working distance should be:"+ tbSFWD.Text);                }                else                {                    ShowMessage(4);                    log.Error("Working distance setting failed!");                }            }            catch (Exception ex)            {                //记录日志信息(异常日志)                log.Error(ex.Message.ToString());            }        }        private void btnGKV_Click(object sender, EventArgs e)        {            try            {                double a_dKV = 0;                //获取参数                bool result = m_SemHardwareMgr.GetSemHighTension(ref a_dKV);                if (result)                {                    //赋值 显示                    tbKV.Text = Convert.ToString(a_dKV);                    log.Info("Electron microscope voltage:" + tbKV.Text);                }                else                {                    //配置结果提示                    ShowMessage(6);                    log.Error("Failed to obtain electron microscope voltage value!");                }            }            catch (Exception ex)            {                //记录日志信息(异常日志)                log.Error(ex.Message.ToString());            }        }        private void btnSKV_Click(object sender, EventArgs e)        {            try            {                double a_dKV = 0;                //判断是否为空与类型                if (!IsNull(tbSKV))                {                    tbSKV.Focus();                    return;                }                if (!IsType(tbSKV.Text, 2))                {                    tbSKV.Focus();                    return;                }                //赋值                a_dKV = Convert.ToInt32(tbSKV.Text);                //获取结果参数                bool result = m_SemHardwareMgr.SetSemHighTension(a_dKV);                if (result)                {                    //配置结果提示                    ShowMessage(3);                    log.Info("Setting successful!, the current voltage value should be:" + tbSKV.Text);                }                else                {                    ShowMessage(4);                    log.Error("Voltage setting failed!");                }            }            catch (Exception ex)            {                //记录日志信息(异常日志)                log.Error(ex.Message.ToString());            }        }        private void btnGMagnification_Click(object sender, EventArgs e)        {            try            {                double a_dMagnification = 0;                //获取参数                bool result = m_SemHardwareMgr.GetMagnification(ref a_dMagnification);                if (result)                {                    //赋值 显示                    tbMagnification.Text = Convert.ToString(a_dMagnification);                    log.Info("SemMagnification:" + tbMagnification.Text);                }                else                {                    //配置结果提示                    ShowMessage(6);                    log.Error("Fail to obtain the SemMagnification!");                }            }            catch (Exception ex)            {                //记录日志信息(异常日志)                log.Error(ex.Message.ToString());            }        }        private void btnSMagnification_Click(object sender, EventArgs e)        {            try            {                double a_dMagnification = 0;                //判断是否为空与类型                if (!IsNull(tbSMagnification))                {                    tbSMagnification.Focus();                    return;                }                if (!IsType(tbSMagnification.Text, 2))                {                    tbSMagnification.Focus();                    return;                }                //赋值                a_dMagnification = Convert.ToInt32(tbSMagnification.Text);                //获取结果参数                bool result = m_SemHardwareMgr.SetMagnification(a_dMagnification);                if (result)                {                    //配置结果提示                    ShowMessage(3);                    log.Info("Setting successful!, the current magnification should be:");                }                else                {                    ShowMessage(4);                    log.Error("Magnification setting failed!");                }            }            catch (Exception ex)            {                //记录日志信息(异常日志)                log.Error(ex.Message.ToString());            }        }        private void btnGSpotSize_Click(object sender, EventArgs e)        {                    }        private void btnSSpotSize_Click(object sender, EventArgs e)        {                    }        private void btnHT_Click(object sender, EventArgs e)        {            try            {                double a_bHTValue = 0;                //获取参数                bool result = m_SemHardwareMgr.GetSemHighTension(ref a_bHTValue);                if (a_bHTValue > 0)                {                    //赋值 显示                    cbHT.Checked = true;                    log.Info("HT:" + cbHT.Checked.ToString());                }                else                {                    //配置结果提示                    ShowMessage(6);                    log.Error("Fail to obtain the HT!");                }            }            catch (Exception ex)            {                //记录日志信息(异常日志)                log.Error(ex.Message.ToString());            }        }        private void btnSHT_Click(object sender, EventArgs e)        {            try            {                bool a_bHTValue = false;                //判断是否为空与类型                //赋值                a_bHTValue = cbSHT.Checked;                //获取结果参数                bool result = m_SemHardwareMgr.SetSemBeamBlank(a_bHTValue);                if (result)                {                    //配置结果提示                    ShowMessage(3);                    log.Info("Setting successful!, the current voltage should be:" + cbSHT.Checked.ToString());                }                else                {                    ShowMessage(4);                    log.Error("Voltage setting failed!");                }            }            catch (Exception ex)            {                //记录日志信息(异常日志)                log.Error(ex.Message.ToString());            }        }               private void btnGScanMode_Click(object sender, EventArgs e)        {                    }        private void btnScanMode_Click(object sender, EventArgs e)        {                  }        #endregion        private void btnGLienTime_Click(object sender, EventArgs e)        {        }        private void bVoltageClose_Click(object sender, EventArgs e)        {            bool a_HTValue = true;            bool result = m_SemHardwareMgr.SetSemBeamCurrentOff(a_HTValue);        }        private void bVoltageStatus_Click(object sender, EventArgs e)        {            bool a_HTValue = true;               bool result = m_SemHardwareMgr.SetSemBeamBlank(a_HTValue);        }        private void button1_Click(object sender, EventArgs e)        {            bool result = m_SemHardwareMgr.SetScanExternal(true);            if (!result)            {                MessageBox.Show("SetExternalOn failed!");                        }        }        private void button2_Click(object sender, EventArgs e)        {            bool result = m_SemHardwareMgr.SetScanExternal(false);            if (!result)            {                MessageBox.Show("SetExternalOn failed!");            }        }        private void label17_Click(object sender, EventArgs e)        {        }                    private void button3_Click_1(object sender, EventArgs e)        {            bool result = m_SemHardwareMgr.SetSemHTOff(true);        }    }}
 |