LAPTOP-T815PCOQ\25526
2025-01-13 9ea5eea16629a2ab4473727e6b064f83f71aa46c
SourceCode/Bond/BoounionPLC/BoounionPLCDlg.cpp
@@ -138,14 +138,20 @@
            }
         }
         else if (code == RX_CODE_ALARM_ON) {
            AlarmOn();
            // CAlarmMonitor* pComponent = (CAlarmMonitor*)theApp.m_model.getBonder().GetComponent(ALARM_MONITOR);
            // m_pTopToolbar->GetBtn(IDC_BUTTON_ALARM)->EnableWindow(pComponent->isAlarming());
            CPLC* pPlc;
            if (pAny->getPtrValue("ptr", (void*&)pPlc) && pPlc == theApp.m_model.getCurrentPlc()) {
               AlarmOn(pPlc);
               CAlarmMonitor* pComponent = (CAlarmMonitor*)pPlc->getComponent(ALARM_MONITOR);
               m_pTopToolbar->GetBtn(IDC_BUTTON_ALARM)->EnableWindow(pComponent->isAlarming());
            }
         }
         else if (code == RX_CODE_ALARM_OFF) {
            AlarmOff();
            // CAlarmMonitor* pComponent = (CAlarmMonitor*)theApp.m_model.getBonder().GetComponent(ALARM_MONITOR);
            // m_pTopToolbar->GetBtn(IDC_BUTTON_ALARM)->EnableWindow(pComponent->isAlarming());
            CPLC* pPlc;
            if (pAny->getPtrValue("ptr", (void*&)pPlc) && pPlc == theApp.m_model.getCurrentPlc()) {
               AlarmOff(pPlc);
               CAlarmMonitor* pComponent = (CAlarmMonitor*)pPlc->getComponent(ALARM_MONITOR);
               m_pTopToolbar->GetBtn(IDC_BUTTON_ALARM)->EnableWindow(pComponent->isAlarming());
            }
         }
         pAny->release();
      }, [&]() -> void {
@@ -645,22 +651,22 @@
   m_pMainContainer->Resize();
}
void CBoounionPLCDlg::AlarmOn()
void CBoounionPLCDlg::AlarmOn(CPLC* pPlc)
{
   if (m_pAlarmWnd == nullptr) {
      m_pAlarmWnd = new CAlarmPopupDlg();
      //m_pAlarmWnd->SetPLC(theApp.m_model.getBonder().getPLC("PLC(1)"));
      m_pAlarmWnd->SetPLC(pPlc);
      m_pAlarmWnd->Create(IDD_DIALOG_POPUP_ALARM, this);
      m_pAlarmWnd->CenterWindow();
   }
   m_pAlarmWnd->AlarmOn();
}
void CBoounionPLCDlg::AlarmOff()
void CBoounionPLCDlg::AlarmOff(CPLC* pPlc)
{
   if (m_pAlarmWnd == nullptr) {
      m_pAlarmWnd = new CAlarmPopupDlg();
      //m_pAlarmWnd->SetPLC(theApp.m_model.getBonder().getPLC("PLC(1)"));
      m_pAlarmWnd->SetPLC(pPlc);
      m_pAlarmWnd->Create(IDD_DIALOG_POPUP_ALARM, this);
      m_pAlarmWnd->CenterWindow();
   }