LAPTOP-T815PCOQ\25526
2024-12-12 be5908615aa5f61c478cf3fa3823dc07c9b1d70f
SourceCode/Bond/BondEq/BondEqDlg.cpp
@@ -72,6 +72,7 @@
   m_pHomeDialog = nullptr;
   m_pActiveView = nullptr;
   m_pActiveComponentDlg = nullptr;
   m_pAlarmWnd = nullptr;
}
void CBondEqDlg::DoDataExchange(CDataExchange* pDX)
@@ -152,6 +153,12 @@
               }
            }
         }
         else if (code == RX_CODE_ALARM_ON) {
            AlarmOn();
         }
         else if (code == RX_CODE_ALARM_OFF) {
            AlarmOff();
         }
         pAny->release();
      }, [&]() -> void {
         // onComplete
@@ -218,6 +225,22 @@
   catch (const std::exception& ex) {
      CString errorMsg;
      errorMsg.Format(_T("初始化系统日志模块失败:%s"), CString(ex.what()));
      AfxMessageBox(errorMsg, MB_ICONERROR);
      return FALSE;
   }
   // 初始化报警模块
   AlarmManager& alarmManager = AlarmManager::getInstance();
   alarmManager.setDatabase(db.get());
   try {
      if (!alarmManager.initializeAlarmTable()) {
         AfxMessageBox("初始化报警模块失败!");
         return FALSE;
      }
   }
   catch (const std::exception& ex) {
      CString errorMsg;
      errorMsg.Format(_T("初始化报警模块失败:%s"), CString(ex.what()));
      AfxMessageBox(errorMsg, MB_ICONERROR);
      return FALSE;
   }
@@ -391,6 +414,11 @@
   if (m_hbrBkgnd != nullptr) {
      ::DeleteObject(m_hbrBkgnd);
   }
   if (m_pAlarmWnd != nullptr) {
      m_pAlarmWnd->DestroyWindow();
      delete m_pAlarmWnd;
   }
   ASSERT(m_pObserver != NULL);
@@ -785,3 +813,23 @@
   return pDlg;
}
void CBondEqDlg::AlarmOn()
{
   if (m_pAlarmWnd == nullptr) {
      m_pAlarmWnd = new CAlarmPopupDlg();
      m_pAlarmWnd->Create(IDD_DIALOG_POPUP_ALARM, this);
      m_pAlarmWnd->CenterWindow();
   }
   m_pAlarmWnd->ShowWindow(SW_SHOW);
   m_pAlarmWnd->AlarmOn();
}
void CBondEqDlg::AlarmOff()
{
   if (m_pAlarmWnd == nullptr) {
      m_pAlarmWnd = new CAlarmPopupDlg();
      m_pAlarmWnd->Create(IDD_DIALOG_POPUP_ALARM, this);
      m_pAlarmWnd->CenterWindow();
   }
   m_pAlarmWnd->AlarmOff();
}