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;//保存所有需要存储的属性(用来强制保存属性)