From 71d7d20abf9f367f8390b7e954042b32c728e513 Mon Sep 17 00:00:00 2001
From: LAPTOP-SNT8I5JK\Boounion <Chenluhua@qq.com>
Date: 星期六, 10 五月 2025 11:00:44 +0800
Subject: [PATCH] 1.修复最初的数条日志无法显示的问题;
---
SourceCode/Bond/Servo/CPageGraph2.cpp | 2 +-
SourceCode/Bond/Servo/PageAlarm.cpp | 11 +----------
SourceCode/Bond/Servo/PageLog.h | 1 -
SourceCode/Bond/Servo/PageLog.cpp | 11 +----------
SourceCode/Bond/Servo/Model.cpp | 11 ++++++-----
SourceCode/Bond/Servo/CPageGraph1.cpp | 2 +-
SourceCode/Bond/Servo/PageAlarm.h | 1 -
7 files changed, 10 insertions(+), 29 deletions(-)
diff --git a/SourceCode/Bond/Servo/CPageGraph1.cpp b/SourceCode/Bond/Servo/CPageGraph1.cpp
index 6d3ac75..8318acd 100644
--- a/SourceCode/Bond/Servo/CPageGraph1.cpp
+++ b/SourceCode/Bond/Servo/CPageGraph1.cpp
@@ -114,6 +114,7 @@
BOOL CPageGraph1::OnInitDialog()
{
CDialogEx::OnInitDialog();
+ InitRxWindows();
SetTimer(1, 3000, nullptr);
@@ -439,7 +440,6 @@
{
if (1 == nIDEvent) {
KillTimer(1);
- InitRxWindows();
// 鏇存柊鐘舵��
{
diff --git a/SourceCode/Bond/Servo/CPageGraph2.cpp b/SourceCode/Bond/Servo/CPageGraph2.cpp
index dfef13f..16890d4 100644
--- a/SourceCode/Bond/Servo/CPageGraph2.cpp
+++ b/SourceCode/Bond/Servo/CPageGraph2.cpp
@@ -83,6 +83,7 @@
BOOL CPageGraph2::OnInitDialog()
{
CDialogEx::OnInitDialog();
+ InitRxWindows();
SetTimer(1, 2000, nullptr);
@@ -375,7 +376,6 @@
void CPageGraph2::OnTimer(UINT_PTR nIDEvent)
{
if (1 == nIDEvent) {
- InitRxWindows();
KillTimer(1);
std::list<SERVO::CEquipment*>& eqs = theApp.m_model.m_master.getEquipmentList();
for (auto eq : eqs) {
diff --git a/SourceCode/Bond/Servo/Model.cpp b/SourceCode/Bond/Servo/Model.cpp
index 0c50bac..95183ef 100644
--- a/SourceCode/Bond/Servo/Model.cpp
+++ b/SourceCode/Bond/Servo/Model.cpp
@@ -19,6 +19,12 @@
IObservable* CModel::getObservable()
{
+ if (m_pObservable == nullptr) {
+ m_pObservable = RX_AllocaObservable([&](IObservableEmitter* e) -> void {
+ m_pObservableEmitter = e; // 保存发射器
+ });
+ }
+
return m_pObservable;
}
@@ -53,11 +59,6 @@
CLog::GetLog()->SetLogsDir(strLogDir);
CLog::GetLog()->SetEquipmentId((LPTSTR)(LPCTSTR)strUnitId);
LOGI("\r\n\r\n~~~ Prog Start! ~~~");
-
-
- m_pObservable = RX_AllocaObservable([&](IObservableEmitter* e) -> void {
- m_pObservableEmitter = e; // 保存发射器
- });
SECSListener listener;
diff --git a/SourceCode/Bond/Servo/PageAlarm.cpp b/SourceCode/Bond/Servo/PageAlarm.cpp
index a1d4919..40ec372 100644
--- a/SourceCode/Bond/Servo/PageAlarm.cpp
+++ b/SourceCode/Bond/Servo/PageAlarm.cpp
@@ -187,7 +187,6 @@
ON_WM_DESTROY()
ON_WM_CLOSE()
ON_WM_SIZE()
- ON_WM_TIMER()
ON_CBN_SELCHANGE(IDC_COMBO_DATETIME, &CPageAlarm::OnCbnSelchangeComboDatetime)
ON_BN_CLICKED(IDC_BUTTON_SEARCH, &CPageAlarm::OnBnClickedButtonSearch)
ON_BN_CLICKED(IDC_BUTTON_EXPORT, &CPageAlarm::OnBnClickedButtonExport)
@@ -200,7 +199,7 @@
BOOL CPageAlarm::OnInitDialog()
{
CDialogEx::OnInitDialog();
- SetTimer(1, 3000, nullptr);
+ InitRxWindow();
// 涓嬫媺妗嗘帶浠�
CComboBox* pComboBox = (CComboBox*)GetDlgItem(IDC_COMBO_DATETIME);
@@ -313,14 +312,6 @@
CDialogEx::OnSize(nType, cx, cy);
if (GetDlgItem(IDC_LIST_ALARM) == nullptr) return;
Resize();
-}
-
-void CPageAlarm::OnTimer(UINT_PTR nIDEvent)
-{
- if (1 == nIDEvent) {
- KillTimer(1);
- InitRxWindow();
- }
}
void CPageAlarm::OnCbnSelchangeComboDatetime()
diff --git a/SourceCode/Bond/Servo/PageAlarm.h b/SourceCode/Bond/Servo/PageAlarm.h
index 783ce29..e520fca 100644
--- a/SourceCode/Bond/Servo/PageAlarm.h
+++ b/SourceCode/Bond/Servo/PageAlarm.h
@@ -63,7 +63,6 @@
afx_msg void OnDestroy();
afx_msg void OnClose();
afx_msg void OnSize(UINT nType, int cx, int cy);
- afx_msg void OnTimer(UINT_PTR nIDEvent);
afx_msg void OnCbnSelchangeComboDatetime();
afx_msg void OnBnClickedButtonSearch();
afx_msg void OnBnClickedButtonExport();
diff --git a/SourceCode/Bond/Servo/PageLog.cpp b/SourceCode/Bond/Servo/PageLog.cpp
index 123a5a4..50b9bfa 100644
--- a/SourceCode/Bond/Servo/PageLog.cpp
+++ b/SourceCode/Bond/Servo/PageLog.cpp
@@ -40,7 +40,6 @@
BEGIN_MESSAGE_MAP(CPageLog, CDialogEx)
ON_WM_CTLCOLOR()
ON_WM_SIZE()
- ON_WM_TIMER()
ON_WM_DESTROY()
ON_WM_CLOSE()
ON_NOTIFY(BLBUTTON_MENU_ITEM_CLICKED, IDC_BUTTON_LEVEL, &CPageLog::OnButtonLevelMenuClicked)
@@ -106,7 +105,7 @@
BOOL CPageLog::OnInitDialog()
{
CDialogEx::OnInitDialog();
- SetTimer(1, 3000, nullptr);
+ InitRxWindow();
// 缓存
@@ -172,14 +171,6 @@
CDialogEx::OnSize(nType, cx, cy);
if (GetDlgItem(IDC_EDIT_LOG) == nullptr) return;
Resize();
-}
-
-void CPageLog::OnTimer(UINT_PTR nIDEvent)
-{
- if (1 == nIDEvent) {
- KillTimer(1);
- InitRxWindow();
- }
}
void CPageLog::Resize()
diff --git a/SourceCode/Bond/Servo/PageLog.h b/SourceCode/Bond/Servo/PageLog.h
index 8670821..391f64d 100644
--- a/SourceCode/Bond/Servo/PageLog.h
+++ b/SourceCode/Bond/Servo/PageLog.h
@@ -51,7 +51,6 @@
public:
virtual BOOL OnInitDialog();
afx_msg void OnSize(UINT nType, int cx, int cy);
- afx_msg void OnTimer(UINT_PTR nIDEvent);
afx_msg void OnDestroy();
afx_msg void OnClose();
afx_msg HBRUSH OnCtlColor(CDC* pDC, CWnd* pWnd, UINT nCtlColor);
--
Gitblit v1.9.3