| | |
| | | CAlarmMonitor* pMonitor = (CAlarmMonitor*)theApp.m_model.getBonder().GetComponent("警告信息"); |
| | | |
| | | pMonitor->Lock(); |
| | | |
| | | #if 0 |
| | | std::map<int, CAlarm*>& alarmings = pMonitor->getAlarmingMap(); |
| | | std::list< CAlarm*>& alarms = pMonitor->getAlarmRecords(); |
| | | |
| | |
| | | for (auto item : alarms) { |
| | | AddAlarm(pMonitor, item); |
| | | } |
| | | #else |
| | | // 获取报警数据 |
| | | auto vecData = AlarmManager::getInstance().getAllAlarms(); |
| | | |
| | | // 填充数据 |
| | | CListCtrl* pListCtrl = (CListCtrl*)GetDlgItem(IDC_LIST_ALARM); |
| | | for (auto item : vecData) { |
| | | pListCtrl->InsertItem(0, _T("")); |
| | | pListCtrl->SetItemText(0, 1, item[0].c_str()); |
| | | pListCtrl->SetItemText(0, 2, item[1].c_str()); |
| | | pListCtrl->SetItemText(0, 3, item[2].c_str()); |
| | | pListCtrl->SetItemText(0, 4, item[3].c_str()); |
| | | } |
| | | #endif // 0 |
| | | |
| | | pMonitor->Unlock(); |
| | | } |
| | |
| | | if (pAlarm->getOffTime() > 0) { |
| | | pListCtrl->SetItemText(0, 4, CToolUnits::timeToString2(pAlarm->getOffTime()).c_str()); |
| | | } |
| | | |
| | | AlarmManager::getInstance().addAlarm( |
| | | std::to_string(pAlarm->getId()).c_str(), |
| | | pMonitor->getAlarmText(pAlarm->getId()), |
| | | CToolUnits::timeToString2(pAlarm->getOnTime()).c_str(), |
| | | CToolUnits::timeToString2(pAlarm->getOffTime()).c_str()); |
| | | } |
| | | |
| | | void CPageAlarm::UpdateAlarm(CAlarmMonitor* pMonitor, CAlarm* pAlarm) |
| | |
| | | if (pListCtrl->GetItemData(i) == (DWORD_PTR)pAlarm) { |
| | | if (pAlarm->getOffTime() > 0) { |
| | | pListCtrl->SetItemText(i, 4, CToolUnits::timeToString2(pAlarm->getOffTime()).c_str()); |
| | | |
| | | AlarmManager::getInstance().updateAlarmEndTime( |
| | | std::to_string(pAlarm->getId()).c_str(), |
| | | pMonitor->getAlarmText(pAlarm->getId()), |
| | | CToolUnits::timeToString2(pAlarm->getOnTime()).c_str(), |
| | | CToolUnits::timeToString2(pAlarm->getOffTime()).c_str()); |
| | | } |
| | | } |
| | | } |
| | |
| | | CListCtrl* pListCtrl = (CListCtrl*)GetDlgItem(IDC_LIST_ALARM); |
| | | for (int i = 0; i < pListCtrl->GetItemCount(); i++) { |
| | | CAlarm* pAlarm = (CAlarm*)pListCtrl->GetItemData(i); |
| | | pAlarm->release(); |
| | | if (pAlarm != nullptr) { |
| | | pAlarm->release(); |
| | | } |
| | | } |
| | | |
| | | return CDialogEx::DestroyWindow(); |