private void insertLastSetting() { try { bool isInsert = false; YBChannelInfo ybc = ProDefine.g_YBsetting.Where(m => m.YBName == comboBox1.Text).SingleOrDefault(); if (ybc == null) { ybc = new YBChannelInfo(); isInsert = true; ybc.YBList = new List <YBSetuse>(); ybc.YBName = comboBox1.Text; } int settingCount = this.dataGridView1.Rows.Count - 1; for (int i = 0; i < settingCount; i++) { YBSetuse ybs; if (isInsert) { ybs = new YBSetuse(); } else { ybs = ybc.YBList[i]; } ybs.GNFunction = this.dataGridView1.Rows[i].Cells[0].Value.ToString(); string ChannelInfo = this.dataGridView1.Rows[i].Cells[1].Value.ToString(); string TypeStr = this.dataGridView1.Rows[i].Cells[2].Value.ToString(); int _index = ChannelInfo.IndexOf('-'); int ChannleID = Convert.ToInt32(ChannelInfo.Substring(_index + 1, ChannelInfo.Length - _index - 1)); ybs.ChannelID = ChannleID; ybs.ChannelType = TypeStr; if (isInsert) { ybc.YBList.Add(ybs); } } if (isInsert) { ProDefine.g_YBsetting.Add(ybc); } } catch (System.Exception ex) { MessageBox.Show(ex.Message); } }
public void initUI() { foreach (var info in ProDefine.g_ChannelInfo) { YBSetuse ybs = new YBSetuse(); ybs.ChannelID = info.channelNumber; ybs.ChannelType = info.ChannelType; noUserChannel.Add(ybs); comboBox2.Items.Add(ybs.ChannelType.ToString() + "-" + ybs.ChannelID.ToString()); } int YBNumber = Convert.ToInt32(ProDefine.g_SMExpermentParam.YBNumber); for (int i = 0; i < YBNumber; i++) { this.comboBox1.Items.Add("样本" + (i + 1).ToString()); } }