// CEquipmentPage3.cpp: 实现文件 // #include "stdafx.h" #include "Servo.h" #include "CEquipmentPage3.h" #include "afxdialogex.h" // CEquipmentPage3 对话框 IMPLEMENT_DYNAMIC(CEquipmentPage3, CHMPropertyPage) CEquipmentPage3::CEquipmentPage3(CWnd* pParent /*=nullptr*/) : CHMPropertyPage(IDD_PAGE_EQUIPMENT3, pParent) { m_pEquipment = nullptr; } CEquipmentPage3::~CEquipmentPage3() { } void CEquipmentPage3::DoDataExchange(CDataExchange* pDX) { CHMPropertyPage::DoDataExchange(pDX); } BEGIN_MESSAGE_MAP(CEquipmentPage3, CHMPropertyPage) ON_WM_CTLCOLOR() ON_WM_DESTROY() ON_WM_SIZE() ON_BN_CLICKED(IDC_BUTTON_DISPATCHING_MODE_EAP, &CEquipmentPage3::OnBnClickedButtonDispatchingModeEap) ON_BN_CLICKED(IDC_BUTTON_DISPATCHING_MODE_LOCAL, &CEquipmentPage3::OnBnClickedButtonDispatchingModeLocal) END_MESSAGE_MAP() // CEquipmentPage3 消息处理程序 void CEquipmentPage3::OnApply() { __super::OnApply(); } void CEquipmentPage3::setEquipment(SERVO::CEquipment* pEquipment) { m_pEquipment = pEquipment; } BOOL CEquipmentPage3::OnInitDialog() { CHMPropertyPage::OnInitDialog(); // TODO: 在此添加额外的初始化 return TRUE; // return TRUE unless you set the focus to a control // 异常: OCX 属性页应返回 FALSE } HBRUSH CEquipmentPage3::OnCtlColor(CDC* pDC, CWnd* pWnd, UINT nCtlColor) { HBRUSH hbr = CHMPropertyPage::OnCtlColor(pDC, pWnd, nCtlColor); // TODO: 在此更改 DC 的任何特性 // TODO: 如果默认的不是所需画笔,则返回另一个画笔 return hbr; } void CEquipmentPage3::OnDestroy() { CHMPropertyPage::OnDestroy(); // TODO: 在此处添加消息处理程序代码 } void CEquipmentPage3::OnSize(UINT nType, int cx, int cy) { CHMPropertyPage::OnSize(nType, cx, cy); // TODO: 在此处添加消息处理程序代码 } void CEquipmentPage3::OnBnClickedButtonDispatchingModeEap() { ASSERT(m_pEquipment); m_pEquipment->setDispatchingMode(SERVO::DISPATCHING_MODE::EAS, [&](int code) -> int { if (code == WOK) { LOGI("设置DispatchingMode成功.", m_pEquipment->getName().c_str()); AfxMessageBox("设置EAS模式成功!"); } else { LOGI("设置DispatchingMode失败,code:%d", m_pEquipment->getName().c_str(), code); AfxMessageBox("设置EAS模式失败!"); } return 0; }); } void CEquipmentPage3::OnBnClickedButtonDispatchingModeLocal() { ASSERT(m_pEquipment); m_pEquipment->setDispatchingMode(SERVO::DISPATCHING_MODE::Local, [&](int code) -> int { if (code == WOK) { LOGI("设置DispatchingMode成功.", m_pEquipment->getName().c_str()); AfxMessageBox("设置Local模式成功!"); } else { LOGI("设置DispatchingMode失败,code:%d", m_pEquipment->getName().c_str(), code); AfxMessageBox("设置Local模式失败!"); } return 0; }); }