From e8a27bb203fe2aff70390a5eca002d7438da9b0f Mon Sep 17 00:00:00 2001 From: mrDarker <mr.darker@163.com> Date: 星期三, 22 十月 2025 14:24:34 +0800 Subject: [PATCH] Merge branch 'clh' into liuyang --- SourceCode/Bond/SGMeasurement/SGMeasurementDlg.h | 76 ++++++++++++++++++++++++++++++++++++- 1 files changed, 73 insertions(+), 3 deletions(-) diff --git a/SourceCode/Bond/SGMeasurement/SGMeasurementDlg.h b/SourceCode/Bond/SGMeasurement/SGMeasurementDlg.h index ab23343..aa76701 100644 --- a/SourceCode/Bond/SGMeasurement/SGMeasurementDlg.h +++ b/SourceCode/Bond/SGMeasurement/SGMeasurementDlg.h @@ -1,10 +1,11 @@ - +锘� // SGMeasurementDlg.h: 澶存枃浠� // #pragma once #include "PLCSignalListener.h" +#include "ProductResultStorage.h" #include <map> #include <vector> @@ -40,6 +41,7 @@ afx_msg void OnDrawItem(int nIDCtl, LPDRAWITEMSTRUCT lpDrawItemStruct); afx_msg void OnClose(); afx_msg LRESULT OnTrayIconClick(WPARAM wParam, LPARAM lParam); + afx_msg void OnTrayOpenDir(); afx_msg void OnTrayRestore(); afx_msg void OnTrayExit(); afx_msg void OnBnClickedButtonConnect(); @@ -115,6 +117,60 @@ * @param vecBuffer 娴嬮噺鏁版嵁缂撳瓨锛屽皢琚�愯鎵撳嵃鍒版棩蹇椾腑銆� */ void PrintSampleData(int nOutNo, const std::vector<float>& vecBuffer); + + /** + * @brief 鑾峰彇褰撳墠搴旂敤绋嬪簭鎵�鍦ㄧ殑鐩綍璺緞銆� + * + * 閫氳繃 GetModuleFileName 鑾峰彇褰撳墠鍙墽琛屾枃浠剁殑瀹屾暣璺緞锛� + * 骞舵埅鍙栨帀鏂囦欢鍚嶉儴鍒嗭紝杩斿洖鐩綍璺緞锛屾湯灏捐嚜甯﹀弽鏂滄潬銆� + * + * @return CString 搴旂敤绋嬪簭鎵�鍦ㄧ洰褰曪紝渚嬪 "C:\\Program Files\\SGMeasurement\\" + */ + CString GetAppDirectory(); + + /** + * @brief 鑾峰彇閰嶇疆鏂囦欢鐨勫畬鏁磋矾寰勩�� + * + * 閰嶇疆鏂囦欢鍚嶅浐瀹氫负 "config.ini"锛屼綅浜庡簲鐢ㄧ▼搴忕洰褰曚笅銆� + * + * @return CString 閰嶇疆鏂囦欢瀹屾暣璺緞锛屼緥濡� "C:\\Program Files\\SGMeasurement\\config.ini" + */ + CString GetConfigPath(); + + /** + * @brief 浠� ini 閰嶇疆鏂囦欢鍔犺浇瀛樺偍涓庡垎鏋愬弬鏁般�� + * + * 璇诲彇鎸囧畾 ini 鏂囦欢涓殑鍙傛暟鍊硷紝骞舵洿鏂板璇濇绫讳腑鐨勬垚鍛樺彉閲忥紝 + * 鍖呮嫭瀛樺偍璁剧疆锛堣Е鍙戞柟寮忋�侀噰鏍风偣鏁帮級銆佽烦鍙樻娴嬪弬鏁般�佺ǔ瀹氬尯鎻愬彇鍙傛暟绛夈�� + * 鑻ユ枃浠朵腑缂哄皯鏌愪簺瀛楁锛屽皢浣跨敤榛樿鍊笺�� + * + * @param strFile ini 鏂囦欢璺緞銆� + * @return true 琛ㄧず鍔犺浇鎴愬姛锛宖alse 琛ㄧず鍔犺浇澶辫触锛堝鏂囦欢涓嶅瓨鍦級銆� + */ + bool LoadConfig(const CString& strFile); + + /** + * @brief 灏嗗綋鍓嶅瓨鍌ㄤ笌鍒嗘瀽鍙傛暟淇濆瓨鍒� ini 閰嶇疆鏂囦欢銆� + * + * 鎶婂璇濇绫讳腑鐨勬垚鍛樺彉閲忥紙瀛樺偍璁剧疆銆佽烦鍙樻娴嬨�佺ǔ瀹氬尯鎻愬彇绛夊弬鏁帮級 + * 搴忓垪鍖栧苟鍐欏叆鍒版寚瀹氱殑 ini 鏂囦欢涓紝浠ヤ究涓嬫鍚姩鏃舵仮澶嶃�� + * + * @param strFile ini 鏂囦欢璺緞銆� + * @return true 琛ㄧず淇濆瓨鎴愬姛锛宖alse 琛ㄧず淇濆瓨澶辫触銆� + */ + bool SaveConfig(const CString& strFile); + + /** + * @brief 璁剧疆鎴栧彇娑堝綋鍓嶇▼搴忕殑寮�鏈鸿嚜鍚姩銆� + * + * 璇ュ嚱鏁颁細鍦ㄦ敞鍐岃〃 `HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Run` + * 涓嬪啓鍏ユ垨鍒犻櫎褰撳墠绋嬪簭鐨勮矾寰勶紝浠庤�屾帶鍒舵槸鍚﹂殢 Windows 鍚姩鑷姩杩愯銆� + * + * @param bEnable 鏄惁鍚敤鑷惎鍔ㄣ�倀rue 琛ㄧず璁剧疆寮�鏈鸿嚜鍚紝false 琛ㄧず鍙栨秷鑷惎銆� + * + * @return true 琛ㄧず鎿嶄綔鎴愬姛锛沠alse 琛ㄧず鎿嶄綔澶辫触锛堝娉ㄥ唽琛ㄦ潈闄愪笉瓒筹級銆� + */ + bool SetAutoStart(bool bEnable); /** * @brief 灏濊瘯杩炴帴鍒版祴閲忚澶囥�� @@ -233,9 +289,9 @@ * @brief 鍒嗘瀽鎸囧畾绔彛鐨勫瓨鍌ㄦ暟鎹紝骞舵彁鍙栦袱娈电幓鐠冩暟鎹笌绋冲畾鍖猴紝璁$畻鍋忕Щ銆� * * @param nOutNo 杈撳嚭绔彛缂栧彿锛�1~4锛� - * @return float 鎴愬姛杩斿洖璁$畻鍑虹殑鍋忕Щ閲忥紝澶辫触杩斿洖 -1.0f + * @return double 鎴愬姛杩斿洖璁$畻鍑虹殑鍋忕Щ閲忥紝澶辫触杩斿洖 -1.0f */ - float AnalyzeStoredData(int nOutNo); + double AnalyzeStoredData(int nOutNo); // === 绯荤粺鐘舵�佷笌杩愯鏁版嵁 === @@ -334,10 +390,24 @@ */ BOOL m_bExitingFromTray; + // === 鑷惎鍔ㄧ浉鍏� === + + /** + * @brief 鏄惁寮�鏈鸿嚜鍚姩 + */ + BOOL m_nAutoStart; + // === PLC 淇″彿鐩戝惉鍣� === /** * @brief PLC 淇″彿鐩戝惉鍣ㄥ疄渚嬶紝鐢ㄤ簬澶勭悊 PLC 淇″彿浜嬩欢 */ CPLCSignalListener m_plcListener; + + // === 浜у搧缁撴灉瀛樺偍 === + + /** + * @brief 浜у搧缁撴灉瀛樺偍瀹炰緥锛岀敤浜庝繚瀛樺拰绠$悊娴嬮噺缁撴灉 + */ + CProductResultStorage m_resultStorage; }; -- Gitblit v1.9.3