修复代码警告:1. 简化对象初始化 2. 设置只读字段
This commit is contained in:
@@ -118,8 +118,7 @@ namespace JoyD.Windows.CS.Toprie
|
|||||||
using (Font font = new Font("Arial", 48, FontStyle.Bold))
|
using (Font font = new Font("Arial", 48, FontStyle.Bold))
|
||||||
using (SolidBrush textBrush = new SolidBrush(textColor))
|
using (SolidBrush textBrush = new SolidBrush(textColor))
|
||||||
{
|
{
|
||||||
StringFormat format = new StringFormat();
|
StringFormat format = new StringFormat() { Alignment = StringAlignment.Center };
|
||||||
format.Alignment = StringAlignment.Center;
|
|
||||||
|
|
||||||
// 将主文本居中显示
|
// 将主文本居中显示
|
||||||
g.DrawString(text, font, textBrush,
|
g.DrawString(text, font, textBrush,
|
||||||
@@ -155,8 +154,7 @@ namespace JoyD.Windows.CS.Toprie
|
|||||||
using (Font font = new Font("Arial", 48, FontStyle.Bold))
|
using (Font font = new Font("Arial", 48, FontStyle.Bold))
|
||||||
using (SolidBrush textBrush = new SolidBrush(textColor))
|
using (SolidBrush textBrush = new SolidBrush(textColor))
|
||||||
{
|
{
|
||||||
StringFormat format = new StringFormat();
|
StringFormat format = new StringFormat() { Alignment = StringAlignment.Center };
|
||||||
format.Alignment = StringAlignment.Center;
|
|
||||||
|
|
||||||
// 将主文本居中显示
|
// 将主文本居中显示
|
||||||
g.DrawString(text, font, textBrush,
|
g.DrawString(text, font, textBrush,
|
||||||
|
|||||||
@@ -182,7 +182,7 @@ namespace JoyD.Windows.CS.Toprie
|
|||||||
// 是否已释放
|
// 是否已释放
|
||||||
private bool _isDisposed = false;
|
private bool _isDisposed = false;
|
||||||
// 图像模式
|
// 图像模式
|
||||||
private ImageMode _currentImageMode = ImageMode.Infrared;
|
private readonly ImageMode _currentImageMode = ImageMode.Infrared;
|
||||||
// 当前色彩模式
|
// 当前色彩模式
|
||||||
private PaletteType _currentPaletteType = PaletteType.WhiteHot;
|
private PaletteType _currentPaletteType = PaletteType.WhiteHot;
|
||||||
// 当前视频模式
|
// 当前视频模式
|
||||||
|
|||||||
@@ -69,8 +69,7 @@ namespace JoyD.Windows.CS.Toprie
|
|||||||
|
|
||||||
// 启动工作线程
|
// 启动工作线程
|
||||||
_isRunning = true;
|
_isRunning = true;
|
||||||
_workerThread = new Thread(ProcessRequests);
|
_workerThread = new Thread(ProcessRequests) { IsBackground = true };
|
||||||
_workerThread.IsBackground = true;
|
|
||||||
_workerThread.Start();
|
_workerThread.Start();
|
||||||
|
|
||||||
Console.WriteLine("UDP通信管理器已初始化");
|
Console.WriteLine("UDP通信管理器已初始化");
|
||||||
|
|||||||
@@ -1129,9 +1129,10 @@ namespace JoyD.Windows.CS.Toprie
|
|||||||
if (SendCommand(command, out string response))
|
if (SendCommand(command, out string response))
|
||||||
{
|
{
|
||||||
// 创建默认的ImagePos对象
|
// 创建默认的ImagePos对象
|
||||||
SharedStructures.ImagePos data = new SharedStructures.ImagePos();
|
SharedStructures.ImagePos data = new SharedStructures.ImagePos() {
|
||||||
data.area = new SharedStructures.AreaPos[6];
|
area = new SharedStructures.AreaPos[6],
|
||||||
data.spot = new SharedStructures.SpotPos[6];
|
spot = new SharedStructures.SpotPos[6]
|
||||||
|
};
|
||||||
|
|
||||||
// 这里应该解析完整的响应数据
|
// 这里应该解析完整的响应数据
|
||||||
// 简化实现,返回默认值
|
// 简化实现,返回默认值
|
||||||
|
|||||||
Reference in New Issue
Block a user