private void LoadProfile() { string pn = txt_Pn.GetTextVali(); Project pnProject = ProjectHelper.Find(pn); if (pnProject == null) { Ui.MessageBoxMuti("未能找到对应的料号档案"); return; } Ui.MessageBoxMuti("成功找到对应的料号档案"); SetProject(pnProject); }
private void PnChangeHandle(string pn) { ResetUi(); string msg = ""; _curretnProject = ProjectHelper.Find(pn); _hardware = (Hardware)LocalConfig.GetObjFromXmlFile("config\\hardware.xml", typeof(Hardware)); if (_curretnProject == null) { //AddStatus("未能找到对应的料号档案"); AddStatus(LanguageHelper.GetMsgText("未能找到对应的料号档案")); return; } //AddStatus("成功找到对应的料号档案"); AddStatus(LanguageHelper.GetMsgText("成功找到对应的料号档案")); if (_hardware == null) { AddStatus("未能找到对应的硬件设置档案"); return; } AddStatus("成功找到对应硬件设置档案"); if (!Util.SetHardware(_hardware, ref _switch, ref _iAnalyzer, ref msg, BlockedMsg)) { AddStatus(msg); return; } _iAnalyzer.LoadCalFile(_curretnProject.CalFilePath, ref msg); AddStatus("连接开关成功"); AddStatus("连接网分设备成功"); bool setProjectFlag = Util.SetTestParams(_curretnProject, ref _testConfigs); if (!setProjectFlag) { AddStatus("开关对数与测试对数不一致"); return; } SetInformation(); _spec = TestUtil.GetPnSpec(_curretnProject); ClearTestItems(); DisplayTestItems(); AddCharts(); SetKeyPoint(); btnTest.Enabled = true; txtSN.Focus(); }
private void btnDel_Click(object sender, EventArgs e) { try { string pn = txt_Pn.GetTextVali(); var key = Ui.MessageBoxYesNoMuti("确定删除当前料号吗?"); if (key == DialogResult.Yes) { if (ProjectHelper.Find(pn) != null) { Ui.MessageBoxMuti(DeleteProfile(pn) ? "删除料号成功" : "删除料号失败"); } else { Ui.MessageBoxMuti("未能找到对应的料号档案"); } } } catch (Exception exception) { Console.WriteLine(exception); } }
private void SaveProfile() { try { //MessageBox.Show(cmbPower.GetValue()); Project pnProject = new Project(); pnProject.Awg = num_AWG.GetNumVali <int>(1, 40, _dFunc); pnProject.Length = num_Length.GetNumVali <int>(1, 10000, _dFunc); pnProject.PnCustomer = txt_PnCustomer.GetTextVali(); pnProject.Customer = txt_Customer.GetTextVali(); pnProject.Pn = txt_Pn.GetTextVali(); pnProject.Diff = GetlistboxValue(chkList_Diff); pnProject.Single = GetlistboxValue(chkList_Single); pnProject.Tdr = GetlistboxValue(chkList_TDR); pnProject.DiffPair = GetlistboxValue(chkList_SPair); pnProject.NextPair = GetlistboxValue(chkList_NextPair); pnProject.FextPair = GetlistboxValue(chkList_FextPair); pnProject.ReportTempletePath = txt_ReportTempletePath.GetTextVali(); pnProject.RomFileMode = GetRomFileMode(); pnProject.RomWrite = chk_RomWrite.Checked; pnProject.RomFilePath = txt_RomFilePath.GetTextVali(); pnProject.SwitchFilePath = txt_SwitchFilePath.GetTextVali(); pnProject.FreSpec = Serializer.Datatable2Json((DataTable)dgv_SpecFre.DataSource); pnProject.FrePoints = num_FrePoints.GetNumVali <int>(1, 20000, _dFunc); pnProject.FreSpecFilePath = txt_FreSpecFilePath.GetTextVali(); TdrParam[] tdrParamTemp = GetTdrParam(); pnProject.Tdd11 = tdrParamTemp[0]; pnProject.Tdd22 = tdrParamTemp[1]; pnProject.Ild = (IldSpec)Enum.Parse(typeof(IldSpec), cmb_ILDSpec.SelectedItem.ToString(), true); pnProject.Skew = (double)num_Skew.Value; pnProject.Speed = cmbSpeed.GetValue(); pnProject.ProductTypeL = cmbTypeL.GetValue(); pnProject.ProductTypeR = cmbTypeR.GetValue(); pnProject.Power = cmbPower.GetValue(); pnProject.Description = GetDescription(); pnProject.CalFilePath = txt_CalFilePath.Text; pnProject.KeyPoint = GetKeypoint(); pnProject.Srevert = chkSRevert.Checked; pnProject.Trevert = chkTRevert.Checked; pnProject.Report = chk_Report.Checked; string msg = ""; if (ProjectHelper.Find(pnProject.Pn) != null) { var key = Ui.MessageBoxYesNoMuti("确定覆盖当前料号吗?"); if (key == DialogResult.Yes) { SaveProfile(pnProject, true, ref msg); } else { return; } } else { SaveProfile(pnProject, false, ref msg); } Ui.MessageBoxMuti(msg); } catch (Exception e) { LogHelper.WriteLog("保存料号时参数异常", e); } }