LAPTOP-SNT8I5JK\Boounion
2025-01-21 ccbda3e4f7ed430843fbc0190e8ee0d0f0e3a721
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
#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
{
    DECLARE_DYNAMIC(CPlcView)
 
public:
    CPlcView(CWnd* pParent = nullptr);
    ~CPlcView();
 
public:
    virtual void SetContext(void* pContext);
 
private:
    void InitRxWindows();
    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];
    COLORREF m_crPlcNameBack;
    HBRUSH m_hbrPlcName;
 
    // ¶Ô»°¿òÊý¾Ý
#ifdef AFX_DESIGN_TIME
    enum { IDD = IDD_VIEW_PLC};
#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 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 void OnTimer(UINT_PTR nIDEvent);
};