private void m_lsvProject_Click(object sender, EventArgs e) { if (this.m_lsvProject.FocusedItem == null) { return; } //变更状态标志 this.m_blnProject = false; clsSTCheckProject objProject = (clsSTCheckProject)this.m_lsvProject.FocusedItem.Tag; this.m_txtBoardFrequency.Text = objProject.BoardFrequence; this.m_txtBoardTime.Text = objProject.BoardTime; this.m_txtBoardWay.Text = objProject.BoardWay; this.m_txtEnglishName.Text = objProject.EnglishName; this.m_txtRefWaveLength.Text = objProject.RefWaveLength; this.m_txtTestWaveLength.Text = objProject.TestWaveLength; this.m_txtProjectName.Text = objProject.Name; foreach (clsSTConstractRule rule in objProject.ConstractRules) { if (rule.Positive) { if (rule.BiggerThan) { this.m_chkBigP.Checked = true; this.m_txtBigRefP.Text = rule.ReferenceValue.ToString(); this.m_txtBigActualP.Text = rule.ActualValue.ToString(); } else { this.m_chkSmallP.Checked = false; this.m_txtSmallRefP.Text = rule.ReferenceValue.ToString(); this.m_txtSmallActualP.Text = rule.ActualValue.ToString(); } } else { if (rule.BiggerThan) { this.m_chkBigN.Checked = true; this.m_txtBigRefN.Text = rule.ReferenceValue.ToString(); this.m_txtBigActualN.Text = rule.ActualValue.ToString(); } else { this.m_chkSmallN.Checked = false; this.m_txtSmallRefN.Text = rule.ReferenceValue.ToString(); this.m_txtSmallActualN.Text = rule.ActualValue.ToString(); } } } }
private void LoadData() { clsSTCheckProject checkItem = new clsSTCheckProject(); checkItem.Name = string.Empty; this.Items.Add(checkItem); List <clsSTCheckProject> lstProjects = clsST360Config.CurrentConfig.Projects; foreach (clsSTCheckProject project in lstProjects) { this.Items.Add(project); } }
private void m_cboCheckProjects_SelectedIndexChanged(object sender, EventArgs e) { clsSTCheckProject project = m_cboCheckProjects.SelectProejct; if (project != null) { this.m_selectProject = project; this.m_txtTestWaveLength.Text = project.TestWaveLength; this.m_txtRefWaveLength.Text = project.RefWaveLength; this.m_txtBoardTime.Text = project.BoardTime; this.m_txtBoardFrequency.Text = project.BoardFrequence; this.m_txtBoardWay.Text = project.BoardWay; this.m_txtFormula.Text = project.Formula; } }
private void m_cmdProjectSave_Click(object sender, EventArgs e) { if (this.m_lsvProject.FocusedItem == null && !this.m_blnProject) { return; } Cursor.Current = Cursors.WaitCursor; this.m_cmdProjectSave.Enabled = false; if (this.m_blnProject) {//新增的保存 clsSTCheckProject objProject = new clsSTCheckProject(); objProject.BoardFrequence = this.m_txtBoardFrequency.Text; objProject.BoardTime = this.m_txtBoardTime.Text; objProject.BoardWay = this.m_txtBoardWay.Text; objProject.EnglishName = this.m_txtEnglishName.Text; objProject.RefWaveLength = this.m_txtRefWaveLength.Text; objProject.TestWaveLength = this.m_txtTestWaveLength.Text; objProject.Name = this.m_txtProjectName.Text; List <clsSTConstractRule> lstRules = new List <clsSTConstractRule>(); if (m_chkSmallN.Checked) { clsSTConstractRule ruleSmallN = new clsSTConstractRule(); ruleSmallN.Positive = false; ruleSmallN.BiggerThan = false; ruleSmallN.ReferenceValue = float.Parse(this.m_txtSmallRefN.Text); ruleSmallN.ActualValue = float.Parse(this.m_txtSmallActualN.Text); lstRules.Add(ruleSmallN); } if (m_chkBigN.Checked) { clsSTConstractRule ruleBigN = new clsSTConstractRule(); ruleBigN.Positive = false; ruleBigN.BiggerThan = true; ruleBigN.ReferenceValue = float.Parse(this.m_txtBigRefN.Text); ruleBigN.ActualValue = float.Parse(this.m_txtBigActualN.Text); lstRules.Add(ruleBigN); } if (m_chkSmallP.Checked) { clsSTConstractRule ruleSmallP = new clsSTConstractRule(); ruleSmallP.Positive = false; ruleSmallP.BiggerThan = false; ruleSmallP.ReferenceValue = float.Parse(this.m_txtSmallRefP.Text); ruleSmallP.ActualValue = float.Parse(this.m_txtSmallActualP.Text); lstRules.Add(ruleSmallP); } if (m_chkBigP.Checked) { clsSTConstractRule ruleBigP = new clsSTConstractRule(); ruleBigP.Positive = false; ruleBigP.BiggerThan = true; ruleBigP.ReferenceValue = float.Parse(this.m_txtBigRefP.Text); ruleBigP.ActualValue = float.Parse(this.m_txtBigActualP.Text); lstRules.Add(ruleBigP); } //if (lngRes > 0) //{//成功 // //更新状态标志 // this.m_blnProject = false; // //加入到集合 // clsSTCheckProject[] objProjects = (clsSTCheckProject[])this.m_lsvProject.Tag; // clsSTCheckProject[] objProjectsNewArr = new clsSTCheckProject[objProjects.Length + 1]; // objProjects.CopyTo(objProjectsNewArr, 0); // objProjectsNewArr[objProjectsNewArr.Length - 1] = objProject; // this.m_lsvProject.Tag = objProjectsNewArr; // //添加新项 // ListViewItem item = new ListViewItem(objProject.m_strName); // item.SubItems.Add(objProject.m_strPycode); // item.SubItems.Add(objProject.m_strWbcode); // item.Tag = objProject; // this.m_lsvProject.Items.Add(item); // item.Selected = true; // item.Focused = true; // this.m_lsvProject_Click(null, null); //} //else //{//失败 // clsCommonDialog.m_mthShowDBError(); //} } else {//修改的保存 //clsSTCheckProject objProject = (clsSTCheckProject)this.m_lsvProject.FocusedItem.Tag; //clsSTCheckProject objNewProject = new clsSTCheckProject(); //objProject.m_mthCopyTo(objNewProject); //objNewProject.m_strName = this.m_txtProjectName.Text.Trim(); //objNewProject.m_strPycode = this.m_txtProjectPYCode.Text.Trim(); //objNewProject.m_strWbcode = this.m_txtProjectWBCode.Text.Trim(); //long lngRes = clsTmdProjectSmp.s_object.m_lngUpdate(objNewProject); //if (lngRes > 0) //{//成功 // objNewProject.m_mthCopyTo(objProject); // this.m_lsvProject.FocusedItem.Text = objProject.m_strName; // this.m_lsvProject.FocusedItem.SubItems[1].Text = objProject.m_strPycode; // this.m_lsvProject.FocusedItem.SubItems[2].Text = objProject.m_strWbcode; //} //else //{//失败 // clsCommonDialog.m_mthShowDBError(); //} } //this.m_ProjectdProjectSave.Enabled = true; Cursor.Current = Cursors.Default; }
private bool LoadProjects(out string message) { message = string.Empty; if (!System.IO.File.Exists(ItemPath)) { message = "未找到配置文件."; return(false); } System.Xml.XmlDocument xmlConfig = new System.Xml.XmlDocument(); try { xmlConfig.Load(ItemPath); XmlNodeList itemNodes = xmlConfig["Configs"]["Items"].SelectNodes("Item"); if (itemNodes == null || itemNodes.Count == 0) { message = "配置文件中没有项目!"; return(false); } foreach (XmlNode node in itemNodes) { clsSTCheckProject item = new clsSTCheckProject(); foreach (XmlNode xn in node.ChildNodes) { switch (xn.Name) { case "Name": item.Name = xn.InnerText; break; case "EnglishName": item.EnglishName = xn.InnerText; break; case "TestWaveLength": item.TestWaveLength = xn.InnerText; break; case "RefWaveLength": item.RefWaveLength = xn.InnerText; break; case "BoardFrequence": item.BoardFrequence = xn.InnerText; break; case "BoardTime": item.BoardTime = xn.InnerText; break; case "BoardWay": item.BoardWay = xn.InnerText; break; case "Formula": item.Formula = xn.InnerText; break; case "ConstractValue": item.ConstractRules = LoadConnstractRules(xn); break; default: break; } } if (!string.IsNullOrEmpty(item.Name)) { this.m_lstProjects.Add(item); } } } catch (Exception ex) { message = ex.Message; return(false); } return(true); }