This commit is contained in:
2025-10-20 14:47:17 +08:00
parent 2e46747ba9
commit 546b894e6b
16 changed files with 917 additions and 141 deletions

View File

@@ -28,79 +28,54 @@
/// </summary>
private void InitializeComponent()
{
this.uiTableLayoutPanel1 = new Sunny.UI.UITableLayoutPanel();
this.btnStartDevice = new Sunny.UI.UIButton();
this.btnStartCheck = new Sunny.UI.UIButton();
this.uiTableLayoutPanel1.SuspendLayout();
this.SuspendLayout();
System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(FormControlPanel));
uiTableLayoutPanel1 = new Sunny.UI.UITableLayoutPanel();
btnStartDevice = new Sunny.UI.UIButton();
btnStartCheck = new Sunny.UI.UIButton();
uiTableLayoutPanel1.SuspendLayout();
SuspendLayout();
//
// uiTableLayoutPanel1
//
this.uiTableLayoutPanel1.ColumnCount = 2;
this.uiTableLayoutPanel1.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Percent, 50F));
this.uiTableLayoutPanel1.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Percent, 50F));
this.uiTableLayoutPanel1.Controls.Add(this.btnStartDevice, 0, 1);
this.uiTableLayoutPanel1.Controls.Add(this.btnStartCheck, 0, 3);
this.uiTableLayoutPanel1.Dock = System.Windows.Forms.DockStyle.Fill;
this.uiTableLayoutPanel1.Location = new System.Drawing.Point(0, 0);
this.uiTableLayoutPanel1.Name = "uiTableLayoutPanel1";
this.uiTableLayoutPanel1.RowCount = 5;
this.uiTableLayoutPanel1.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Percent, 11.38585F));
this.uiTableLayoutPanel1.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Percent, 35.35353F));
this.uiTableLayoutPanel1.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Percent, 7.575758F));
this.uiTableLayoutPanel1.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Percent, 33.83838F));
this.uiTableLayoutPanel1.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Percent, 11.38585F));
this.uiTableLayoutPanel1.Size = new System.Drawing.Size(230, 198);
this.uiTableLayoutPanel1.TabIndex = 0;
this.uiTableLayoutPanel1.TagString = null;
resources.ApplyResources(uiTableLayoutPanel1, "uiTableLayoutPanel1");
uiTableLayoutPanel1.Controls.Add(btnStartDevice, 0, 1);
uiTableLayoutPanel1.Controls.Add(btnStartCheck, 0, 3);
uiTableLayoutPanel1.Name = "uiTableLayoutPanel1";
uiTableLayoutPanel1.TagString = null;
//
// btnStartDevice
//
this.uiTableLayoutPanel1.SetColumnSpan(this.btnStartDevice, 2);
this.btnStartDevice.Cursor = System.Windows.Forms.Cursors.Hand;
this.btnStartDevice.Dock = System.Windows.Forms.DockStyle.Fill;
this.btnStartDevice.FillPressColor = System.Drawing.Color.LimeGreen;
this.btnStartDevice.FillSelectedColor = System.Drawing.Color.LimeGreen;
this.btnStartDevice.Font = new System.Drawing.Font("宋体", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
this.btnStartDevice.Location = new System.Drawing.Point(3, 25);
this.btnStartDevice.MinimumSize = new System.Drawing.Size(1, 1);
this.btnStartDevice.Name = "btnStartDevice";
this.btnStartDevice.Size = new System.Drawing.Size(224, 64);
this.btnStartDevice.TabIndex = 0;
this.btnStartDevice.Text = "启动设备";
this.btnStartDevice.TipsFont = new System.Drawing.Font("宋体", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
this.btnStartDevice.Click += new System.EventHandler(this.btnStartDevice_Click);
uiTableLayoutPanel1.SetColumnSpan(btnStartDevice, 2);
btnStartDevice.Cursor = Cursors.Hand;
resources.ApplyResources(btnStartDevice, "btnStartDevice");
btnStartDevice.FillPressColor = Color.LimeGreen;
btnStartDevice.FillSelectedColor = Color.LimeGreen;
btnStartDevice.Name = "btnStartDevice";
btnStartDevice.TipsFont = new Font("宋体", 9F, FontStyle.Regular, GraphicsUnit.Point, 134);
btnStartDevice.Click += btnStartDevice_Click;
//
// btnStartCheck
//
this.uiTableLayoutPanel1.SetColumnSpan(this.btnStartCheck, 2);
this.btnStartCheck.Cursor = System.Windows.Forms.Cursors.Hand;
this.btnStartCheck.Dock = System.Windows.Forms.DockStyle.Fill;
this.btnStartCheck.FillPressColor = System.Drawing.Color.FromArgb(((int)(((byte)(0)))), ((int)(((byte)(192)))), ((int)(((byte)(0)))));
this.btnStartCheck.FillSelectedColor = System.Drawing.Color.FromArgb(((int)(((byte)(0)))), ((int)(((byte)(192)))), ((int)(((byte)(0)))));
this.btnStartCheck.Font = new System.Drawing.Font("宋体", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
this.btnStartCheck.Location = new System.Drawing.Point(3, 110);
this.btnStartCheck.MinimumSize = new System.Drawing.Size(1, 1);
this.btnStartCheck.Name = "btnStartCheck";
this.btnStartCheck.Size = new System.Drawing.Size(224, 61);
this.btnStartCheck.TabIndex = 1;
this.btnStartCheck.Text = "开始检测";
this.btnStartCheck.TipsFont = new System.Drawing.Font("宋体", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
this.btnStartCheck.Click += new System.EventHandler(this.btnStartCheck_Click);
uiTableLayoutPanel1.SetColumnSpan(btnStartCheck, 2);
btnStartCheck.Cursor = Cursors.Hand;
resources.ApplyResources(btnStartCheck, "btnStartCheck");
btnStartCheck.FillPressColor = Color.FromArgb(0, 192, 0);
btnStartCheck.FillSelectedColor = Color.FromArgb(0, 192, 0);
btnStartCheck.Name = "btnStartCheck";
btnStartCheck.TipsFont = new Font("宋体", 9F, FontStyle.Regular, GraphicsUnit.Point, 134);
btnStartCheck.Click += btnStartCheck_Click;
//
// FormControlPanel
//
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 12F);
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
this.ClientSize = new System.Drawing.Size(230, 198);
this.ControlBox = false;
this.Controls.Add(this.uiTableLayoutPanel1);
this.MaximizeBox = false;
this.MinimizeBox = false;
this.Name = "FormControlPanel";
this.Text = "启动管理";
this.uiTableLayoutPanel1.ResumeLayout(false);
this.ResumeLayout(false);
resources.ApplyResources(this, "$this");
AutoScaleMode = AutoScaleMode.Font;
ControlBox = false;
Controls.Add(uiTableLayoutPanel1);
MaximizeBox = false;
MinimizeBox = false;
Name = "FormControlPanel";
uiTableLayoutPanel1.ResumeLayout(false);
ResumeLayout(false);
}

View File

@@ -25,7 +25,7 @@ namespace Check.Main.UI
public FormControlPanel()
{
InitializeComponent();
ConfigurationManager.OnConfigurationChanged += HandleConfigurationChanged;
UpdateUI();
@@ -50,6 +50,8 @@ namespace Check.Main.UI
}));
}
}
//点击“ 启动设备” 按钮
private void btnStartDevice_Click(object sender, EventArgs e)
{
if (_isDeviceReady)//_isDeviceRunning
@@ -86,7 +88,7 @@ namespace Check.Main.UI
ThreadSafeLogger.Log("用户点击“启动设备”,开始新的启动流程...");
// 1. 从单一数据源获取完整的配置对象
var config = ConfigurationManager.GetCurrentConfig();
var config = ConfigurationManager.GetCurrentConfig();
// 2. 验证相机配置的有效性
if (config.CameraSettings == null || !config.CameraSettings.Any(c => c.IsEnabled))
{
@@ -124,6 +126,7 @@ namespace Check.Main.UI
UpdateUI();//UpdateDeviceButtonUI();
}
//点击 “开始检测” 按钮
private void btnStartCheck_Click(object sender, EventArgs e)
{
if (_isDetecting)
@@ -131,7 +134,7 @@ namespace Check.Main.UI
// --- 停止检测 ---
ThreadSafeLogger.Log("用户点击“停止检测”,暂停数据流...");
// 停止硬触发模拟器
CameraManager.StopHardwareTriggerSimulator();
//CameraManager.StopHardwareTriggerSimulator();
// 停止相机采集
CameraManager.StopAll();
@@ -150,10 +153,11 @@ namespace Check.Main.UI
// 启动硬触发模拟器(如果需要)
var config = ConfigurationManager.GetCurrentConfig();
if (config.CameraSettings.Any(c => c.IsEnabled && c.TriggerMode == TriggerModeType.Software))
if (config.CameraSettings.Any(c => c.IsEnabled && c.TriggerMode == TriggerModeType.Hardware))
{
CameraManager.TriggerInterval = 100;
CameraManager.StartHardwareTriggerSimulator();
ThreadSafeLogger.Log("相机设置为硬件触发模式,将由 PLC 输出脉冲信号控制拍照。");
//CameraManager.TriggerInterval = 100;
// CameraManager.StartHardwareTriggerSimulator();
}
// 开始统计

View File

@@ -1,17 +1,17 @@
<?xml version="1.0" encoding="utf-8"?>
<root>
<!--
Microsoft ResX Schema
<!--
Microsoft ResX Schema
Version 2.0
The primary goals of this format is to allow a simple XML format
that is mostly human readable. The generation and parsing of the
various data types are done through the TypeConverter classes
The primary goals of this format is to allow a simple XML format
that is mostly human readable. The generation and parsing of the
various data types are done through the TypeConverter classes
associated with the data types.
Example:
... ado.net/XML headers & schema ...
<resheader name="resmimetype">text/microsoft-resx</resheader>
<resheader name="version">2.0</resheader>
@@ -26,36 +26,36 @@
<value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
<comment>This is a comment</comment>
</data>
There are any number of "resheader" rows that contain simple
There are any number of "resheader" rows that contain simple
name/value pairs.
Each data row contains a name, and value. The row also contains a
type or mimetype. Type corresponds to a .NET class that support
text/value conversion through the TypeConverter architecture.
Classes that don't support this are serialized and stored with the
Each data row contains a name, and value. The row also contains a
type or mimetype. Type corresponds to a .NET class that support
text/value conversion through the TypeConverter architecture.
Classes that don't support this are serialized and stored with the
mimetype set.
The mimetype is used for serialized objects, and tells the
ResXResourceReader how to depersist the object. This is currently not
The mimetype is used for serialized objects, and tells the
ResXResourceReader how to depersist the object. This is currently not
extensible. For a given mimetype the value must be set accordingly:
Note - application/x-microsoft.net.object.binary.base64 is the format
that the ResXResourceWriter will generate, however the reader can
Note - application/x-microsoft.net.object.binary.base64 is the format
that the ResXResourceWriter will generate, however the reader can
read any of the formats listed below.
mimetype: application/x-microsoft.net.object.binary.base64
value : The object must be serialized with
value : The object must be serialized with
: System.Runtime.Serialization.Formatters.Binary.BinaryFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.soap.base64
value : The object must be serialized with
value : The object must be serialized with
: System.Runtime.Serialization.Formatters.Soap.SoapFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.bytearray.base64
value : The object must be serialized into a byte array
value : The object must be serialized into a byte array
: using a System.ComponentModel.TypeConverter
: and then encoded with base64 encoding.
-->
@@ -117,4 +117,137 @@
<resheader name="writer">
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
<assembly alias="mscorlib" name="mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" />
<data name="uiTableLayoutPanel1.ColumnCount" type="System.Int32, mscorlib">
<value>2</value>
</data>
<assembly alias="System.Windows.Forms" name="System.Windows.Forms, Culture=neutral, PublicKeyToken=b77a5c561934e089" />
<data name="btnStartDevice.Dock" type="System.Windows.Forms.DockStyle, System.Windows.Forms">
<value>Fill</value>
</data>
<assembly alias="System.Drawing" name="System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" />
<data name="btnStartDevice.Font" type="System.Drawing.Font, System.Drawing">
<value>宋体, 12pt</value>
</data>
<data name="btnStartDevice.Location" type="System.Drawing.Point, System.Drawing">
<value>6, 51</value>
</data>
<assembly alias="System.Windows.Forms" name="System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" />
<data name="btnStartDevice.Margin" type="System.Windows.Forms.Padding, System.Windows.Forms">
<value>6, 6, 6, 6</value>
</data>
<data name="btnStartDevice.MinimumSize" type="System.Drawing.Size, System.Drawing">
<value>2, 2</value>
</data>
<data name="btnStartDevice.Size" type="System.Drawing.Size, System.Drawing">
<value>410, 128</value>
</data>
<data name="btnStartDevice.TabIndex" type="System.Int32, mscorlib">
<value>0</value>
</data>
<data name="btnStartDevice.Text" xml:space="preserve">
<value>启动设备</value>
</data>
<data name="&gt;&gt;btnStartDevice.Name" xml:space="preserve">
<value>btnStartDevice</value>
</data>
<data name="&gt;&gt;btnStartDevice.Type" xml:space="preserve">
<value>Sunny.UI.UIButton, SunnyUI, Culture=neutral, PublicKeyToken=27d7d2e821d97aeb</value>
</data>
<data name="&gt;&gt;btnStartDevice.Parent" xml:space="preserve">
<value>uiTableLayoutPanel1</value>
</data>
<data name="&gt;&gt;btnStartDevice.ZOrder" xml:space="preserve">
<value>0</value>
</data>
<data name="btnStartCheck.Dock" type="System.Windows.Forms.DockStyle, System.Windows.Forms">
<value>Fill</value>
</data>
<data name="btnStartCheck.Font" type="System.Drawing.Font, System.Drawing">
<value>宋体, 12pt</value>
</data>
<data name="btnStartCheck.Location" type="System.Drawing.Point, System.Drawing">
<value>6, 221</value>
</data>
<data name="btnStartCheck.Margin" type="System.Windows.Forms.Padding, System.Windows.Forms">
<value>6, 6, 6, 6</value>
</data>
<data name="btnStartCheck.MinimumSize" type="System.Drawing.Size, System.Drawing">
<value>2, 2</value>
</data>
<data name="btnStartCheck.Size" type="System.Drawing.Size, System.Drawing">
<value>410, 122</value>
</data>
<data name="btnStartCheck.TabIndex" type="System.Int32, mscorlib">
<value>1</value>
</data>
<data name="btnStartCheck.Text" xml:space="preserve">
<value>开始检测</value>
</data>
<data name="&gt;&gt;btnStartCheck.Name" xml:space="preserve">
<value>btnStartCheck</value>
</data>
<data name="&gt;&gt;btnStartCheck.Type" xml:space="preserve">
<value>Sunny.UI.UIButton, SunnyUI, Culture=neutral, PublicKeyToken=27d7d2e821d97aeb</value>
</data>
<data name="&gt;&gt;btnStartCheck.Parent" xml:space="preserve">
<value>uiTableLayoutPanel1</value>
</data>
<data name="&gt;&gt;btnStartCheck.ZOrder" xml:space="preserve">
<value>1</value>
</data>
<data name="uiTableLayoutPanel1.Dock" type="System.Windows.Forms.DockStyle, System.Windows.Forms">
<value>Fill</value>
</data>
<data name="uiTableLayoutPanel1.Location" type="System.Drawing.Point, System.Drawing">
<value>0, 0</value>
</data>
<data name="uiTableLayoutPanel1.Margin" type="System.Windows.Forms.Padding, System.Windows.Forms">
<value>6, 6, 6, 6</value>
</data>
<data name="uiTableLayoutPanel1.RowCount" type="System.Int32, mscorlib">
<value>5</value>
</data>
<data name="uiTableLayoutPanel1.Size" type="System.Drawing.Size, System.Drawing">
<value>422, 396</value>
</data>
<data name="uiTableLayoutPanel1.TabIndex" type="System.Int32, mscorlib">
<value>0</value>
</data>
<data name="&gt;&gt;uiTableLayoutPanel1.Name" xml:space="preserve">
<value>uiTableLayoutPanel1</value>
</data>
<data name="&gt;&gt;uiTableLayoutPanel1.Type" xml:space="preserve">
<value>Sunny.UI.UITableLayoutPanel, SunnyUI, Culture=neutral, PublicKeyToken=27d7d2e821d97aeb</value>
</data>
<data name="&gt;&gt;uiTableLayoutPanel1.Parent" xml:space="preserve">
<value>$this</value>
</data>
<data name="&gt;&gt;uiTableLayoutPanel1.ZOrder" xml:space="preserve">
<value>0</value>
</data>
<data name="uiTableLayoutPanel1.LayoutSettings" type="System.Windows.Forms.TableLayoutSettings, System.Windows.Forms">
<value>&lt;?xml version="1.0" encoding="utf-16"?&gt;&lt;TableLayoutSettings&gt;&lt;Controls&gt;&lt;Control Name="btnStartDevice" Row="1" RowSpan="1" Column="0" ColumnSpan="2" /&gt;&lt;Control Name="btnStartCheck" Row="3" RowSpan="1" Column="0" ColumnSpan="2" /&gt;&lt;/Controls&gt;&lt;Columns Styles="Percent,50,Percent,50" /&gt;&lt;Rows Styles="Percent,11.38585,Percent,35.35353,Percent,7.575758,Percent,33.83838,Percent,11.38585" /&gt;&lt;/TableLayoutSettings&gt;</value>
</data>
<metadata name="$this.Localizable" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>True</value>
</metadata>
<data name="$this.AutoScaleDimensions" type="System.Drawing.SizeF, System.Drawing">
<value>11, 24</value>
</data>
<data name="$this.ClientSize" type="System.Drawing.Size, System.Drawing">
<value>422, 396</value>
</data>
<data name="$this.Margin" type="System.Windows.Forms.Padding, System.Windows.Forms">
<value>6, 6, 6, 6</value>
</data>
<data name="$this.Text" xml:space="preserve">
<value>启动管理</value>
</data>
<data name="&gt;&gt;$this.Name" xml:space="preserve">
<value>FormControlPanel</value>
</data>
<data name="&gt;&gt;$this.Type" xml:space="preserve">
<value>WeifenLuo.WinFormsUI.Docking.DockContent, WeifenLuo.WinFormsUI.Docking, Culture=neutral, PublicKeyToken=5cded1a1a0a7b481</value>
</data>
</root>