#pragma once #include "afxdialogex.h" // CProjectPageMain 对话框 enum class OperationType { RUN = 0, // 启动 AUTO, // 自动 PUASE, // 暂停 MANUAL, // 手动 MUTE, // 静音 OPR, // 复位 STOP // 停止 }; class CProjectPageMain : public CDialogEx { DECLARE_DYNAMIC(CProjectPageMain) public: CProjectPageMain(CWnd* pParent = nullptr); // 标准构造函数 virtual ~CProjectPageMain(); public: void SetPLC(CPLC* pPLC); private: void InitRxWindows(); void HandleOperation(OperationType eOpType); void WriteOperationDataToPLC(OperationType eOpType, bool bPressed); void ReadPLCDataToUI(); private: COLORREF m_crBkgnd; HBRUSH m_hbrBkgnd; IObserver* m_pObserver; CPLC* m_pPLC; int nVelocityRatio; // 速度比 double dTactTime; // 周期时间 int nDayShiftCapacity; int nNightShiftCapacity; // 对话框数据 #ifdef AFX_DESIGN_TIME enum { IDD = IDD_PROJECT_PAGE_MAIN }; #endif protected: virtual void DoDataExchange(CDataExchange* pDX); // DDX/DDV 支持 DECLARE_MESSAGE_MAP() public: virtual BOOL OnInitDialog(); afx_msg HBRUSH OnCtlColor(CDC* pDC, CWnd* pWnd, UINT nCtlColor); afx_msg void OnDestroy(); afx_msg void OnSize(UINT nType, int cx, int cy); afx_msg void OnTimer(UINT_PTR nIDEvent); afx_msg void OnClose(); afx_msg void OnBnClickedButtonActivate(); afx_msg void OnBnClickedButtonAuto(); afx_msg void OnBnClickedButtonPuase(); afx_msg void OnBnClickedButtonManualOperation(); afx_msg void OnBnClickedButtonSoundOff(); afx_msg void OnBnClickedButtonResetting(); afx_msg void OnBnClickedButtonStop(); afx_msg LRESULT OnUpdateDataToUI(WPARAM wParam, LPARAM lParam); };