void createSerialUserControlConfigured() { //清空之前加载的串口控件数组 comDic.Clear(); //var list = dataManage.serialDic.ToList() foreach (var elem in dataManage.serialDic) { UserControlCom com = new UserControlCom(this, elem.Key, elem.Value, !dataManage.newControlerFlag); comDic.Add(elem.Key, com); } }
//动态创建串口界面 void createSerialUserControl() { //清空之前加载的串口控件数组 comDic.Clear(); List <DeviceModuleElem> list = dataManage.deviceInfoElem.connector.moduleList; foreach (DeviceModuleElem elem in list) { if (elem.moduleID == "SERIAL_LINE") { SERIALData data = new SERIALData(); data.name = elem.baseName; data.terminalResis = elem.terminalResis; data.databitEnable = elem.databitEnable; UserControlCom com = new UserControlCom(this, elem.baseName, data, false); comDic.Add(elem.baseName, com); dataManage.serialDic.Add(elem.baseName, data); } } }
//name就是key,本体COM1,本体COM2等 public void setCOMInfo(string name) { if (userBase_.comDic.ContainsKey(name)) { UserControlCom com = /*new UserControlCom(name)*/ userBase_.comDic[name]; if (!split.Panel2.Controls.Contains(com)) { split.Panel2.Controls.Clear(); com.Dock = DockStyle.Fill; split.Panel2.Controls.Add(com); setShow(name, picArray); //if(picArray.ContainsKey(name)) //{ // picArray[name].SetAllFlagFalse(); // picArray[name].SetSelectedFlag(true); // picArray[name].Refresh(); //} } } }