示例#1
0
 public CUIModelArgs(int idNo, string name, CModelPara model, int lPara = 0, int wPara = 0)
 {
     this.idNo  = idNo;
     this.name  = name;
     this.model = model;
     this.lPara = lPara;
     this.wPara = wPara;
 }
示例#2
0
        /// <summary>
        ///保存
        /// </summary>
        private void save()
        {
            try
            {
                string modelPath = string.Empty;

                string fileDirectry = string.Empty;

                if (CGlobalPara.SysPara.Report.ModelPath == "")
                {
                    fileDirectry = Application.StartupPath + "\\Model";
                    if (!Directory.Exists(fileDirectry))
                    {
                        Directory.CreateDirectory(fileDirectry);
                    }
                }
                else
                {
                    fileDirectry = CGlobalPara.SysPara.Report.ModelPath;
                }

                saveFiledlg.InitialDirectory = fileDirectry;
                saveFiledlg.Filter           = "HP files (*.hp)|*.hp";
                saveFiledlg.FileName         = txtModel.Text;

                if (saveFiledlg.ShowDialog() != DialogResult.OK)
                {
                    return;
                }

                modelPath = saveFiledlg.FileName;

                CModelPara modelPara = new CModelPara();

                modelPara.Base.Model   = txtModel.Text;
                modelPara.Base.Custom  = txtCustom.Text;
                modelPara.Base.Version = txtVersion.Text;

                modelPara.Base.ReleaseName = txtReleaseName.Text;
                modelPara.Base.ReleaseDate = pickerDate.Value.Date.ToString();
                modelPara.Base.HPModel     = txtHPModel.Text;

                modelPara.Para.HpCH = hpChan.mHpChan;
                modelPara.Para.IoCH = hpChan.mIoChan;

                modelPara.Para.Step = step;

                CSerializable <CModelPara> .WriteXml(modelPath, modelPara);

                MessageBox.Show(CLanguage.Lan("机种参数保存成功."), "Tip", MessageBoxButtons.OK, MessageBoxIcon.Information);
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.ToString());
            }
        }
示例#3
0
        /// <summary>
        /// 打开
        /// </summary>
        private void open()
        {
            try
            {
                string modelPath    = string.Empty;
                string fileDirectry = string.Empty;
                fileDirectry = CGlobalPara.SysPara.Report.ModelPath;
                openFiledlg.InitialDirectory = fileDirectry;
                openFiledlg.Filter           = "HP files (*.hp)|*.hp";
                if (openFiledlg.ShowDialog() != DialogResult.OK)
                {
                    return;
                }
                modelPath = openFiledlg.FileName;

                CModelPara modelPara = new CModelPara();

                CSerializable <CModelPara> .ReadXml(modelPath, ref modelPara);

                txtModel.Text   = modelPara.Base.Model;
                txtCustom.Text  = modelPara.Base.Custom;
                txtVersion.Text = modelPara.Base.Version;

                txtReleaseName.Text = modelPara.Base.ReleaseName;

                if (modelPara.Base.ReleaseDate != null && modelPara.Base.ReleaseDate != string.Empty)
                {
                    pickerDate.Value = System.Convert.ToDateTime(modelPara.Base.ReleaseDate);
                }
                txtHPModel.Text = modelPara.Base.HPModel;

                hpChan.mHpChan = modelPara.Para.HpCH;
                hpChan.mIoChan = modelPara.Para.IoCH;

                step = modelPara.Para.Step;
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.ToString());
            }
        }