From 90ae1c3db92833354814484e65f8cd2eef1f5f3e Mon Sep 17 00:00:00 2001
From: LAPTOP-SNT8I5JK\Boounion <Chenluhua@qq.com>
Date: 星期三, 30 七月 2025 15:14:20 +0800
Subject: [PATCH] 1.配方列表获取完善;

---
 SourceCode/Bond/Servo/CPageCollectionEvent.cpp |  126 ++++++++++++++++++++++++++++++++++++++++++
 1 files changed, 126 insertions(+), 0 deletions(-)

diff --git a/SourceCode/Bond/Servo/CPageCollectionEvent.cpp b/SourceCode/Bond/Servo/CPageCollectionEvent.cpp
new file mode 100644
index 0000000..a7108fb
--- /dev/null
+++ b/SourceCode/Bond/Servo/CPageCollectionEvent.cpp
@@ -0,0 +1,126 @@
+锘�// CPageCollectionEvent.cpp: 瀹炵幇鏂囦欢
+//
+
+#include "stdafx.h"
+#include "Servo.h"
+#include "CPageCollectionEvent.h"
+#include "afxdialogex.h"
+
+
+// CPageCollectionEvent 瀵硅瘽妗�
+
+IMPLEMENT_DYNAMIC(CPageCollectionEvent, CHMPropertyPage)
+
+CPageCollectionEvent::CPageCollectionEvent(CWnd* pParent /*=nullptr*/)
+	: CHMPropertyPage(IDD_PAGE_COLLECTION_EVENT, pParent)
+{
+
+}
+
+CPageCollectionEvent::~CPageCollectionEvent()
+{
+}
+
+void CPageCollectionEvent::DoDataExchange(CDataExchange* pDX)
+{
+	CDialogEx::DoDataExchange(pDX);
+	DDX_Control(pDX, IDC_LIST1, m_listCtrl);
+}
+
+
+BEGIN_MESSAGE_MAP(CPageCollectionEvent, CHMPropertyPage)
+	ON_WM_CTLCOLOR()
+	ON_WM_DESTROY()
+	ON_WM_SIZE()
+END_MESSAGE_MAP()
+
+
+// CPageCollectionEvent 娑堟伅澶勭悊绋嬪簭
+
+
+BOOL CPageCollectionEvent::OnInitDialog()
+{
+	CHMPropertyPage::OnInitDialog();
+
+	// 璇诲嚭鍒楀
+	CString strIniFile, strItem;
+	strIniFile.Format(_T("%s\\configuration.ini"), (LPTSTR)(LPCTSTR)theApp.m_strAppDir);
+	int width[8] = { 0, 218, 180, 180, 180, 180, 180, 180 };
+	for (int i = 0; i < 8; i++) {
+		strItem.Format(_T("Col_%d_Width"), i);
+		width[i] = GetPrivateProfileInt("PageCollectionListCtrl", strItem, width[i], strIniFile);
+	}
+
+
+	// 鎶ヨ〃鎺т欢
+	DWORD dwStyle = m_listCtrl.GetExtendedStyle();
+	dwStyle |= LVS_EX_FULLROWSELECT;
+	dwStyle |= LVS_EX_GRIDLINES;
+	m_listCtrl.SetExtendedStyle(dwStyle);
+
+	HIMAGELIST imageList = ImageList_Create(24, 24, ILC_COLOR24, 1, 1);
+	ListView_SetImageList(m_listCtrl.GetSafeHwnd(), imageList, LVSIL_SMALL);
+	m_listCtrl.InsertColumn(0, _T(""), LVCFMT_RIGHT, width[0]);
+	m_listCtrl.InsertColumn(1, _T("CEID"), LVCFMT_LEFT, width[1]);
+	m_listCtrl.InsertColumn(2, _T("CE Name"), LVCFMT_LEFT, width[2]);
+	m_listCtrl.InsertColumn(3, _T("Descriptions"), LVCFMT_LEFT, width[3]);
+	m_listCtrl.InsertColumn(4, _T("Attached RPTID"), LVCFMT_LEFT, width[4]);
+	loadCollectionEvents();
+
+	return TRUE;  // return TRUE unless you set the focus to a control
+				  // 寮傚父: OCX 灞炴�ч〉搴旇繑鍥� FALSE
+}
+
+
+HBRUSH CPageCollectionEvent::OnCtlColor(CDC* pDC, CWnd* pWnd, UINT nCtlColor)
+{
+	HBRUSH hbr = CHMPropertyPage::OnCtlColor(pDC, pWnd, nCtlColor);
+
+	// TODO:  鍦ㄦ鏇存敼 DC 鐨勪换浣曠壒鎬�
+
+	// TODO:  濡傛灉榛樿鐨勪笉鏄墍闇�鐢荤瑪锛屽垯杩斿洖鍙︿竴涓敾绗�
+	return hbr;
+}
+
+
+void CPageCollectionEvent::OnDestroy()
+{
+	CHMPropertyPage::OnDestroy();
+
+	// 淇濆瓨鍒楀
+	CString strIniFile, strItem, strTemp;
+	strIniFile.Format(_T("%s\\configuration.ini"), (LPTSTR)(LPCTSTR)theApp.m_strAppDir);
+	CHeaderCtrl* pHeader = m_listCtrl.GetHeaderCtrl();
+	for (int i = 0; i < pHeader->GetItemCount(); i++) {
+		RECT rect;
+		pHeader->GetItemRect(i, &rect);
+		strItem.Format(_T("Col_%d_Width"), i);
+		strTemp.Format(_T("%d"), rect.right - rect.left);
+		WritePrivateProfileString("PageCollectionListCtrl", strItem, strTemp, strIniFile);
+	}
+}
+
+
+void CPageCollectionEvent::OnSize(UINT nType, int cx, int cy)
+{
+	CHMPropertyPage::OnSize(nType, cx, cy);
+	if (GetDlgItem(IDC_LIST1) == nullptr) return;
+
+	CWnd* pItem;
+	CRect rcClient, rcItem;
+	GetClientRect(&rcClient);
+	m_listCtrl.MoveWindow(12, 12, rcClient.Width() - 24, rcClient.Height() - 24);
+}
+
+void CPageCollectionEvent::loadCollectionEvents()
+{
+	auto& collectionEvent = theApp.m_model.m_hsmsPassive.getCollectionEvents();
+	for (auto item : collectionEvent) {
+		int index = m_listCtrl.InsertItem(m_listCtrl.GetItemCount(), _T(""));
+		m_listCtrl.SetItemData(index, (DWORD_PTR)item);
+		m_listCtrl.SetItemText(index, 1, std::to_string(item->getEventId()).c_str());
+		m_listCtrl.SetItemText(index, 2, item->getName().c_str());
+		m_listCtrl.SetItemText(index, 3, item->getDescription().c_str());
+		m_listCtrl.SetItemText(index, 4, item->getReportIdsText().c_str());
+	}
+}

--
Gitblit v1.9.3