// 添加设备按钮 private void buttonAppend_Click(object sender, EventArgs e) { comBoxItem comtype = (comBoxItem)comboBoxType.SelectedItem; comBoxItem comsub1 = (comBoxItem)comboBoxsub1.SelectedItem; TaskInfo task = new TaskInfo(comtype.Value, comsub1.Value, (int)numericUpDownnum.Value); ROIInfo roi = new ROIInfo((int)numericUpDownStartX.Value, (int)numericUpDownStartY.Value, 0, 0, (int)numericUpDownwidth.Value, (int)numericUpDownheight.Value); string devicename = textBoxgetname.Text; // 需要另外增添的文本 string AddtitionCnotext = null; if (DLLDefine.sg_task_pointer == comtype.Value) { AddtitionCnotext = ((int)numericUpDownpointerLow.Value).ToString() + "," + ((int)numericUpDownPointerhigh.Value).ToString() + "," + textBoxpointerUnit.Text; } else if (DLLDefine.sg_task_knob == comtype.Value) { AddtitionCnotext = richTextBoxKnobitem.Text; } string order = numericUpDownOrder.Value.ToString(); xmlProcess.appendDevice(textBoxXMLpath.Text, devicename, task, roi, AddtitionCnotext, order, QRCodeRefer); loadXML(textBoxXMLpath.Text); MessageBox.Show("添加成功"); }
// 更改type后清空后续下拉框 private void comboBoxType_SelectedIndexChanged(object sender, EventArgs e) { comBoxItem select = (comBoxItem)comboBoxType.SelectedItem; comboBoxsub1.DataSource = null; comboBoxsub1.Items.Clear(); numericUpDownnum.Value = 1; comboxsubGen(select.Value); }