LAPTOP-T815PCOQ\25526
2025-01-09 009eda749899fc85d3a75ad2016371f27436bf36
SourceCode/Bond/BoounionPLC/PlcView.h
@@ -1,7 +1,28 @@
#pragma once
#include "CBaseView.h"
#include "BlButton.h"
#include "PLC.h"
// BUTTON控件
#define BTN_MAX         7
#define BTN_RUN         0 // 启动
#define BTN_AUTO      1 // 自动
#define BTN_PUASE      2 // 暂停
#define BTN_MANUAL      3 // 手动
#define BTN_MUTE      4 // 静音
#define BTN_OPR         5 // 复位
#define BTN_STOP      6 // ֹͣ
// 操作类型
enum class OperationType {
   RUN = 0,         // 启动
   AUTO,            // 自动
   PUASE,            // 暂停
   MANUAL,            // 手动
   MUTE,             // 静音
   OPR,            // 复位
   STOP            // ֹͣ
};
class CPlcView :public CBaseView
{
@@ -19,11 +40,19 @@
   void Resize();
private:
   void SetButtonBackgroundColors(CBlButton* btn, bool bOff);
   void HandleOperation(OperationType eOpType);
   void WriteOperationDataToPLC(OperationType eOpType, bool bPressed);
private:
   COLORREF m_crBkgnd;
   HBRUSH m_hbrBkgnd;
   IObserver* m_pObserver;
   CPLC* m_pPlc;
private:
   // 控件
   CBlButton* m_pBlBtns[BTN_MAX];
   // 对话框数据
#ifdef AFX_DESIGN_TIME
@@ -39,5 +68,13 @@
   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 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();
};