From b497d1b852715e9f4b830c7820598d5112b8b3ca Mon Sep 17 00:00:00 2001 From: bestlqiang Date: Fri, 19 Nov 2021 14:36:00 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BB=A3=E7=A0=81=E4=BF=AE=E6=94=B9=E5=B1=9E?= =?UTF-8?q?=E6=80=A7=E8=A1=A8=E5=86=85=E5=8F=82=E6=95=B0=E6=97=B6,?= =?UTF-8?q?=E7=AB=8B=E5=8D=B3=E5=88=B7=E6=96=B0=E5=88=B0=E7=95=8C=E9=9D=A2?= =?UTF-8?q?(=E5=A6=82=E6=9E=9C=E5=BD=93=E5=89=8D=E5=9C=A8=E6=98=BE?= =?UTF-8?q?=E7=A4=BA)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- LaiPuLaser/Propertie.cpp | 14 +++++++++++++- LaiPuLaser/Propertie.h | 2 +- LaiPuLaser/PropertieMgr.cpp | 3 +-- LaiPuLaser/PropertieMgr.h | 2 +- 4 files changed, 16 insertions(+), 5 deletions(-) diff --git a/LaiPuLaser/Propertie.cpp b/LaiPuLaser/Propertie.cpp index b65bf0b..0cc5dfd 100644 --- a/LaiPuLaser/Propertie.cpp +++ b/LaiPuLaser/Propertie.cpp @@ -2,7 +2,7 @@ #include "Propertie.h" #include "LogMgr.h" #include "FileMgr.h" - +#include "PropertieMgr.h" CPropertie::CPropertie() { m_pVal = NULL; @@ -41,6 +41,18 @@ void CPropertie::PropertyChangeVal(const COleVariant &OleVar) { m_pModule->OnPropertyChanged(); } + auto & PropertieValMap = gDevicePropertieMgr.m_PropertieValMap; + if (PropertieValMap.size()) + { + for (auto & item : PropertieValMap) + { + if ((item.second)->m_pVal == this->m_pVal) + { + (item.first)->SetValue(OleVar); + break; + } + } + } } void CPropertie::WriteRead(bool bRead) { diff --git a/LaiPuLaser/Propertie.h b/LaiPuLaser/Propertie.h index 9a5853b..5bbdce6 100644 --- a/LaiPuLaser/Propertie.h +++ b/LaiPuLaser/Propertie.h @@ -21,7 +21,7 @@ public: private: void WriteToFile(CString &FileName); void ReadFromFile(CString &FileName); -private: +public: void * m_pVal;//变量内存地址 PROPERTIE_TYPE m_Type;//属性的类型 CModule * m_pModule;//变量所属模块变量的地址 diff --git a/LaiPuLaser/PropertieMgr.cpp b/LaiPuLaser/PropertieMgr.cpp index bac78ec..07d40b3 100644 --- a/LaiPuLaser/PropertieMgr.cpp +++ b/LaiPuLaser/PropertieMgr.cpp @@ -104,8 +104,7 @@ bool CPropertieMgr::ChangePropertieByVal(void * pVal, _variant_t newVal) { if ((*iter)->GetpVal() == pVal) { - (*iter)->PropertyChangeVal(newVal); - gDevicePropertieMgr.UpdateDevicePropertyPage(); + (*iter)->PropertyChangeVal(newVal); return true; } } diff --git a/LaiPuLaser/PropertieMgr.h b/LaiPuLaser/PropertieMgr.h index d0c39f1..0fa7eb4 100644 --- a/LaiPuLaser/PropertieMgr.h +++ b/LaiPuLaser/PropertieMgr.h @@ -22,7 +22,7 @@ public: private: void DelAllPropertieVec(); -private: +public: map m_PropertieValMap;//保存变量和属性映射的容器 bool m_bSaveAllPropertie;//保存所有需要存储的属性 vector m_AllPropertieVec;//保存所有需要存储的属性(用来强制保存属性)