private bool LoadTemplates(out string message) { message = string.Empty; if (!System.IO.File.Exists(TemplatePath)) { message = "未找到配置文件."; return(false); } System.Xml.XmlDocument xmlConfig = new System.Xml.XmlDocument(); try { xmlConfig.Load(TemplatePath); XmlNodeList nodeList = xmlConfig["Templates"].SelectNodes("Template"); foreach (XmlNode node in nodeList) { string templateName = node.Attributes["name"].Value; List <clsSTBoardItem> lstBoardItem = new List <clsSTBoardItem>(); foreach (XmlNode xn in node.ChildNodes) { if (xn.Name == "BoardItem") { clsSTBoardItem boardItem = new clsSTBoardItem(); int sampleNo = 0; try { sampleNo = int.Parse(xn.Attributes["pos"].Value); } catch { sampleNo = -1; } int typeId = 0; try { typeId = int.Parse(xn.Attributes["type"].Value); } catch { typeId = 0; } int sampleStyleNo = 0; try { sampleStyleNo = int.Parse(xn.Attributes["SampleNo"].Value); } catch { sampleStyleNo = 0; } boardItem.Sequence = sampleNo; boardItem.BoardStyle.SampleStyle = GetSampleType(typeId); boardItem.BoardStyle.SampleStyleNo = sampleStyleNo; if (boardItem.Sequence > 0) { lstBoardItem.Add(boardItem); } } } if (!string.IsNullOrEmpty(templateName) && lstBoardItem.Count > 0) { clsBoardTemplate template = new clsBoardTemplate(templateName, lstBoardItem); m_lstTemplates.Add(template); } } } catch (Exception ex) { message = ex.Message; return(false); } return(true); }
public ctlSTTextBox(clsSTBoardItem boardItem) { InitializeComponent(); this.m_boardItem = boardItem; this.Width = 60; this.TextAlign = HorizontalAlignment.Center; RefreshItem(); }
/// <summary> /// 初始化 /// </summary> private void Init() { m_lstBoardItems.Clear(); for (int i = 0; i < BOARDCOUNT; i++) { clsSTBoardItem boardItem = new clsSTBoardItem(); boardItem.Sequence = i + 1; m_lstBoardItems.Add(boardItem); } }
private clsDeviceReslutVO FindDeviceReslut(clsSTBoardItem boardItem) { foreach (clsDeviceReslutVO checkResult in m_lstCheckResults) { if (checkResult.m_strDeviceSampleID == boardItem.Sequence.ToString()) { return(checkResult); } } return(null); }
/// <summary> /// 单击酶标仪孔事件 /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void BoardItem_Click(object sender, EventArgs e) { if (this.m_chkLockTemplate.Checked) { return; } ctlSTTextBox boardTextBox = sender as ctlSTTextBox; if (boardTextBox == null || !string.IsNullOrEmpty(boardTextBox.Text)) { return; } if (boardTextBox.ReadOnly) { return; } clsSTBoardItem boardItem = boardTextBox.BoardItem as clsSTBoardItem; if (boardItem == null) { return; } clsSTBoardStyle boardItemStyle = boardItem.BoardStyle; if (boardItemStyle.SampleStyle != enmSTSampleStyle.NONE) { return; } boardItemStyle.SampleStyle = this.m_sampleStyle; switch (this.m_sampleStyle) { case enmSTSampleStyle.Common: boardItemStyle.SampleStyleNo = ++this.m_maxCommon; break; case enmSTSampleStyle.Standard: boardItemStyle.SampleStyleNo = ++this.m_maxStandard; break; case enmSTSampleStyle.Quality: boardItemStyle.SampleStyleNo = ++this.m_maxQuality; break; default: break; } boardTextBox.DoClick(); }
private void frmST360_Load(object sender, EventArgs e) { for (int i = 0; i < 96; i++) { clsSTBoardItem boardItem = new clsSTBoardItem(); boardItem.Sequence = i + 1; m_lstBoard.Add(boardItem); } foreach (clsSTBoardItem boardItem in m_lstBoard) { ctlSTTextBox stTextBox = new ctlSTTextBox(boardItem); stTextBox.Click += new EventHandler(BoardItem_Click); stTextBox.TextChanged += new EventHandler(stTextBox_TextChanged); m_lstSTTextBoxs.Add(stTextBox); m_flpContent.Controls.Add(stTextBox); } this.m_sampleStyle = enmSTSampleStyle.Common; this.m_txtBoardNO.Text = DateTime.Now.ToString("yyMMdd") + "01"; m_cmdAnalysis.Enabled = false; m_cmdSubmitData.Enabled = false; }