From c7a06817129fb92d51656905252949482698478c Mon Sep 17 00:00:00 2001 From: zqm Date: Thu, 30 Oct 2025 16:55:24 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E5=A4=8DIDE0017=E8=AD=A6=E5=91=8A?= =?UTF-8?q?=EF=BC=9A=E7=AE=80=E5=8C=96DeviceManager.cs=E5=92=8CTemperature?= =?UTF-8?q?Data.cs=E4=B8=AD=E7=9A=84=E5=AF=B9=E8=B1=A1=E5=88=9D=E5=A7=8B?= =?UTF-8?q?=E5=8C=96?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Toprie/Toprie/DeviceManager.cs | 32 +++++++++++-------- .../Toprie/Toprie/TemperatureData.cs | 12 ++++--- 2 files changed, 26 insertions(+), 18 deletions(-) diff --git a/Windows/CS/Framework4.0/Toprie/Toprie/DeviceManager.cs b/Windows/CS/Framework4.0/Toprie/Toprie/DeviceManager.cs index cf6c206..c715657 100644 --- a/Windows/CS/Framework4.0/Toprie/Toprie/DeviceManager.cs +++ b/Windows/CS/Framework4.0/Toprie/Toprie/DeviceManager.cs @@ -1035,9 +1035,11 @@ namespace JoyD.Windows.CS.Toprie try { // 创建TCP客户端并连接到设备的温度数据端口 - _temperatureTcpClient = new TcpClient(); - _temperatureTcpClient.ReceiveTimeout = 5000; - _temperatureTcpClient.SendTimeout = 5000; + _temperatureTcpClient = new TcpClient + { + ReceiveTimeout = 5000, + SendTimeout = 5000 + }; IAsyncResult result = _temperatureTcpClient.BeginConnect(_deviceIp, TEMPERATURE_TCP_PORT, null, null); bool connected = result.AsyncWaitHandle.WaitOne(3000, true); @@ -5294,11 +5296,13 @@ namespace JoyD.Windows.CS.Toprie } // 创建新的温度数据对象 - TemperatureData result = new TemperatureData(); - result.Width = width; - result.Height = height; - result.CompensationValue = CompensationValue; - result.Data = regionData; + TemperatureData result = new TemperatureData + { + Width = width, + Height = height, + CompensationValue = CompensationValue, + Data = regionData + }; result.CalculateStatistics(); return result; @@ -5327,11 +5331,13 @@ namespace JoyD.Windows.CS.Toprie public TemperatureData ConvertTo(TemperatureMode mode) { // 创建新的温度数据对象 - TemperatureData result = new TemperatureData(); - result.Width = Width; - result.Height = Height; - result.CompensationValue = CompensationValue; - result.Data = new float[Height, Width]; + TemperatureData result = new TemperatureData + { + Width = Width, + Height = Height, + CompensationValue = CompensationValue, + Data = new float[Height, Width] + }; // 根据目标模式进行转换 switch (mode) diff --git a/Windows/CS/Framework4.0/Toprie/Toprie/TemperatureData.cs b/Windows/CS/Framework4.0/Toprie/Toprie/TemperatureData.cs index e60b3bd..587e6b4 100644 --- a/Windows/CS/Framework4.0/Toprie/Toprie/TemperatureData.cs +++ b/Windows/CS/Framework4.0/Toprie/Toprie/TemperatureData.cs @@ -259,11 +259,13 @@ namespace Toprie } // 创建TemperatureData实例 - TemperatureData tempData = new TemperatureData(); - tempData.Width = width; - tempData.Height = height; - tempData.TemperatureMatrix = matrix; - tempData.Timestamp = timestamp; + TemperatureData tempData = new TemperatureData + { + Width = width, + Height = height, + TemperatureMatrix = matrix, + Timestamp = timestamp + }; tempData.CalculateStatistics(); return tempData;