| | |
| | | #include "afxdialogex.h" |
| | | #include "IOManager.h" |
| | | #include "BLLabel.h" |
| | | #include "CPLC.h" |
| | | |
| | | |
| | | // CIOMonitoringDlg 对话框 |
| | |
| | | CIOMonitoringDlg(CWnd* pParent = nullptr); // 标准构造函数 |
| | | virtual ~CIOMonitoringDlg(); |
| | | void SetIOManager(const std::string& machineName); // 设置 IOManager 和机器名 |
| | | void SetPLC(CPLC* pPLC); // 设置 PLC |
| | | |
| | | // 对话框数据 |
| | | #ifdef AFX_DESIGN_TIME |
| | |
| | | |
| | | void UpdatePageInfo(); // 更新分页信息 |
| | | void CreateDynamicControls(); // 动态创建控件 |
| | | void CreateStaticControl(int x, int y, int width, int height, const CString& text, bool hasBorder = false, TextAlign alignment = AlignLeft); // 创建静态控件 |
| | | 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; // 当前页 |
| | |
| | | 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; |
| | |
| | | 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(); |
| | | }; |