修复IDE0017警告:简化DeviceManager.cs和TemperatureData.cs中的对象初始化
This commit is contained in:
@@ -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)
|
||||
|
||||
@@ -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;
|
||||
|
||||
Reference in New Issue
Block a user