From 9382684ef64a3552f37eafa0bfbf1eeb20a806a9 Mon Sep 17 00:00:00 2001 From: vbtang Date: Sun, 2 Jul 2017 18:36:24 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E6=94=B9=E5=AE=8C=E6=88=90=E7=9A=84?= =?UTF-8?q?=E4=BC=A0=E6=84=9F=E5=99=A8=E9=80=89=E6=8B=A9=E7=95=8C=E9=9D=A2?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Src/Edislab/Edislab Pro/DlgSensorChoose.cpp | 18 ++++++++++++------ 1 file changed, 12 insertions(+), 6 deletions(-) diff --git a/Src/Edislab/Edislab Pro/DlgSensorChoose.cpp b/Src/Edislab/Edislab Pro/DlgSensorChoose.cpp index 1d29627..6b05641 100644 --- a/Src/Edislab/Edislab Pro/DlgSensorChoose.cpp +++ b/Src/Edislab/Edislab Pro/DlgSensorChoose.cpp @@ -364,11 +364,15 @@ void CDlgSensorChoose::RefreshSensorList() BOOST_FOREACH(auto &sensor, vecSensorList) { // 已经添加的传感器禁止再次显示 - if (CSensorIDGenerator::CreateInstance().IsSensorExist(sensor.strSensorName)) + std::string strSensorUnit = sensor.SensorRangeInfoArray[0].strUnitName; + + std::string strSensorName = sensor.strSensorName + std::string("[") + strSensorUnit + std::string("]"); + if (CSensorIDGenerator::CreateInstance().IsSensorExist(strSensorName)) { continue; } + CString str(sensor.strSensorName.c_str()); int nIndex = m_ListSensor.AddString(str); str = sensor.strSensorModelName.c_str(); @@ -473,6 +477,13 @@ void CDlgSensorChoose::RefreshChoosedSensorList() BOOST_FOREACH(auto &strSenorName , vecStrSensorList) { + int nIndexof = strSenorName.find_first_of('['); + if (-1 == nIndexof) + { + continue; + } + + strSenorName = strSenorName.substr(0, nIndexof); SENSOR_CONFIG_ELEMENT element = CSensorConfig::CreateInstance().GetSensorInfo(strSenorName); if (-1 == element.nSensorID) { @@ -511,11 +522,6 @@ void CDlgSensorChoose::RefreshChoosedSensorList() m_ListChoosedSensor.SetItemImage(nIndex, element.nSensorID); } - // 添加列表显示列 - COLUMN_INFO AddColumnInfo; - AddColumnInfo.strColumnName.Format(_T("%s(%s)"), CString(element.strSensorSymbol.c_str()), CString(element.strSensorName.c_str())); - CGridColumnGroupManager::CreateInstance().AddDisplayColumnInfo(_T("当前"), AddColumnInfo); - // 删除已有的传感器,防止重新添加 nIndex = m_ListSensor.GetCurSel(); m_ListSensor.DeleteString(nIndex);