SourceCode/Bond/BondEq/View/IOMonitoringDlg.h
@@ -1,6 +1,8 @@
#pragma once
#include "afxdialogex.h"
#include "IOManager.h"
#include "BLLabel.h"
#include "CPLC.h"
// CIOMonitoringDlg 对话框
@@ -13,6 +15,7 @@
   CIOMonitoringDlg(CWnd* pParent = nullptr);   // 标准构造函数
   virtual ~CIOMonitoringDlg();
   void SetIOManager(const std::string& machineName); // 设置 IOManager 和机器名
   void SetPLC(CPLC* pPLC); // 设置 PLC
// 对话框数据
#ifdef AFX_DESIGN_TIME
@@ -27,11 +30,14 @@
   void UpdatePageInfo();         // 更新分页信息
   void CreateDynamicControls();   // 动态创建控件
   void CreateStaticControl(int x, int y, int width, int height, const CString& text, bool hasBorder = false, bool alignLeft = false); // 创建静态控件
   void CreateStaticControl(int x, int y, int width, int height, const CString& text, bool hasBorder = false, TextAlign alignment = AlignLeft, std::function<void()> clickCallback = nullptr); // 创建静态控件
   void DisplayCurrentPage();      // 显示当前页数据
   void ClearDynamicControls();   // 清除动态创建的控件
   bool ParsePLCAddress(const CString& address, MC::SOFT_COMPONENT& component, int& addr); // 解析 PLC 地址
   void UpdatePLCStates();         // 定时器更新状态的方法
private:
   CPLC* m_pPLC;
   int m_nInitialWidth;
   int m_nInitialHeight;
   int m_nCurrentPage; // 当前页
@@ -42,10 +48,12 @@
   std::map<int, CFont*> m_mapFonts;      // 字体映射
   std::map<int, CRect> m_mapCtrlLayouts;   // 控件布局映射
   std::vector<IOData> m_displayData;      // 当前显示的数据
   std::vector<CString> m_inputPLCAddresses;  // 存储 1 列 PLC 地址
   std::vector<CString> m_outputPLCAddresses; // 存储 4 列 PLC 地址
private:
   CStatic m_staticPageNum;
   std::vector<CStatic*> m_staticControls; // 动态创建的静态控件
   std::vector<CBLLabel*> m_staticControls; // 动态创建的静态控件
protected:
   virtual void DoDataExchange(CDataExchange* pDX);    // DDX/DDV 支持
@@ -56,4 +64,6 @@
   afx_msg void OnSize(UINT nType, int cx, int cy);
   afx_msg void OnBnClickedButtonPrevPage();
   afx_msg void OnBnClickedButtonNextPage();
   afx_msg void OnTimer(UINT_PTR nIDEvent);
   afx_msg void OnClose();
};