From be5908615aa5f61c478cf3fa3823dc07c9b1d70f Mon Sep 17 00:00:00 2001
From: LAPTOP-T815PCOQ\25526 <mr.liuyang@126.com>
Date: 星期四, 12 十二月 2024 18:08:34 +0800
Subject: [PATCH] 1. 添加报警表 2. 读取数据库中的报警表显示在界面上,或添加报警数据
---
SourceCode/Bond/BondEq/BondEqDlg.cpp | 48 ++++++++++++++++++++++++++++++++++++++++++++++++
1 files changed, 48 insertions(+), 0 deletions(-)
diff --git a/SourceCode/Bond/BondEq/BondEqDlg.cpp b/SourceCode/Bond/BondEq/BondEqDlg.cpp
index 3f3103b..f381744 100644
--- a/SourceCode/Bond/BondEq/BondEqDlg.cpp
+++ b/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();
+}
--
Gitblit v1.9.3