示例#1
0
 private void btnSubmit_Click(object sender, EventArgs e)
 {
     _parameter.portName  = String.Format("{0}", this.comName.SelectedItem);
     _parameter.soundType = String.Format("{0}", this.comWarn.SelectedItem);
     if (String.IsNullOrWhiteSpace(_parameter.portName))
     {
         MessageBox.Show("请选择Com串口!", "系统提示");
         return;
     }
     if (String.IsNullOrWhiteSpace(_parameter.soundType))
     {
         MessageBox.Show("请选择告警方式!", "系统提示");
         return;
     }
     try
     {
         ParaHelper.saveParameter(_filePath, _parameter);
         if (MessageBox.Show("操作成功", "系统提示") == DialogResult.OK)
         {
             this.DialogResult = DialogResult.OK;
             this.Close();
         }
     }
     catch (Exception ex)
     {
         MessageBox.Show(ex.Message, "系统提示");
     }
 }
示例#2
0
        private void init()
        {
            parameter = ParaHelper.readParameter(filePath);
            //显示参数
            this.tbxStandard.Text = parameter.standardValue;

            if (!this.timer1.Enabled)
            {
                this.timer1.Enabled = true;
            }
        }
示例#3
0
        /// <summary>
        /// 初始化文件
        /// </summary>
        private void initFilePath()
        {
            string appPath  = Application.StartupPath;
            string fileName = "Setup.txt";

            filePath = String.Format("{0}\\{1}", appPath, fileName);
            if (!File.Exists(filePath))
            {
                parameter = ParaHelper.initParameter(filePath);
            }
        }
示例#4
0
        public void btnSubmit_Click(object sender, EventArgs e)
        {
            _parameter.standardValue = this.tbxStandard.Text;
            if (String.IsNullOrWhiteSpace(_parameter.standardValue))
            {
                MessageBox.Show("请输入校验值!", "系统提示");
                return;
            }

            try
            {
                ParaHelper.saveParameter(_filePath, _parameter);
                if (MessageBox.Show("操作成功", "系统提示") == DialogResult.OK)
                {
                    this.DialogResult = DialogResult.OK;
                    this.Close();
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message, "系统提示");
            }
        }