1 Commits

Author SHA1 Message Date
6696c4e106 修改config 2025-03-18 14:20:11 +08:00
83 changed files with 1773 additions and 2838 deletions

View File

@ -110,7 +110,7 @@ namespace CanFly.Canvas.Shape
/// <summary>
/// 是否填充多边形使用select_fill_color 或 fill_color 填充
/// 是否填充多边形 使用select_fill_color 或 fill_color 填充
/// </summary>
public bool fill = false;

View File

@ -3,14 +3,14 @@
partial class FlyCanvas
{
/// <summary>
/// 必需的设计器变量
/// 必需的设计器变量
/// </summary>
private System.ComponentModel.IContainer components = null;
///// <summary>
///// 清理所有正在使用的资源
///// 清理所有正在使用的资源
///// </summary>
///// <param name="disposing">如果应释放托管资源,为 true否则为 false</param>
///// <param name="disposing">如果应释放托管资源,为 true否则为 false </param>
//protected override void Dispose(bool disposing)
//{
// if (disposing && (components != null))
@ -24,7 +24,7 @@
/// <summary>
/// 设计器支持所需的方法 - 不要修改
/// 使用代码编辑器修改此方法的内容
/// 使用代码编辑器修改此方法的内容
/// </summary>
private void InitializeComponent()
{

View File

@ -1704,9 +1704,9 @@ namespace CanFly.Canvas.UI
/// <summary>
/// 清理所有正在使用的资源
/// 清理所有正在使用的资源
/// </summary>
/// <param name="disposing">如果应释放托管资源,为 true否则为 false</param>
/// <param name="disposing">如果应释放托管资源,为 true否则为 false </param>
protected override void Dispose(bool disposing)
{
if (disposing && (components != null))

View File

@ -1,10 +1,10 @@
//------------------------------------------------------------------------------
// <auto-generated>
// 此代码由工具生成
// 此代码由工具生成
// 运行时版本:4.0.30319.42000
//
// 对此文件的更改可能会导致不正确的行为,并且如果
// 重新生成代码,这些更改将会丢失
// 重新生成代码,这些更改将会丢失
// </auto-generated>
//------------------------------------------------------------------------------
@ -13,12 +13,12 @@ namespace XKRS.CanFly.Properties {
/// <summary>
/// 一个强类型的资源类,用于查找本地化的字符串等
/// 一个强类型的资源类,用于查找本地化的字符串等
/// </summary>
// 此类是由 StronglyTypedResourceBuilder
// 类通过类似于 ResGen 或 Visual Studio 的工具自动生成的
// 类通过类似于 ResGen 或 Visual Studio 的工具自动生成的
// 若要添加或移除成员,请编辑 .ResX 文件,然后重新运行 ResGen
// (以 /str 作为命令选项),或重新生成 VS 项目
// (以 /str 作为命令选项),或重新生成 VS 项目
[global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "17.0.0.0")]
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
[global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()]
@ -33,7 +33,7 @@ namespace XKRS.CanFly.Properties {
}
/// <summary>
/// 返回此类使用的缓存的 ResourceManager 实例
/// 返回此类使用的缓存的 ResourceManager 实例
/// </summary>
[global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)]
internal static global::System.Resources.ResourceManager ResourceManager {
@ -48,7 +48,7 @@ namespace XKRS.CanFly.Properties {
/// <summary>
/// 重写当前线程的 CurrentUICulture 属性,对
/// 使用此强类型资源类的所有资源查找执行重写
/// 使用此强类型资源类的所有资源查找执行重写
/// </summary>
[global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)]
internal static global::System.Globalization.CultureInfo Culture {
@ -61,7 +61,7 @@ namespace XKRS.CanFly.Properties {
}
/// <summary>
/// 查找 System.Drawing.Bitmap 类型的本地化资源
/// 查找 System.Drawing.Bitmap 类型的本地化资源
/// </summary>
internal static System.Drawing.Bitmap Close {
get {

View File

@ -3,14 +3,14 @@
partial class CtrlTitleBar
{
/// <summary>
/// 必需的设计器变量
/// 必需的设计器变量
/// </summary>
private System.ComponentModel.IContainer components = null;
/// <summary>
/// 清理所有正在使用的资源
/// 清理所有正在使用的资源
/// </summary>
/// <param name="disposing">如果应释放托管资源,为 true否则为 false</param>
/// <param name="disposing">如果应释放托管资源,为 true否则为 false </param>
protected override void Dispose(bool disposing)
{
if (disposing && (components != null))
@ -24,7 +24,7 @@
/// <summary>
/// 设计器支持所需的方法 - 不要修改
/// 使用代码编辑器修改此方法的内容
/// 使用代码编辑器修改此方法的内容
/// </summary>
private void InitializeComponent()
{

View File

@ -3,14 +3,14 @@
partial class GuideCircleCtrl
{
/// <summary>
/// 必需的设计器变量
/// 必需的设计器变量
/// </summary>
private System.ComponentModel.IContainer components = null;
/// <summary>
/// 清理所有正在使用的资源
/// 清理所有正在使用的资源
/// </summary>
/// <param name="disposing">如果应释放托管资源,为 true否则为 false</param>
/// <param name="disposing">如果应释放托管资源,为 true否则为 false </param>
protected override void Dispose(bool disposing)
{
if (disposing && (components != null))
@ -24,7 +24,7 @@
/// <summary>
/// 设计器支持所需的方法 - 不要修改
/// 使用代码编辑器修改此方法的内容
/// 使用代码编辑器修改此方法的内容
/// </summary>
private void InitializeComponent()
{

View File

@ -3,14 +3,14 @@
partial class GuideHeightCtrl
{
/// <summary>
/// 必需的设计器变量
/// 必需的设计器变量
/// </summary>
private System.ComponentModel.IContainer components = null;
/// <summary>
/// 清理所有正在使用的资源
/// 清理所有正在使用的资源
/// </summary>
/// <param name="disposing">如果应释放托管资源,为 true否则为 false</param>
/// <param name="disposing">如果应释放托管资源,为 true否则为 false </param>
protected override void Dispose(bool disposing)
{
if (disposing && (components != null))
@ -24,7 +24,7 @@
/// <summary>
/// 设计器支持所需的方法 - 不要修改
/// 使用代码编辑器修改此方法的内容
/// 使用代码编辑器修改此方法的内容
/// </summary>
private void InitializeComponent()
{

View File

@ -3,14 +3,14 @@
partial class GuideLineCircleCtrl
{
/// <summary>
/// 必需的设计器变量
/// 必需的设计器变量
/// </summary>
private System.ComponentModel.IContainer components = null;
/// <summary>
/// 清理所有正在使用的资源
/// 清理所有正在使用的资源
/// </summary>
/// <param name="disposing">如果应释放托管资源,为 true否则为 false</param>
/// <param name="disposing">如果应释放托管资源,为 true否则为 false </param>
protected override void Dispose(bool disposing)
{
if (disposing && (components != null))
@ -24,7 +24,7 @@
/// <summary>
/// 设计器支持所需的方法 - 不要修改
/// 使用代码编辑器修改此方法的内容
/// 使用代码编辑器修改此方法的内容
/// </summary>
private void InitializeComponent()
{

View File

@ -3,14 +3,14 @@
partial class GuideLineCtrl
{
/// <summary>
/// 必需的设计器变量
/// 必需的设计器变量
/// </summary>
private System.ComponentModel.IContainer components = null;
/// <summary>
/// 清理所有正在使用的资源
/// 清理所有正在使用的资源
/// </summary>
/// <param name="disposing">如果应释放托管资源,为 true否则为 false</param>
/// <param name="disposing">如果应释放托管资源,为 true否则为 false </param>
protected override void Dispose(bool disposing)
{
if (disposing && (components != null))
@ -24,7 +24,7 @@
/// <summary>
/// 设计器支持所需的方法 - 不要修改
/// 使用代码编辑器修改此方法的内容
/// 使用代码编辑器修改此方法的内容
/// </summary>
private void InitializeComponent()
{

View File

@ -11,6 +11,12 @@
<Platforms>AnyCPU;x64</Platforms>
</PropertyGroup>
<ItemGroup>
<Compile Remove="Halcon\**" />
<EmbeddedResource Remove="Halcon\**" />
<None Remove="Halcon\**" />
</ItemGroup>
@ -24,10 +30,6 @@
<ProjectReference Include="..\CanFly.Canvas\CanFly.Canvas.csproj" />
</ItemGroup>
<ItemGroup>
<Folder Include="Halcon\" />
</ItemGroup>
<ItemGroup>
<PackageReference Include="OpenCvSharp4" Version="4.10.0.20241108" />
<PackageReference Include="OpenCvSharp4.Extensions" Version="4.10.0.20241108" />

View File

@ -1,300 +1,130 @@
using System;
using System.ComponentModel;
using System.ComponentModel;
using System.Drawing.Imaging;
using AntdUI;
using OpenCvSharp;
namespace DH.Devices.Devices
{
public class CameraBase : NotifyProperty
public class CameraBase
{
// 私有字段 + 带通知的属性与DetectionLabel风格一致
private bool _isEnabled = false;
private bool _isContinueMode = false;
private bool _isSavePicEnabled = false;
private string _imageSaveDirectory;
private ImageFormat _imageFormat = ImageFormat.Jpeg;
private bool _isHardwareTrigger = false;
private string _serialNumber = string.Empty;
private string _cameraName = string.Empty;
private string _cameraIP = string.Empty;
private string _computerIP = string.Empty;
private bool _isDirectHardwareTrigger = false;
private float _gain = -1;
private float _rotateImage = 0;
private float _exposure = 200;
private float _triggerDelay = 0;
private decimal _roiX = 0;
private decimal _roiY = 0;
private decimal _roiW = 0;
private decimal _roiH = 0;
private int _lineDebouncerTime = 0;
public volatile int SnapshotCount = 0;
public virtual bool isEnabled { get; set; } = false;
[Category("采图模式")]
[Description("是否连续模式 true连续模式采图false触发模式采图")]
[DisplayName("连续模式")]
[Description("是否连续模式。true连续模式采图false触发模式采图")]
public bool IsContinueMode
{
get => _isContinueMode;
set
{
if (_isContinueMode == value) return;
_isContinueMode = value;
OnPropertyChanged(nameof(IsContinueMode));
}
}
public bool IsContinueMode { get; set; } = false;
public virtual bool IsEnabled
{
get => _isEnabled;
set
{
if (_isEnabled == value) return;
_isEnabled = value;
OnPropertyChanged(nameof(IsEnabled));
}
}
public virtual bool IsSavePicEnabled
{
get => _isSavePicEnabled;
set
{
if (_isSavePicEnabled == value) return;
_isSavePicEnabled = value;
OnPropertyChanged(nameof(IsSavePicEnabled));
}
}
public virtual bool isSavePicEnabled { get; set; } = false;
[Category("图片保存")]
[DisplayName("图片保存文件夹")]
[Description("图片保存文件夹")]
public virtual string ImageSaveDirectory
{
get => _imageSaveDirectory;
set
{
if (_imageSaveDirectory == value) return;
_imageSaveDirectory = value;
OnPropertyChanged(nameof(ImageSaveDirectory));
}
}
[DisplayName("图片保存文件夹")]
public virtual string ImageSaveDirectory { get; set; }
[Category("图片保存")]
[DisplayName("图片保存格式")]
[Description("图片保存格式")]
public ImageFormat ImageFormat
{
get => _imageFormat;
set
{
if (_imageFormat == value) return;
_imageFormat = value;
OnPropertyChanged(nameof(ImageFormat));
}
}
[DisplayName("图片保存格式")]
public ImageFormat ImageFormat { get; set; } = ImageFormat.Jpeg;
[Category("采图模式")]
[Description("是否硬触发模式 true硬触发false软触发")]
[DisplayName("硬触发")]
[Description("是否硬触发模式。true硬触发false软触发")]
public bool IsHardwareTrigger
{
get => _isHardwareTrigger;
set
{
if (_isHardwareTrigger == value) return;
_isHardwareTrigger = value;
OnPropertyChanged(nameof(IsHardwareTrigger));
}
}
public bool IsHardwareTrigger { get; set; } = false;
public string SerialNumber
{
get => _serialNumber;
set
{
if (_serialNumber == value) return;
_serialNumber = value;
OnPropertyChanged(nameof(SerialNumber));
}
}
public string SerialNumber { get; set; } = string.Empty;
public string CameraName { get; set; } = string.Empty;
public string CameraName
{
get => _cameraName;
set
{
if (_cameraName == value) return;
_cameraName = value;
OnPropertyChanged(nameof(CameraName));
}
}
public string CameraIP { get; set; } = string.Empty;
public string CameraIP
{
get => _cameraIP;
set
{
if (_cameraIP == value) return;
_cameraIP = value;
OnPropertyChanged(nameof(CameraIP));
}
}
public string ComputerIP
{
get => _computerIP;
set
{
if (_computerIP == value) return;
_computerIP = value;
OnPropertyChanged(nameof(ComputerIP));
}
}
public string ComputerIP { get; set; } = string.Empty;
// public StreamFormat dvpStreamFormat = dvpStreamFormat.;
[Category("采图模式")]
[Description("是否传感器直接硬触发 true传感器硬触发不通过软件触发false通过软件触发IO 的硬触发模式")]
[DisplayName("是否传感器直接硬触发")]
[Description("是否传感器直接硬触发。true传感器硬触发不通过软件触发false通过软件触发IO 的硬触发模式")]
public bool IsDirectHardwareTrigger
{
get => _isDirectHardwareTrigger;
set
{
if (_isDirectHardwareTrigger == value) return;
_isDirectHardwareTrigger = value;
OnPropertyChanged(nameof(IsDirectHardwareTrigger));
}
}
public bool IsDirectHardwareTrigger { get; set; } = false;
/// <summary>
/// 增益
/// </summary>
[Category("相机设置")]
[DisplayName("增益")]
[Description("Gain增益,-1:不设置不同型号相机的增益请参考mvs")]
public float Gain
{
get => _gain;
set
{
if (_gain.Equals(value)) return;
_gain = value;
OnPropertyChanged(nameof(Gain));
}
}
public float Gain { get; set; } = -1;
[Category("图像旋转")]
[DisplayName("默认旋转")]
[Description("默认旋转,相机开启后默认不旋转")]
public virtual float RotateImage
{
get => _rotateImage;
set
{
if (_rotateImage.Equals(value)) return;
_rotateImage = value;
OnPropertyChanged(nameof(RotateImage));
}
}
[DisplayName("默认旋转")]
public virtual float RotateImage { get; set; } = 0;
[Category("取像配置")]
[DisplayName("曝光")]
[Description("曝光")]
public virtual float Exposure
{
get => _exposure;
set
{
if (_exposure.Equals(value)) return;
_exposure = value;
OnPropertyChanged(nameof(Exposure));
}
}
[DisplayName("曝光")]
public virtual float Exposure { get; set; } = 200;
[Category("相机设置")]
[DisplayName("硬触发后的延迟")]
[Description("TriggerDelay:硬触发后的延迟,单位us 微秒")]
public float TriggerDelay
{
get => _triggerDelay;
set
{
if (_triggerDelay.Equals(value)) return;
_triggerDelay = value;
OnPropertyChanged(nameof(TriggerDelay));
}
}
public float TriggerDelay { get; set; } = 0;
public decimal ROIX
{
get => _roiX;
set
{
if (_roiX == value) return;
_roiX = value;
OnPropertyChanged(nameof(ROIX));
}
}
public decimal ROIY
{
get => _roiY;
set
{
if (_roiY == value) return;
_roiY = value;
OnPropertyChanged(nameof(ROIY));
}
}
public decimal ROIW
{
get => _roiW;
set
{
if (_roiW == value) return;
_roiW = value;
OnPropertyChanged(nameof(ROIW));
}
}
public decimal ROIH
{
get => _roiH;
set
{
if (_roiH == value) return;
_roiH = value;
OnPropertyChanged(nameof(ROIH));
}
}
/// <summary>
/// 滤波时间
/// </summary>
[Category("相机设置")]
[DisplayName("滤波时间")]
[Description("LineDebouncerTimeI/O去抖时间 单位us")]
public int LineDebouncerTime
{
get => _lineDebouncerTime;
set
{
if (_lineDebouncerTime == value) return;
_lineDebouncerTime = value;
OnPropertyChanged(nameof(LineDebouncerTime));
}
}
public int LineDebouncerTime { get; set; } = 0;
// 其他方法保持原有逻辑
public Action<DateTime, CameraBase, Mat> OnHImageOutput { get; set; }
/// <summary>
/// 相机连接
/// </summary>
/// <returns>是否成功</returns>
public virtual bool CameraConnect() { return false; }
/// <summary>
/// 相机断开
/// </summary>
/// <returns>是否成功</returns>
public virtual bool CameraDisConnect() { return false; }
/// <summary>
/// 抓取一张图像
/// </summary>
/// <returns>图像</returns>
//internal virtual HObject GrabOneImage(string cameraName) { return null; }
/// <summary>
/// 设置曝光时间
/// </summary>
/// <param name="exposureTime">曝光时间</param>
public virtual void SetExposure(int exposureTime, string cameraName) { }
/// <summary>
/// 设置增益
/// </summary>
/// <param name="exposure">增益</param>
public virtual void SetGain(int gain, string cameraName) { }
/// <summary>
/// 设置采集模式
/// </summary>
/// <param name="mode">0=连续采集,即异步采集 1=单次采集,即同步采集</param>
internal virtual void SetAcquisitionMode(int mode) { }
/// <summary>
/// 设置采集图像的ROI
/// </summary>
internal virtual void SetAcqRegion(int offsetV, int offsetH, int imageH, int imageW, string cameraName) { }
}
}
}

View File

@ -17,7 +17,6 @@
</ItemGroup>
<ItemGroup>
<PackageReference Include="AntdUI" Version="1.8.9" />
<PackageReference Include="OpenCvSharp4" Version="4.10.0.20241108" />
<PackageReference Include="OpenCvSharp4.Extensions" Version="4.10.0.20241108" />
<PackageReference Include="OpenCvSharp4.runtime.win" Version="4.10.0.20241108" />

View File

@ -6,7 +6,10 @@ using System.Text.RegularExpressions;
using System.Text;
using System.Drawing.Design;
using AntdUI;
using System.Text.Json.Serialization;
using static DH.Commons.Enums.EnumHelper;
using System.Collections.ObjectModel;
namespace DH.Commons.Enums
@ -117,20 +120,20 @@ namespace DH.Commons.Enums
/// </summary>
public class DetectionResultDetail
{
#pragma warning disable CS8618 // 在退出构造函数时,不可为 null 的字段必须包含非 null 值。请考虑声明为可以为 null。
public string LabelBGR { get; set; }//识别到对象的标签BGR
public int LabelNo { get; set; } // 识别到对象的标签索引
#pragma warning disable CS8618 // 在退出构造函数时,不可为 null 的字段必须包含非 null 值。请考虑声明为可以为 null。
public string LabelName { get; set; }//识别到对象的标签名称
public double Score { get; set; }//识别目标结果的可能性、得分
#pragma warning disable CS8618 // 在退出构造函数时,不可为 null 的字段必须包含非 null 值。请考虑声明为可以为 null。
public string LabelDisplay { get; set; }//识别到对象的 显示信息
@ -151,10 +154,10 @@ namespace DH.Commons.Enums
public class MLResult
{
public bool IsSuccess = false;
#pragma warning disable CS8618 // 在退出构造函数时,不可为 null 的字段必须包含非 null 值。请考虑声明为可以为 null。
public string ResultMessage;
#pragma warning disable CS8618 // 在退出构造函数时,不可为 null 的字段必须包含非 null 值。请考虑声明为可以为 null。
public Bitmap ResultMap;
public List<DetectionResultDetail> ResultDetails = new List<DetectionResultDetail>();
@ -178,8 +181,8 @@ namespace DH.Commons.Enums
public bool IsGPU;
public int GPUId;
public float Score_thre;
#pragma warning disable CS8618 // 在退出构造函数时,不可为 null 的字段必须包含非 null 值。请考虑声明为可以为 null。
#pragma warning disable CS8618 // 在退出构造函数时,不可为 null 的字段必须包含非 null 值。请考虑声明为可以为 null。
public MLInit(string modelFile, bool isGPU, int gpuId, float score_thre)
@ -204,18 +207,18 @@ namespace DH.Commons.Enums
}
public class DetectStationResult
{
#pragma warning disable CS8618 // 在退出构造函数时,不可为 null 的字段必须包含非 null 值。请考虑声明为可以为 null。
public string Pid { get; set; }
#pragma warning disable CS8618 // 在退出构造函数时,不可为 null 的字段必须包含非 null 值。请考虑声明为可以为 null。
public string TempPid { get; set; }
/// <summary>
/// 检测工位名称
/// </summary>
#pragma warning disable CS8618 // 在退出构造函数时,不可为 null 的字段必须包含非 null 值。请考虑声明为可以为 null。
public string DetectName { get; set; }
@ -262,9 +265,9 @@ namespace DH.Commons.Enums
public int StationDetectElapsed { get; set; }
public static string NormalizeAndClean(string input)
{
#pragma warning disable CS8603 // 可能返回 null 引用
#pragma warning disable CS8603 // 可能返回 null 引用
if (input == null) return null;
#pragma warning restore CS8603 // 可能返回 null 引用
#pragma warning restore CS8603 // 可能返回 null 引用
// Step 1: 标准化字符编码为 Form C (规范组合)
string normalizedString = input.Normalize(NormalizationForm.FormC);
@ -289,6 +292,7 @@ namespace DH.Commons.Enums
[Category("关联相机")]
[DisplayName("相机源ID")]
[Description("关联相机的唯一标识符")]
[JsonPropertyName("camera_sourceId")]
//[TypeConverter(typeof(CollectionCountConvert))]
public string CameraSourceId
{
@ -462,193 +466,217 @@ namespace DH.Commons.Enums
return new CustomizedPoint(p1.X + p2.X, p1.Y + p2.Y);
}
}
// public class PreTreatParam
// {
// public class PreTreatParam
// {
// /// <summary>
// /// 参数名称
// /// </summary>
// ///
// [Category("预处理参数")]
// [DisplayName("参数名称")]
// [Description("参数名称")]
//#pragma warning disable CS8618 // 在退出构造函数时,不可为 null 的字段必须包含非 null 值。请考虑声明为可以为 null。
// public string Name { get; set; }
// /// <summary>
// /// 参数名称
// /// </summary>
// ///
// [Category("预处理参数")]
// [DisplayName("参数名称")]
// [Description("参数名称")]
//
// public string Name { get; set; }
// /// <summary>
// /// 参数值
// /// </summary>
// ///
// [Category("预处理参数")]
// [DisplayName("参数值")]
// [Description("参数值")]
//#pragma warning disable CS8618 // 在退出构造函数时,不可为 null 的字段必须包含非 null 值。请考虑声明为可以为 null。
// public string Value { get; set; }
// /// <summary>
// /// 参数值
// /// </summary>
// ///
// [Category("预处理参数")]
// [DisplayName("参数值")]
// [Description("参数值")]
//
// public string Value { get; set; }
// }
public class DetectionConfig
// }
public class DetectionConfig : NotifyProperty
{
#region
[JsonPropertyName("id")]
[ReadOnly(true)]
public string Id { get; set; } = Guid.NewGuid().ToString();
public string Id { get; private set; } = Guid.NewGuid().ToString();
[Category("检测配置")]
[DisplayName("检测配置名称")]
[Description("检测配置名称")]
[JsonPropertyName("name")]
public string Name { get; set; }
#endregion
#region
[Category("关联相机")]
[DisplayName("关联相机")]
[Description("关联相机描述")]
[JsonPropertyName("camera_source_id")]
public string CameraSourceId { get; set; } = "";
[Category("关联相机集合")]
[DisplayName("关联相机集合")]
[Description("关联相机描述")]
//[TypeConverter(typeof(DeviceIdSelectorConverter<CameraBase>))]
public List<RelatedCamera> CameraCollects { get; set; } = new List<RelatedCamera>();
[JsonPropertyName("camera_Collects")]
public List<RelatedCamera> CameraCollects { get; set; } = new();
#endregion
#region
[Category("启用配置")]
[DisplayName("是否启用GPU检测")]
[Description("是否启用GPU检测")]
public bool IsEnableGPU { get; set; } = false;
[JsonPropertyName("is_enable_gpu")]
public bool IsEnableGPU { get; set; }
[Category("启用配置")]
[DisplayName("是否混料模型")]
[Description("是否混料模型")]
public bool IsMixModel { get; set; } = false;
[JsonPropertyName("is_mixModel")]
public bool IsMixModel { get; set; }
[Category("启用配置")]
[DisplayName("是否启用该检测")]
[Description("是否启用该检测")]
[JsonPropertyName("is_enabled")]
public bool IsEnabled { get; set; }
[Category("启用配置")]
[DisplayName("是否加入检测工位")]
[Description("是否加入检测工位")]
public bool IsAddStation { get; set; } = true;
[DisplayName("是否启用预处理")]
[JsonPropertyName("is_PreEnabled")]
public bool IsPreEnabled { get; set; }
// public bool IsAddStation { get; set; } = true;
private bool _isAddStation;
[Category("启用配置")]
[DisplayName("是否加入检测工位")]
[JsonPropertyName("is_addstation")]
public bool IsAddStation
{
get => _isAddStation;
set
{
if (_isAddStation != value)
{
_isAddStation = value;
OnPropertyChanged(nameof(IsAddStation));
}
}
}
#endregion
#region
[Category("1.预处理(视觉算子)")]
[DisplayName("预处理-算法文件路径")]
// [Description("预处理算法文件路径配置")][Editor(typeof(FileDialogEditor), typeof(UITypeEditor))]
[JsonPropertyName("halcon_algorithemPath_pre")]
public string HalconAlgorithemPath_Pre { get; set; }
// [Category("1.预处理(视觉算子)")]
//[DisplayName("预处理-输出结果的SPEC标准")]
//[Description("预处理输出结果的SPEC标准配置")]
// public List<IndexedSpec> OutputSpec_Pre { get; set; } = new List<IndexedSpec>();
[Category("1.预处理(视觉算子)")]
[DisplayName("预处理-参数列表")]
[Description("预处理-参数列表")]
public List<PreTreatParam> PreTreatParams { get; set; } = new List<PreTreatParam>();
[JsonPropertyName("pre_treatParams")]
public List<PreTreatParam> PreTreatParams { get; set; } = new();
[Category("1.预处理(视觉算子)")]
[DisplayName("预处理-输出参数列表")]
[Description("预处理-输出参数列表")]
public List<PreTreatParam> OUTPreTreatParams { get; set; } = new List<PreTreatParam>();
[JsonPropertyName("out_preTreatParams")]
public List<PreTreatParam> OUTPreTreatParams { get; set; } = new();
#endregion
#region
[Category("2.中检测(深度学习)")]
[DisplayName("中检测-模型类型")]
[Description("模型类型ImageClassification-图片分类ObjectDetection目标检测Segmentation-图像分割")]
//[TypeConverter(typeof(EnumDescriptionConverter<MLModelType>))]
[DisplayName("模型类型")]
[JsonPropertyName("model_Type")]
public MLModelType ModelType { get; set; } = MLModelType.ObjectDetection;
//[Category("2.中检测(深度学习)")]
//[DisplayName("中检测-GPU索引")]
//[Description("GPU索引")]
//public int GPUIndex { get; set; } = 0;
[Category("2.中检测(深度学习)")]
[DisplayName("中检测-模型文件路径")]
[Description("中处理 深度学习模型文件路径,路径中不可含有中文字符,一般情况可以只配置中检测模型,当需要先用预检测过滤一次时,请先配置好与预检测相关配置")]
[DisplayName("模型文件路径")]
[JsonPropertyName("model_Path")]
public string ModelPath { get; set; }
[Category("2.中检测(深度学习)")]
[DisplayName("中检测-模型宽度")]
[Description("中处理-模型宽度")]
[DisplayName("模型宽度")]
[JsonPropertyName("model_Width")]
public int ModelWidth { get; set; } = 640;
[Category("2.中检测(深度学习)")]
[DisplayName("中检测-模型高度")]
[Description("中处理-模型高度")]
[DisplayName("模型高度")]
[JsonPropertyName("model_Height")]
public int ModelHeight { get; set; } = 640;
[Category("2.中检测(深度学习)")]
[DisplayName("中检测-模型节点名称")]
[Description("中处理-模型节点名称")]
[DisplayName("模型节点名称")]
[JsonPropertyName("model_outNodeName")]
public string ModeloutNodeName { get; set; } = "output0";
[Category("2.中检测(深度学习)")]
[DisplayName("中检测-模型置信度")]
[Description("中处理-模型置信度")]
[DisplayName("模型置信度")]
[JsonPropertyName("model_confThreshold")]
public float ModelconfThreshold { get; set; } = 0.5f;
[Category("2.中检测(深度学习)")]
[DisplayName("中检测-模型标签路径")]
[Description("中处理-模型标签路径")]
[DisplayName("模型标签路径")]
[JsonPropertyName("in_lablepath")]
public string in_lable_path { get; set; }
#endregion
#region
// public List<SizeTreatParam> PreTreatCollects { get; set; } = new();
private List<SizeTreatParam> _preTreatParams = new();
[Category("1.尺寸测量集合")]
[DisplayName("尺寸测量集合")]
[JsonPropertyName("Pre_TreatCollects")]
public List<SizeTreatParam> PreTreatCollects
{
get => _preTreatParams;
set
{
if (_preTreatParams != value)
{
_preTreatParams = value;
OnPropertyChanged(nameof(PreTreatCollects));
}
}
}
#endregion
#region
[Category("4.最终过滤(逻辑过滤)")]
[DisplayName("过滤器集合")]
[Description("最后的逻辑过滤:可根据 识别出对象的 宽度、高度、面积、得分来设置最终检测结果,同一识别目标同一判定,多项过滤器之间为“或”关系")]
public List<DetectionFilter> DetectionFilterList { get; set; } = new List<DetectionFilter>();
[JsonPropertyName("detection_filterList")]
public List<DetectionFilter> DetectionFilterList { get; set; } = new();
#endregion
#region
[JsonPropertyName("Detection_LableList")]
public List<DetectionLable> DetectionLableList { get; set; } = new();
/// <summary>
/// 标签集合
/// </summary>
public List<DetectionLable> DetectionLableList { get; set; } = new List<DetectionLable>();
//[Category("深度学习配置")]
//[DisplayName("检测配置标签")]
//[Description("检测配置标签关联")]
//public List<DetectConfigLabel> DetectConfigLabelList { get; set; } = new List<DetectConfigLabel>();
[Category("显示配置")]
[DisplayName("显示位置")]
[Description("检测信息显示位置。左上角为11向右向下为正方向")]
// [TypeConverter(typeof(ComplexObjectConvert))]
// [Editor(typeof(PropertyObjectEditor), typeof(UITypeEditor))]
public CustomizedPoint ShowLocation { get; set; } = new CustomizedPoint();
[JsonPropertyName("Show_Location")]
public CustomizedPoint ShowLocation { get; set; } = new();
#endregion
//public event PropertyChangedEventHandler PropertyChanged;
public DetectionConfig()
//protected virtual void OnPropertyChanged(string propertyName)
//{
// PropertyChanged?.Invoke(this, new PropertyChangedEventArgs(propertyName));
//}
#region
public DetectionConfig() { }
public DetectionConfig(string name, MLModelType modelType, string modelPath, bool isEnableGPU, string sCameraSourceId)
{
}
public DetectionConfig(string name, MLModelType modelType, string modelPath, bool isEnableGPU,string sCameraSourceId)
{
ModelPath = modelPath ?? string.Empty;
Name = name;
ModelType = modelType;
ModelPath = modelPath ?? string.Empty;
IsEnableGPU = isEnableGPU;
Id = Guid.NewGuid().ToString();
CameraSourceId = sCameraSourceId;
Id = Guid.NewGuid().ToString();
}
#endregion
}
//大改预处理类
@ -660,6 +688,7 @@ namespace DH.Commons.Enums
private bool _selected = false;
public bool Selected
{
get { return _selected; }
@ -670,6 +699,7 @@ namespace DH.Commons.Enums
OnPropertyChanged(nameof(Selected));
}
}
[JsonPropertyName("name")]
private string _name;
public string Name
{
@ -684,6 +714,7 @@ namespace DH.Commons.Enums
private string _value;
[JsonPropertyName("value")]
public string Value
{
get { return _value; }
@ -698,7 +729,9 @@ namespace DH.Commons.Enums
private CellLink[] cellLinks;
public CellLink[] CellLinks
{
get { return cellLinks; }
get {
return cellLinks; }
set
{
if (cellLinks == value) return;
@ -737,7 +770,7 @@ namespace DH.Commons.Enums
}
[JsonPropertyName("labelId")]
public string LabelId
{
get { return _labelId; }
@ -748,7 +781,7 @@ namespace DH.Commons.Enums
OnPropertyChanged(nameof(LabelId));
}
}
[JsonPropertyName("labelName")]
public string LabelName
{
get { return _labelName; }
@ -759,7 +792,7 @@ namespace DH.Commons.Enums
OnPropertyChanged(nameof(LabelName));
}
}
[JsonPropertyName("maxSource")]
public double MaxSource
{
get { return _maxSource; }
@ -771,6 +804,7 @@ namespace DH.Commons.Enums
}
}
[JsonPropertyName("minSource")]
public double MinSource
{
get { return _minSource; }
@ -781,7 +815,7 @@ namespace DH.Commons.Enums
OnPropertyChanged(nameof(MinSource));
}
}
[JsonPropertyName("maxArea")]
public double MaxArea
{
get { return _maxArea; }
@ -792,7 +826,7 @@ namespace DH.Commons.Enums
OnPropertyChanged(nameof(MaxArea));
}
}
[JsonPropertyName("minArea")]
public double MinArea
{
get { return _minArea; }
@ -803,7 +837,7 @@ namespace DH.Commons.Enums
OnPropertyChanged(nameof(MinArea));
}
}
[JsonPropertyName("_resultState")]
public ResultState ResultState
{
get { return _resultState; }
@ -814,11 +848,13 @@ namespace DH.Commons.Enums
OnPropertyChanged(nameof(ResultState));
}
}
private CellLink[] cellLinks;
public CellLink[] CellLinks
{
get { return cellLinks; }
get {
return cellLinks; }
set
{
if (cellLinks == value) return;
@ -827,6 +863,60 @@ namespace DH.Commons.Enums
}
}
}
public class PreTreatCollect
{
[Category("尺寸测量集合")]
[DisplayName("预处理-算法文件路径")]
[Description("预处理算法文件路径配置")]
[JsonPropertyName("halconPath_Pre")]
// [Editor(typeof(FileDialogEditor), typeof(UITypeEditor))]
public string HalconPath_Pre { get; set; }
[Category("尺寸测量集合")]
[DisplayName("输入参数列表")]
[Description("输入参数列表")]
[JsonPropertyName("preParams")]
// [TypeConverter(typeof(CollectionCountConvert))]
// [Editor(typeof(ComplexCollectionEditor<PreTreatParam>), typeof(UITypeEditor))]
public List<PreTreatParam> PreParams { get; set; } = new List<PreTreatParam>();
[Category("尺寸测量集合")]
[DisplayName("输出参数列表")]
[Description("输出参数列表")]
[JsonPropertyName("outPreParams")]
// [TypeConverter(typeof(CollectionCountConvert))]
// [Editor(typeof(ComplexCollectionEditor<PreTreatParam>), typeof(UITypeEditor))]
public List<PreTreatParam> outPreParams { get; set; } = new List<PreTreatParam>();
[Category("尺寸测量集合")]
[DisplayName("预处理-名称")]
[Description("预处理名称")]
[JsonPropertyName("preName")]
public string PreName { get; set; }
[Category("尺寸测量集合")]
[DisplayName("预处理-启用")]
[Description("预处理启用")]
[JsonPropertyName("preIsEnable")]
public bool PreIsEnable { get; set; } = false;
[Category("尺寸测量集合")]
[DisplayName("类型")]
[Description("类型")]
[JsonPropertyName("preType")]
// [TypeConverter(typeof(EnumDescriptionConverter<SizeEnum>))]
public SizeEnum PreType { get; set; }
[Category("尺寸测量集合")]
[DisplayName("阈值")]
[Description("阈值")]
[JsonPropertyName("prePix")]
public int PrePix { get; set; }
}
public class SizeTreatParam : NotifyProperty
{
@ -923,16 +1013,16 @@ namespace DH.Commons.Enums
}
}
public string PrePath
{
get { return _prePath; }
set
{
if (_prePath.Equals(value)) return;
_prePath = value;
OnPropertyChanged(nameof(PrePath));
}
}
//public string PrePath
//{
// get { return _prePath; }
// set
// {
// if (_prePath.Equals(value)) return;
// _prePath = value;
// OnPropertyChanged(nameof(PrePath));
// }
//}
private CellLink[] cellLinks;
@ -987,7 +1077,7 @@ namespace DH.Commons.Enums
[DisplayName("检测项标签")]
[Description("检测标签Id")]
//[TypeConverter(typeof(DetectionLabelConverter))]
#pragma warning disable CS8618 // 在退出构造函数时,不可为 null 的字段必须包含非 null 值。请考虑声明为可以为 null。
public string LabelId { get; set; }

View File

@ -542,15 +542,5 @@ namespace DH.Commons.Enums
//[Description("插补模式")]
//Coordinate = 11
}
public enum CameraAcquisitionMode
{
=0,
=1
}
public enum CameraTriggerMode
{
= 0,
= 1
}
}

View File

@ -674,31 +674,31 @@ namespace DH.Commons.Enums
Warning = 8,
}
public enum ResultState
{
[Description("NA")]
NA = -5,
[Description("尺寸NG")]
SizeNG = -4,
[Description("检测NG")]
DetectNG = -3,
//public enum ResultState
//{
// [Description("NA")]
// NA = -5,
// [Description("尺寸NG")]
// SizeNG = -4,
// [Description("检测NG")]
// DetectNG = -3,
//[Description("检测不足TBD")]
// ShortageTBD = -2,
[Description("检测结果TBD")]
ResultTBD = -1,
[Description("OK")]
OK = 1,
// [Description("NG")]
// NG = 2,
//统计结果
[Description("A类NG")]
A_NG = 25,
[Description("B类NG")]
B_NG = 26,
[Description("C类NG")]
C_NG = 27,
}
// //[Description("检测不足TBD")]
// // ShortageTBD = -2,
// [Description("检测结果TBD")]
// ResultTBD = -1,
// [Description("OK")]
// OK = 1,
// // [Description("NG")]
// // NG = 2,
// //统计结果
// [Description("A类NG")]
// A_NG = 25,
// [Description("B类NG")]
// B_NG = 26,
// [Description("C类NG")]
// C_NG = 27,
//}
public enum HikCameraType
{
[Description("HikCamera-Gige")]

View File

@ -571,8 +571,8 @@ namespace DH.Commons.Enums
}
//分别基于像素GetPixel和SetPixel、基于内存、基于指针这三种方法增强图片对比度
// 第一种方法:像素提取法速度慢 基于像素400-600ms
//分别基于像素GetPixel和SetPixel、基于内存、基于指针这三种方法增强图片对比度
// 第一种方法:像素提取法 速度慢 基于像素400-600ms
public static Bitmap MethodBaseOnPixel(Bitmap bitmap, int degree)
{
Color curColor;

View File

@ -108,7 +108,7 @@ namespace DH.Commons.Enums
                DataGridViewCheckboxHeaderEventArgs ex = new DataGridViewCheckboxHeaderEventArgs();
ex.CheckedState = _checked;
object sender = new object();//此处不代表选择的列头checkbox只是作为参数传递因为列头checkbox是绘制出来的无法获得它的实例
object sender = new object();//此处不代表选择的列头checkbox只是作为参数传递 因为列头checkbox是绘制出来的无法获得它的实例
                if (OnCheckBoxClicked != null)
{

View File

@ -78,94 +78,92 @@ namespace DH.Devices.Camera
//GC.KeepAlive(pCallBackFunc);
//// ch:设置采集连续模式 | en:Set Continues Aquisition Mode
if (IsContinueMode)
//if (IIConfig.IsContinueMode)
//{
// // ch:设置触发模式为off || en:set trigger mode as off
// nRet = DVPCamera.dvpSetTriggerState(m_handle, false);
// if (dvpStatus.DVP_STATUS_OK != nRet)
// {
// throw new Exception("Set TriggerMode failed!");
// }
//}
//else
//{
// ch:设置触发模式为on || en:set trigger mode as on
nRet = DVPCamera.dvpSetTriggerState(m_handle, true);
if (dvpStatus.DVP_STATUS_OK != nRet)
{
// ch:设置触发模式为off || en:set trigger mode as off
nRet = DVPCamera.dvpSetTriggerState(m_handle, false);
if (dvpStatus.DVP_STATUS_OK != nRet)
{
throw new Exception("Set TriggerMode failed!");
}
throw new Exception("Set TriggerMode failed!");
}
else
// 硬触发
//if (IIConfig.IsHardwareTrigger)
//{
// ch:触发源选择:1 - Line1; | en:Trigger source select:1 - Line1;
nRet = DVPCamera.dvpSetTriggerSource(m_handle, dvpTriggerSource.TRIGGER_SOURCE_LINE1);
if (dvpStatus.DVP_STATUS_OK != nRet)
{
// ch:设置触发模式为on || en:set trigger mode as on
nRet = DVPCamera.dvpSetTriggerState(m_handle, true);
if (dvpStatus.DVP_STATUS_OK != nRet)
{
throw new Exception("Set TriggerMode failed!");
}
// 硬触发
if (IsHardwareTrigger)
{
// ch:触发源选择:1 - Line1; | en:Trigger source select:1 - Line1;
nRet = DVPCamera.dvpSetTriggerSource(m_handle, dvpTriggerSource.TRIGGER_SOURCE_LINE1);
if (dvpStatus.DVP_STATUS_OK != nRet)
{
throw new Exception("Set Line1 Trigger failed!");
}
// ch:注册回调函数 | en:Register image callback
ImageCallback = new DVPCamera.dvpStreamCallback(ImageCallbackFunc);
nRet = DVPCamera.dvpRegisterStreamCallback(m_handle, ImageCallback, dvpStreamEvent.STREAM_EVENT_PROCESSED, IntPtr.Zero);
if (dvpStatus.DVP_STATUS_OK != nRet)
{
throw new Exception("Register image callback failed!");
}
}
else // 软触发
{
nRet = DVPCamera.dvpSetTriggerSource(m_handle, dvpTriggerSource.TRIGGER_SOURCE_SOFTWARE);
if (dvpStatus.DVP_STATUS_OK != nRet)
{
throw new Exception("Set Software Trigger failed!");
}
}
// ch:开启抓图 || en: start grab image
nRet = DVPCamera.dvpStart(m_handle);
if (dvpStatus.DVP_STATUS_OK != nRet)
{
throw new Exception($"Start grabbing failed:{nRet:x8}");
}
//// 曝光
//if (IIConfig.DefaultExposure != 0)
//{
// SetExposure(IIConfig.DefaultExposure);
//}
//// 增益
//if (IIConfig.Gain >= 0)
//{
// SetGain(IIConfig.Gain);
//}
//SetPictureRoi(IIConfig.VelocityPara.A_Pic_X, IIConfig.VelocityPara.A_Pic_Y, IIConfig.VelocityPara.Width, IIConfig.VelocityPara.Hight);
//// 设置 触发延迟
//if (IIConfig.TriggerDelay > 0)
//{
// nRet = DVPCamera.dvpSetTriggerDelay(m_handle, IIConfig.TriggerDelay);
// if (nRet != dvpStatus.DVP_STATUS_OK)
// {
// throw new Exception("Set TriggerDelay failed!");
// }
//}
//// 信号消抖
//if (IIConfig.LineDebouncerTime > 0)
//{
// nRet = DVPCamera.dvpSetTriggerJitterFilter(m_handle, IIConfig.LineDebouncerTime);
// if (nRet != dvpStatus.DVP_STATUS_OK)
// {
// throw new Exception($"LineDebouncerTime set failed:{nRet}");
// }
//}
//IIConfig.PropertyChanged -= IIConfig_PropertyChanged;
//IIConfig.PropertyChanged += IIConfig_PropertyChanged;
throw new Exception("Set Line1 Trigger failed!");
}
// ch:注册回调函数 | en:Register image callback
ImageCallback = new DVPCamera.dvpStreamCallback(ImageCallbackFunc);
nRet = DVPCamera.dvpRegisterStreamCallback(m_handle, ImageCallback, dvpStreamEvent.STREAM_EVENT_PROCESSED, IntPtr.Zero);
if (dvpStatus.DVP_STATUS_OK != nRet)
{
throw new Exception("Register image callback failed!");
}
//}
//else // 软触发
//{
// nRet = DVPCamera.dvpSetTriggerSource(m_handle, dvpTriggerSource.TRIGGER_SOURCE_SOFTWARE);
// if (dvpStatus.DVP_STATUS_OK != nRet)
// {
// throw new Exception("Set Software Trigger failed!");
// }
//}
// ch:开启抓图 || en: start grab image
nRet = DVPCamera.dvpStart(m_handle);
if (dvpStatus.DVP_STATUS_OK != nRet)
{
throw new Exception($"Start grabbing failed:{nRet:x8}");
}
//// 曝光
//if (IIConfig.DefaultExposure != 0)
//{
// SetExposure(IIConfig.DefaultExposure);
//}
//// 增益
//if (IIConfig.Gain >= 0)
//{
// SetGain(IIConfig.Gain);
//}
//SetPictureRoi(IIConfig.VelocityPara.A_Pic_X, IIConfig.VelocityPara.A_Pic_Y, IIConfig.VelocityPara.Width, IIConfig.VelocityPara.Hight);
//// 设置 触发延迟
//if (IIConfig.TriggerDelay > 0)
//{
// nRet = DVPCamera.dvpSetTriggerDelay(m_handle, IIConfig.TriggerDelay);
// if (nRet != dvpStatus.DVP_STATUS_OK)
// {
// throw new Exception("Set TriggerDelay failed!");
// }
//}
//// 信号消抖
//if (IIConfig.LineDebouncerTime > 0)
//{
// nRet = DVPCamera.dvpSetTriggerJitterFilter(m_handle, IIConfig.LineDebouncerTime);
// if (nRet != dvpStatus.DVP_STATUS_OK)
// {
// throw new Exception($"LineDebouncerTime set failed:{nRet}");
// }
//}
//IIConfig.PropertyChanged -= IIConfig_PropertyChanged;
//IIConfig.PropertyChanged += IIConfig_PropertyChanged;
return true;
}
catch

View File

@ -409,7 +409,7 @@ namespace MCDLL_NET
/********************************************************************************************************************************************************************
<20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>·<EFBFBD>ʱ<EFBFBD><CAB1><EFBFBD><EFBFBD>ǰ<EFBFBD><C7B0><EFBFBD><EFBFBD><EFBFBD>Ѿ<EFBFBD><D1BE><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>λ<EFBFBD>õ<EFBFBD><C3B5><EFBFBD><EFBFBD>ϣ<EFBFBD><CFA3><EFBFBD>ж<EFBFBD>Ϊ<EFBFBD><CEAA><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD>д<EFBFBD><D0B4><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>¼<EFBFBD><C2BC><EFBFBD>ݡ<EFBFBD>
<20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>·<EFBFBD>ʱ<EFBFBD><CAB1><EFBFBD><EFBFBD>ǰ<EFBFBD><C7B0><EFBFBD><EFBFBD><EFBFBD>Ѿ<EFBFBD><D1BE><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>λ<EFBFBD>õ<EFBFBD><C3B5><EFBFBD><EFBFBD>ϣ<EFBFBD><CFA3><EFBFBD>ж<EFBFBD>Ϊ<EFBFBD><CEAA><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD>д<EFBFBD><D0B4><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>¼<EFBFBD><C2BC><EFBFBD><EFBFBD>
********************************************************************************************************************************************************************/
@ -1005,8 +1005,8 @@ namespace MCDLL_NET
/// </summary>
/// <param name="Axis"><3E><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD></param>
/// <param name="Stop_Time"><3E><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ͣʱ<CDA3><20><>Χ 0 -1000ms<6D><73><EFBFBD><EFBFBD>Ĭ<EFBFBD>ϣ<EFBFBD><CFA3><EFBFBD>ͣ<EFBFBD><CDA3>
/// ע<><EFBFBD><E2A3BA><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ײԭ<D7B2>㻺ͣʱ<CDA3><EFBFBD><E4A3AC>Ҫ<EFBFBD><D2AA><EFBFBD>ϻ<EFBFBD><CFBB><EFBFBD><EFBFBD><EFBFBD><EFBFBD>õĸ<C3B5><C4B8>ٶ<EFBFBD><D9B6>ٶȣ<D9B6><C8A3>͵<EFBFBD><CDB5>ٶ<EFBFBD><D9B6>ٶȵĴ<C8B5><C4B4>
/// <20><><EFBFBD>ô<EFBFBD><C3B4>˻<EFBFBD><CBBB><EFBFBD><EFBFBD>ֹ<EFBFBD><D6B9><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>С<EFBFBD><D0A1>ֹͣ<CDA3><D6B9>ʱ<EFBFBD><CAB1><EFBFBD><EFBFBD><EFBFBD>ж<EFBFBD><D0B6><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ҫ<EFBFBD><D2AA><EFBFBD><EFBFBD>ʱ<EFBFBD><EFBFBD><E4A3AC><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ҵ<EFBFBD>ԭ<EFBFBD><D4AD>ʱ<EFBFBD><CAB1><EFBFBD>ڿ<EFBFBD><DABF><EFBFBD><EFBFBD>м</param>
/// ע<><EFBFBD><E2A3BA><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ײԭ<D7B2>㻺ͣʱ<CDA3><EFBFBD><E4A3AC>Ҫ<EFBFBD><D2AA><EFBFBD>ϻ<EFBFBD><CFBB><EFBFBD><EFBFBD><EFBFBD><EFBFBD>õĸ<C3B5><C4B8>ٶ<EFBFBD><D9B6>ٶȣ<D9B6><C8A3>͵<EFBFBD><CDB5>ٶ<EFBFBD><D9B6>ٶȵĴ<C8B5><C4B4><EFBFBD>
/// <20><><EFBFBD>ô<EFBFBD><C3B4>˻<EFBFBD><CBBB><EFBFBD><EFBFBD>ֹ<EFBFBD><D6B9><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>С<EFBFBD><D0A1>ֹͣ<CDA3><D6B9>ʱ<EFBFBD><CAB1><EFBFBD><EFBFBD><EFBFBD>ж<EFBFBD><D0B6><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ҫ<EFBFBD><D2AA><EFBFBD><EFBFBD>ʱ<EFBFBD><EFBFBD><E4A3AC><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ҵ<EFBFBD>ԭ<EFBFBD><D4AD>ʱ<EFBFBD><CAB1><EFBFBD>ڿ<EFBFBD><DABF><EFBFBD><EFBFBD>м<EFBFBD> </param>
/// <param name="StationNumber">վ<><D5BE><EFBFBD><EFBFBD><EFBFBD>ã<EFBFBD>Ĭ<EFBFBD>ϲ<EFBFBD><CFB2><EFBFBD>Ϊ 0</param>
/// <returns></returns>
[DllImport("MCDLL_NET.DLL", EntryPoint = "MCF_Search_Home_Stop_Time_Net")]

View File

@ -444,17 +444,17 @@ namespace DH.Devices.Motion
//[Category("回原点设置")]
//[DisplayName("回原点模式")]
//[Description("HomeMode回原点模式0一般模式 1极限限位模式 2外部触发模式")]
//[Description("HomeMode回原点模式 0一般模式 1极限限位模式 2外部触发模式")]
//public int HomeMode { get; set; } = 0;
//[Category("回原点设置")]
//[DisplayName("回原点方向")]
//[Description("IsHomePositive回原点方向 true正方向开始 false负方向开始")]
//[Description("IsHomePositive回原点方向 true正方向开始 false负方向开始")]
//public bool IsHomePositive { get; set; } = true;
//[Category("回原点设置")]
//[DisplayName("是否自动回原点")]
//[Description("IsAutoGoHome是否自动回原点 true是 false否")]
//[Description("IsAutoGoHome是否自动回原点 true是 false否")]
//public bool IsAutoGoHome { get; set; } = false;
//[Category("超时设置")]
@ -601,7 +601,7 @@ namespace DH.Devices.Motion
[Category("回原点参数")]
[DisplayName("碰撞原点缓停时间")]
[Description("SearchHomeStopTime触发缓停时间范围 0-1000ms默认急停注意:设置碰撞原点缓停时间,需要配合回零设置的高速段速度,和低速度速度的搭配设置大了会出现过冲的现象,设置小了停止的时候会有抖动,需要调节时间,尽量设置找到原点时候在开关中间")]
[Description("SearchHomeStopTime触发缓停时间范围 0-1000ms默认急停 注意:设置碰撞原点缓停时间,需要配合回零设置的高速段速度,和低速度速度的搭配 设置大了会出现过冲的现象,设置小了停止的时候会有抖动,需要调节时间,尽量设置找到原点时候在开关中间 ")]
public ushort SearchHomeStopTime { get; set; } = 0;

View File

@ -314,9 +314,9 @@ namespace DH.Devices.Motion
// //设置物件检测有效电平 0是低电平 1是高电平
// rtn = CMCDLL_NET_Sorting.MCF_Sorting_Set_Input_Logic_Net((ushort)SortingInputSetting.BitInputNumber, 0);
// //设置来料检测编码器 双转盘要设置两个轴
// /*Bit_Input_Number设置位号
// 取值: Bit_Input_0, Bit_Input_1
// Axis: 轴号
// /*Bit_Input_Number设置位号
// 取值: Bit_Input_0, Bit_Input_1
// Axis: 轴号
// Source跟随方式
// 取值0命令
// 1编码器(默认)
@ -1655,7 +1655,7 @@ namespace DH.Devices.Motion
#region IMonitor
/// <summary>
/// 位置捕获监听,入料检测
/// 位置捕获监听,入料检测
/// 入料检测对射开关接到了HOME口每当有新料到达入料检测传感器时程序把当前位置当作原点并调用<see cref="SolidMotionCardBase.CapturePositionChanged(int, int)"/>函数
/// </summary>
private void MonitorPieces()
@ -1796,7 +1796,7 @@ namespace DH.Devices.Motion
// Picese_sizeStr += i.ToString()+":"+Piece_Size[i]+"\t";
// Picese_DistanceizeStr += i.ToString()+":"+ Piece_Distance_To_next[i]+"\t";
//}
// LogAsync(DateTime.Now, LogLevel.Information, $"转盘{station}产品入列 , {piecesCountDic[station]} size:{Piece_Size[Piece_Size.Length - 1]}");
// LogAsync(DateTime.Now, LogLevel.Information, $"转盘{station}产品入列 , {piecesCountDic[station]} size:{Piece_Size[Piece_Size.Length - 1]} ");
// LogAsync(DateTime.Now, LogLevel.Information, $"转盘{station}产品入列 ,监听piece_find{tmpPieceNumber} 监听物件大小" + Picese_sizeStr+",物件间距"+ Picese_DistanceizeStr+"相机经过个数"+Piece_Cross_Camera);
if (tmpPieceNumber != piecesCountDic[station] + 1)
{

View File

@ -11,7 +11,6 @@ namespace DH.Devices.PLC
/// </summary>
public bool connected = false;
public string PLCName;
/// <summary>
/// 类型
/// </summary>

View File

@ -104,9 +104,9 @@ namespace DH.Devices.Vision
// json = "{\"FastDetResult\":[{\"cls_id\":0,\"cls\":\"liewen\",\"fScore\":0.654843,\"rect\":[175,99,110,594]},{\"cls_id\":0,\"cls\":\"liewen\",\"fScore\":0.654589,\"rect\":[2608,19,104,661]},{\"cls_id\":0,\"cls\":\"liewen\",\"fScore\":0.654285,\"rect\":[1275,19,104,662]},{\"cls_id\":0,\"cls\":\"liewen\",\"fScore\":0.620762,\"rect\":[1510,95,107,600]},{\"cls_id\":0,\"cls\":\"liewen\",\"fScore\":0.617812,\"rect\":[2844,93,106,602]}]}";
//
Console.WriteLine("检测结果JSON" + json);
#pragma warning disable CS8600 // 将 null 字面量或可能为 null 的值转换为非 null 类型
#pragma warning disable CS8600 // 将 null 字面量或可能为 null 的值转换为非 null 类型
HYoloResult detResult = JsonConvert.DeserializeObject<HYoloResult>(json);
#pragma warning restore CS8600 // 将 null 字面量或可能为 null 的值转换为非 null 类型
#pragma warning restore CS8600 // 将 null 字面量或可能为 null 的值转换为非 null 类型
if (detResult == null)
{
return;
@ -234,15 +234,15 @@ namespace DH.Devices.Vision
{
originMat?.Dispose();
#pragma warning disable CS8600 // 将 null 字面量或可能为 null 的值转换为非 null 类型
#pragma warning disable CS8600 // 将 null 字面量或可能为 null 的值转换为非 null 类型
originMat = null;
#pragma warning restore CS8600 // 将 null 字面量或可能为 null 的值转换为非 null 类型
#pragma warning restore CS8600 // 将 null 字面量或可能为 null 的值转换为非 null 类型
//maskMat?.Dispose();
// maskMat = null;
detectMat?.Dispose();
#pragma warning disable CS8600 // 将 null 字面量或可能为 null 的值转换为非 null 类型
#pragma warning disable CS8600 // 将 null 字面量或可能为 null 的值转换为非 null 类型
detectMat = null;
#pragma warning restore CS8600 // 将 null 字面量或可能为 null 的值转换为非 null 类型
#pragma warning restore CS8600 // 将 null 字面量或可能为 null 的值转换为非 null 类型
// maskWeighted?.Dispose();
// maskWeighted = null;
// GC.Collect();

View File

@ -127,9 +127,9 @@ namespace DH.Devices.Vision
// json = "{\"FastDetResult\":[{\"cls_id\":0,\"cls\":\"liewen\",\"fScore\":0.654843,\"rect\":[175,99,110,594]},{\"cls_id\":0,\"cls\":\"liewen\",\"fScore\":0.654589,\"rect\":[2608,19,104,661]},{\"cls_id\":0,\"cls\":\"liewen\",\"fScore\":0.654285,\"rect\":[1275,19,104,662]},{\"cls_id\":0,\"cls\":\"liewen\",\"fScore\":0.620762,\"rect\":[1510,95,107,600]},{\"cls_id\":0,\"cls\":\"liewen\",\"fScore\":0.617812,\"rect\":[2844,93,106,602]}]}";
//
Console.WriteLine("检测结果JSON" + json);
#pragma warning disable CS8600 // 将 null 字面量或可能为 null 的值转换为非 null 类型
#pragma warning disable CS8600 // 将 null 字面量或可能为 null 的值转换为非 null 类型
SegResult detResult = JsonConvert.DeserializeObject<SegResult>(json);
#pragma warning restore CS8600 // 将 null 字面量或可能为 null 的值转换为非 null 类型
#pragma warning restore CS8600 // 将 null 字面量或可能为 null 的值转换为非 null 类型
if (detResult == null)
{
return;
@ -259,9 +259,9 @@ namespace DH.Devices.Vision
{
originMat?.Dispose();
#pragma warning disable CS8600 // 将 null 字面量或可能为 null 的值转换为非 null 类型
#pragma warning disable CS8600 // 将 null 字面量或可能为 null 的值转换为非 null 类型
originMat = null;
#pragma warning restore CS8600 // 将 null 字面量或可能为 null 的值转换为非 null 类型
#pragma warning restore CS8600 // 将 null 字面量或可能为 null 的值转换为非 null 类型
// GC.Collect();

View File

@ -136,9 +136,9 @@ namespace DH.Devices.Vision
// json = "{\"FastDetResult\":[{\"cls_id\":0,\"cls\":\"liewen\",\"fScore\":0.654843,\"rect\":[175,99,110,594]},{\"cls_id\":0,\"cls\":\"liewen\",\"fScore\":0.654589,\"rect\":[2608,19,104,661]},{\"cls_id\":0,\"cls\":\"liewen\",\"fScore\":0.654285,\"rect\":[1275,19,104,662]},{\"cls_id\":0,\"cls\":\"liewen\",\"fScore\":0.620762,\"rect\":[1510,95,107,600]},{\"cls_id\":0,\"cls\":\"liewen\",\"fScore\":0.617812,\"rect\":[2844,93,106,602]}]}";
//
Console.WriteLine("检测结果JSON" + json);
#pragma warning disable CS8600 // 将 null 字面量或可能为 null 的值转换为非 null 类型
#pragma warning disable CS8600 // 将 null 字面量或可能为 null 的值转换为非 null 类型
SegResult detResult = JsonConvert.DeserializeObject<SegResult>(json);
#pragma warning restore CS8600 // 将 null 字面量或可能为 null 的值转换为非 null 类型
#pragma warning restore CS8600 // 将 null 字面量或可能为 null 的值转换为非 null 类型
if (detResult == null)
{
return;
@ -267,17 +267,17 @@ namespace DH.Devices.Vision
if (detectMat != null)
{
detectMat.Dispose();
#pragma warning disable CS8600 // 将 null 字面量或可能为 null 的值转换为非 null 类型
#pragma warning disable CS8600 // 将 null 字面量或可能为 null 的值转换为非 null 类型
detectMat = null;
#pragma warning restore CS8600 // 将 null 字面量或可能为 null 的值转换为非 null 类型
#pragma warning restore CS8600 // 将 null 字面量或可能为 null 的值转换为非 null 类型
}
if (originMat != null)
{
originMat.Dispose();
#pragma warning disable CS8600 // 将 null 字面量或可能为 null 的值转换为非 null 类型
#pragma warning disable CS8600 // 将 null 字面量或可能为 null 的值转换为非 null 类型
originMat = null;
#pragma warning restore CS8600 // 将 null 字面量或可能为 null 的值转换为非 null 类型
#pragma warning restore CS8600 // 将 null 字面量或可能为 null 的值转换为非 null 类型
}

View File

@ -59,7 +59,7 @@ namespace DH.Devices.Vision
// "rect": [421, 823, 6, 8]
// }]
//}
#pragma warning disable CS8618 // 在退出构造函数时,不可为 null 的字段必须包含非 null 值。请考虑声明为可以为 null。
public List<Result> HYolo;
public class Result
@ -67,12 +67,12 @@ namespace DH.Devices.Vision
public double fScore;
public int classId;
#pragma warning disable CS8618 // 在退出构造函数时,不可为 null 的字段必须包含非 null 值。请考虑声明为可以为 null。
public string classname;
//public double area;
#pragma warning disable CS8618 // 在退出构造函数时,不可为 null 的字段必须包含非 null 值。请考虑声明为可以为 null。
public List<int> rect;
@ -82,7 +82,7 @@ namespace DH.Devices.Vision
}
public class SegResult
{
#pragma warning disable CS8618 // 在退出构造函数时,不可为 null 的字段必须包含非 null 值。请考虑声明为可以为 null。
public List<Result> SegmentResult;
public class Result
@ -90,12 +90,12 @@ namespace DH.Devices.Vision
public double fScore;
public int classId;
#pragma warning disable CS8618 // 在退出构造函数时,不可为 null 的字段必须包含非 null 值。请考虑声明为可以为 null。
public string classname;
public double area;
#pragma warning disable CS8618 // 在退出构造函数时,不可为 null 的字段必须包含非 null 值。请考虑声明为可以为 null。
public List<int> rect;

View File

@ -22,18 +22,18 @@ namespace DH.Devices.Vision
/// <summary>
/// 检测配置ID
/// </summary>
#pragma warning disable CS8618 // 在退出构造函数时,不可为 null 的字段必须包含非 null 值。请考虑声明为可以为 null。
public string DetectionId { get; set; }
#pragma warning disable CS8618 // 在退出构造函数时,不可为 null 的字段必须包含非 null 值。请考虑声明为可以为 null。
public string DetectionName { get; set; }
/// <summary>
/// 深度学习模型
/// </summary>
#pragma warning disable CS8618 // 在退出构造函数时,不可为 null 的字段必须包含非 null 值。请考虑声明为可以为 null。
public SimboVisionMLBase StationMLEngine { get; set; }

View File

@ -0,0 +1,19 @@
<Project Sdk="Microsoft.NET.Sdk.WindowsDesktop">
<PropertyGroup>
<TargetFramework>net8.0-windows</TargetFramework>
<ImplicitUsings>enable</ImplicitUsings>
<Nullable>enable</Nullable>
<BaseOutputPath>..\</BaseOutputPath>
<AppendTargetFrameworkToOutputPath>output</AppendTargetFrameworkToOutputPath>
<UseWindowsForms>true</UseWindowsForms>
<Platforms>AnyCPU;x64</Platforms>
</PropertyGroup>
<ItemGroup>
<ProjectReference Include="..\DH.Commons.Devies\DH.Commons.Devies.csproj" />
</ItemGroup>
</Project>

View File

@ -0,0 +1,49 @@
using DH.Commons.Enums;
using DH.Devices.Devices;
using System.ComponentModel;
using System.Drawing.Design;
using System.Text.Json.Serialization;
namespace DH.Process
{
public class ProcessConfigBase
{
[JsonPropertyName("station_code")]
public string StationCode { get; set; }
#region
[Category("设备配置")]
[Description("相机配置")]
[DisplayName("相机配置")]
[JsonPropertyName("camera_config_collection")]
//[TypeConverter(typeof(CollectionCountConvert))]
//[Editor(typeof(InitialConfigCollectionEditor<CameraInitialConfigBase>), typeof(UITypeEditor))]
public List<CameraBase> CameraConfigCollection { get; set; } = new List<CameraBase>();
[Category("设备配置")]
[Description("模型配置")]
[DisplayName("模型配置")]
[JsonPropertyName("detection_config_collection")]
//[TypeConverter(typeof(CollectionCountConvert))]
//[Editor(typeof(InitialConfigCollectionEditor<CameraInitialConfigBase>), typeof(UITypeEditor))]
public List<DetectionConfig> DetectionConfigCollection { get; set; } = new List<DetectionConfig>();
// [Category("设备配置")]
// [Description("PLC配置")]
// [DisplayName("PLC配置")]
// [TypeConverter(typeof(CollectionCountConvert))]
// [Editor(typeof(InitialConfigCollectionEditor<PLCInitialConfigBase>), typeof(UITypeEditor))]
// public List<IInitialConfig> PLCConfigCollection { get; set; } = new List<IInitialConfig>();
// [Category("设备配置")]
// [Description("其他设备配置")]
// [DisplayName("其他设备配置")]
// [TypeConverter(typeof(CollectionCountConvert))]
// [Editor(typeof(InitialConfigCollectionEditor<InitialConfigBase>), typeof(UITypeEditor))]
// public List<IInitialConfig> DeviceConfigs { get; set; } = new List<IInitialConfig>();
#endregion
}
}

View File

@ -3,14 +3,14 @@
partial class Canvas
{
/// <summary>
/// 必需的设计器变量
/// 必需的设计器变量
/// </summary>
private System.ComponentModel.IContainer components = null;
/// <summary>
/// 清理所有正在使用的资源
/// 清理所有正在使用的资源
/// </summary>
/// <param name="disposing">如果应释放托管资源,为 true否则为 false</param>
/// <param name="disposing">如果应释放托管资源,为 true否则为 false </param>
protected override void Dispose(bool disposing)
{
if (disposing && (components != null))
@ -24,7 +24,7 @@
/// <summary>
/// 设计器支持所需的方法 - 不要修改
/// 使用代码编辑器修改此方法的内容
/// 使用代码编辑器修改此方法的内容
/// </summary>
private void InitializeComponent()
{

View File

@ -3,7 +3,7 @@
partial class CanvasImage
{
/// <summary>
/// 必需的设计器变量
/// 必需的设计器变量
/// </summary>
private System.ComponentModel.IContainer components = null;
@ -11,7 +11,7 @@
/// <summary>
/// 设计器支持所需的方法 - 不要修改
/// 使用代码编辑器修改此方法的内容
/// 使用代码编辑器修改此方法的内容
/// </summary>
private void InitializeComponent()
{

View File

@ -923,9 +923,9 @@ namespace DH.UI.Model.Winform
#region Dispose
/// <summary>
/// 清理所有正在使用的资源
/// 清理所有正在使用的资源
/// </summary>
/// <param name="disposing">如果应释放托管资源,为 true否则为 false</param>
/// <param name="disposing">如果应释放托管资源,为 true否则为 false </param>
protected override void Dispose(bool disposing)
{
MAP?.Dispose();

View File

@ -3,14 +3,14 @@
partial class GridCtrl
{
/// <summary>
/// 必需的设计器变量
/// 必需的设计器变量
/// </summary>
private System.ComponentModel.IContainer components = null;
/// <summary>
/// 清理所有正在使用的资源
/// 清理所有正在使用的资源
/// </summary>
/// <param name="disposing">如果应释放托管资源,为 true否则为 false</param>
/// <param name="disposing">如果应释放托管资源,为 true否则为 false </param>
protected override void Dispose(bool disposing)
{
if (disposing && (components != null))
@ -24,7 +24,7 @@
/// <summary>
/// 设计器支持所需的方法 - 不要修改
/// 使用代码编辑器修改此方法的内容
/// 使用代码编辑器修改此方法的内容
/// </summary>
private void InitializeComponent()
{

View File

@ -3,14 +3,14 @@
partial class IOIndicatorCtrl
{
/// <summary>
/// 必需的设计器变量
/// 必需的设计器变量
/// </summary>
private System.ComponentModel.IContainer components = null;
/// <summary>
/// 清理所有正在使用的资源
/// 清理所有正在使用的资源
/// </summary>
/// <param name="disposing">如果应释放托管资源,为 true否则为 false</param>
/// <param name="disposing">如果应释放托管资源,为 true否则为 false </param>
protected override void Dispose(bool disposing)
{
if (disposing && (components != null))
@ -24,7 +24,7 @@
/// <summary>
/// 设计器支持所需的方法 - 不要修改
/// 使用代码编辑器修改此方法的内容
/// 使用代码编辑器修改此方法的内容
/// </summary>
private void InitializeComponent()
{

View File

@ -864,30 +864,30 @@ namespace DH.UI.Model.Winform
{
if (disposing)
{
// 释放托管状态(托管对象)
// 释放托管状态(托管对象)
Pen?.Dispose();
}
// TODO: 释放未托管的资源(未托管的对象)并在以下内容中替代终结器
// TODO: 将大型字段设置为 null
// TODO: 释放未托管的资源(未托管的对象)并在以下内容中替代终结器
// TODO: 将大型字段设置为 null
disposedValue = true;
}
}
// TODO: 仅当以上 Dispose(bool disposing) 拥有用于释放未托管资源的代码时才替代终结器
// TODO: 仅当以上 Dispose(bool disposing) 拥有用于释放未托管资源的代码时才替代终结器
// ~ElementBase()
// {
// // 请勿更改此代码将清理代码放入以上 Dispose(bool disposing) 中
// // 请勿更改此代码 将清理代码放入以上 Dispose(bool disposing) 中
// Dispose(false);
// }
// 添加此代码以正确实现可处置模式
// 添加此代码以正确实现可处置模式
public void Dispose()
{
// 请勿更改此代码将清理代码放入以上 Dispose(bool disposing) 中
// 请勿更改此代码 将清理代码放入以上 Dispose(bool disposing) 中
Dispose(true);
// TODO: 如果在以上内容中替代了终结器,则取消注释以下行
// TODO: 如果在以上内容中替代了终结器,则取消注释以下行
// GC.SuppressFinalize(this);
}
#endregion

View File

@ -3,14 +3,14 @@
partial class GridCtrl
{
/// <summary>
/// 必需的设计器变量
/// 必需的设计器变量
/// </summary>
private System.ComponentModel.IContainer components = null;
/// <summary>
/// 清理所有正在使用的资源
/// 清理所有正在使用的资源
/// </summary>
/// <param name="disposing">如果应释放托管资源,为 true否则为 false</param>
/// <param name="disposing">如果应释放托管资源,为 true否则为 false </param>
protected override void Dispose(bool disposing)
{
if (disposing && (components != null))
@ -24,7 +24,7 @@
/// <summary>
/// 设计器支持所需的方法 - 不要修改
/// 使用代码编辑器修改此方法的内容
/// 使用代码编辑器修改此方法的内容
/// </summary>
private void InitializeComponent()
{

View File

@ -3,14 +3,14 @@
partial class IOIndicatorCtrl
{
/// <summary>
/// 必需的设计器变量
/// 必需的设计器变量
/// </summary>
private System.ComponentModel.IContainer components = null;
/// <summary>
/// 清理所有正在使用的资源
/// 清理所有正在使用的资源
/// </summary>
/// <param name="disposing">如果应释放托管资源,为 true否则为 false</param>
/// <param name="disposing">如果应释放托管资源,为 true否则为 false </param>
protected override void Dispose(bool disposing)
{
if (disposing && (components != null))
@ -24,7 +24,7 @@
/// <summary>
/// 设计器支持所需的方法 - 不要修改
/// 使用代码编辑器修改此方法的内容
/// 使用代码编辑器修改此方法的内容
/// </summary>
private void InitializeComponent()
{

View File

@ -39,6 +39,10 @@ Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "XKRS.CanFly", "CanFly\XKRS.
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "CanFly.Canvas", "CanFly.Canvas\CanFly.Canvas.csproj", "{EA7E228B-DB5C-4BF1-832B-D51B7F7D5F35}"
EndProject
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Process", "Process", "{FE1AEA36-9909-4E4F-8A88-37338ECCCE62}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "DH.Process", "DH.Process\DH.Process.csproj", "{9C6D1290-26D9-4C5B-8BF5-A1F1E35368C5}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
@ -127,6 +131,14 @@ Global
{EA7E228B-DB5C-4BF1-832B-D51B7F7D5F35}.Release|Any CPU.Build.0 = Release|Any CPU
{EA7E228B-DB5C-4BF1-832B-D51B7F7D5F35}.Release|x64.ActiveCfg = Release|x64
{EA7E228B-DB5C-4BF1-832B-D51B7F7D5F35}.Release|x64.Build.0 = Release|x64
{9C6D1290-26D9-4C5B-8BF5-A1F1E35368C5}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{9C6D1290-26D9-4C5B-8BF5-A1F1E35368C5}.Debug|Any CPU.Build.0 = Debug|Any CPU
{9C6D1290-26D9-4C5B-8BF5-A1F1E35368C5}.Debug|x64.ActiveCfg = Debug|Any CPU
{9C6D1290-26D9-4C5B-8BF5-A1F1E35368C5}.Debug|x64.Build.0 = Debug|Any CPU
{9C6D1290-26D9-4C5B-8BF5-A1F1E35368C5}.Release|Any CPU.ActiveCfg = Release|Any CPU
{9C6D1290-26D9-4C5B-8BF5-A1F1E35368C5}.Release|Any CPU.Build.0 = Release|Any CPU
{9C6D1290-26D9-4C5B-8BF5-A1F1E35368C5}.Release|x64.ActiveCfg = Release|Any CPU
{9C6D1290-26D9-4C5B-8BF5-A1F1E35368C5}.Release|x64.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
@ -145,6 +157,7 @@ Global
{5AD3A29E-149A-4C37-9548-7638A36C8175} = {F77AF94C-280D-44C5-B7C0-FC86AA9EC504}
{1FB768DB-843E-4C67-96B9-7684CF890D89} = {048B30B5-D075-4CE0-BF9F-CB6152E6D376}
{EA7E228B-DB5C-4BF1-832B-D51B7F7D5F35} = {048B30B5-D075-4CE0-BF9F-CB6152E6D376}
{9C6D1290-26D9-4C5B-8BF5-A1F1E35368C5} = {FE1AEA36-9909-4E4F-8A88-37338ECCCE62}
EndGlobalSection
GlobalSection(ExtensibilityGlobals) = postSolution
SolutionGuid = {6FC1A8DF-636E-434C-981E-10F20FAD723B}

View File

@ -12,10 +12,6 @@
<OutputType>WinExe</OutputType>
</PropertyGroup>
@ -49,6 +45,7 @@
<ProjectReference Include="..\DH.Devices.Motion\DH.Devices.Motion.csproj" />
<ProjectReference Include="..\DH.Devices.PLC\DH.Devices.PLC.csproj" />
<ProjectReference Include="..\DH.Devices.Vision\DH.Devices.Vision.csproj" />
<ProjectReference Include="..\DH.Process\DH.Process.csproj" />
<ProjectReference Include="..\DH.UI.Model.Winform\DH.UI.Model.Winform.csproj" />
</ItemGroup>

View File

@ -6,6 +6,7 @@ using DH.Devices.Devices;
using DH.Devices.Motion;
using DH.Devices.PLC;
using DH.Devices.Vision;
using DH.Process;
using DHSoftware.Languages;
using DHSoftware.Models;
using DHSoftware.Utils;
@ -18,17 +19,22 @@ using System;
using System.CodeDom;
using System.Collections.Concurrent;
using System.Collections.Generic;
using System.Collections.ObjectModel;
using System.Diagnostics;
using System.Drawing;
using System.Linq;
using System.Runtime.InteropServices;
using System.Text;
using System.Text.Json;
using System.Threading;
using System.Threading.Tasks;
using System.Windows.Forms;
using XKRS.UI.Device.Winform;
using static AntdUI.Math3D;
using static DH.Commons.Enums.EnumHelper;
using Camera = DHSoftware.Models.Camera;
using IOType = DH.Commons.Enums.IOType;
namespace DHSoftware
{
@ -229,7 +235,7 @@ namespace DHSoftware
SLDMotion sLDMotion = new SLDMotion();
private void MainWindow_Load(object sender, EventArgs e)
{
Json();
}
private void MainWindow_FormClosed(object sender, FormClosedEventArgs e)
@ -278,21 +284,15 @@ namespace DHSoftware
public volatile int ProductNum_OK = 0;
private readonly object _cameraSummaryLock = new object();
public SimboVisionDriver? _visionEngine = null;
List<DetectionConfig> DetectionConfigs = new List<DetectionConfig>();
List<SimboStationMLEngineSet> SimboStationMLEngineList = new List<SimboStationMLEngineSet>();
ProcessConfigBase DHconfig;
//
// List<SimboStationMLEngineSet> SimboStationMLEngineList = new List<SimboStationMLEngineSet>();
Dictionary<string, HDevEngineTool> HalconToolDict = new Dictionary<string, HDevEngineTool>();
public List<RecongnitionLabel> RecongnitionLabelList { get; set; } = new List<RecongnitionLabel>();
public DateTime startTime;
private void HandleStartButton()
private void Json()
{
CurrentMachine = true;
//_visionEngine.Start();
//[Category("深度学习检测配置")]
//[DisplayName("检测标签定义集合")]
//[Description("定义检测标签的集合例如Seg/Detection模式断裂、油污、划伤...Class模式ok、ng、上面、下面、套环、正常...")]
//[TypeConverter(typeof(CollectionCountConvert))]
//[Editor(typeof(ComplexCollectionEditor<RecongnitionLabel>), typeof(UITypeEditor))]
List<DetectionConfig> DetectionConfigs = new List<DetectionConfig>();
RecongnitionLabel recongnition = new RecongnitionLabel
{
LabelName = "youwu",
@ -315,7 +315,7 @@ namespace DHSoftware
RecongnitionLabelList.Add(recongnition2);
RecongnitionLabelList.Add(recongnition3);
var det1 = new DetectionConfig("相机1", MLModelType.ObjectDetection, @"D:\PROJECTS\X015\Vision\Cam1.onnx", false, "Cam1");
var det2 = new DetectionConfig("相机2", MLModelType.ObjectDetection, @"D:\PROJECTS\X015\Vision\Cam2.onnx", false, "Cam2");
@ -353,6 +353,13 @@ namespace DHSoftware
det1.IsEnabled = true;
det1.ShowLocation.X = 1;
det1.ShowLocation.Y = 1;
det1.DetectionLableList = new List<DetectionLable>()
{ new DetectionLable{ LabelName="xinquexian1",MaxArea=99999999,MinArea=1,MinSource=0.6,MaxSource=1 } ,
new DetectionLable{ LabelName="xinquexian2",MaxArea=99999999,MinArea=1,MinSource=0.6,MaxSource=1 } ,
new DetectionLable{ LabelName="xinquexian3",MaxArea=99999999,MinArea=1,MinSource=0.6,MaxSource=1 } ,
new DetectionLable{ LabelName="xinquexian4",MaxArea=99999999,MinArea=1,MinSource=0.6,MaxSource=1} ,
};
det2.CameraCollects = CameraCollects2;
det2.ModelconfThreshold = Conf;
@ -362,7 +369,13 @@ namespace DHSoftware
det2.IsEnabled = true;
det2.ShowLocation.X = 2;
det2.ShowLocation.Y = 1;
det2.DetectionLableList = new List<DetectionLable>()
{ new DetectionLable{ LabelName="xinquexian1",MaxArea=99999999,MinArea=1,MinSource=0.6,MaxSource=1 } ,
new DetectionLable{ LabelName="xinquexian2",MaxArea=99999999,MinArea=1,MinSource=0.6,MaxSource=1 } ,
new DetectionLable{ LabelName="xinquexian3",MaxArea=99999999,MinArea=1,MinSource=0.6,MaxSource=1 } ,
new DetectionLable{ LabelName="xinquexian4",MaxArea=99999999,MinArea=1,MinSource=0.6,MaxSource=1 } ,
};
det3.CameraCollects = CameraCollects3;
det3.ModelconfThreshold = Conf;
det3.ModelWidth = 640;
@ -371,6 +384,13 @@ namespace DHSoftware
det3.IsEnabled = true;
det3.ShowLocation.X = 3;
det3.ShowLocation.Y = 1;
det3.DetectionLableList = new List<DetectionLable>()
{ new DetectionLable{ LabelName="xinquexian1",MaxArea=99999999,MinArea=1,MinSource=0.6,MaxSource=1 } ,
new DetectionLable{ LabelName="xinquexian2",MaxArea=99999999,MinArea=1,MinSource=0.6,MaxSource=1 } ,
new DetectionLable{ LabelName="xinquexian3",MaxArea=99999999,MinArea=1,MinSource=0.6,MaxSource=1 } ,
new DetectionLable{ LabelName="xinquexian4",MaxArea=99999999,MinArea=1,MinSource=0.6,MaxSource=1 } ,
};
det4.CameraCollects = CameraCollects4;
det4.ModelconfThreshold = Conf;
@ -380,6 +400,13 @@ namespace DHSoftware
det4.IsEnabled = true;
det4.ShowLocation.X = 4;
det4.ShowLocation.Y = 1;
det4.DetectionLableList = new List<DetectionLable>()
{ new DetectionLable{ LabelName="xinquexian1",MaxArea=99999999,MinArea=1,MinSource=0.6,MaxSource=1 } ,
new DetectionLable{ LabelName="xinquexian2",MaxArea=99999999,MinArea=1,MinSource=0.6,MaxSource=1 } ,
new DetectionLable{ LabelName="xinquexian3",MaxArea=99999999,MinArea=1,MinSource=0.6,MaxSource=1 } ,
new DetectionLable{ LabelName="xinquexian4",MaxArea=99999999,MinArea=1,MinSource=0.6,MaxSource=1 } ,
};
@ -391,6 +418,23 @@ namespace DHSoftware
det5.IsEnabled = true;
det5.ShowLocation.X = 1;
det5.ShowLocation.Y = 2;
det5.DetectionLableList = new List<DetectionLable>()
{ new DetectionLable{ LabelName="xinquexian1",MaxArea=99999999,MinArea=1,MinSource=0.6,MaxSource=1 } ,
new DetectionLable{ LabelName="xinquexian2",MaxArea=99999999,MinArea=1,MinSource=0.6,MaxSource=1 } ,
new DetectionLable{ LabelName="xinquexian3",MaxArea=99999999,MinArea=1,MinSource=0.6,MaxSource=1 } ,
new DetectionLable{ LabelName="xinquexian4",MaxArea=99999999,MinArea=1,MinSource=0.6,MaxSource=1 } ,
};
det5.PreTreatCollects = new List<SizeTreatParam>()
{
new SizeTreatParam()
{
PreName="高度测量",
IsEnable=true,
PreType=SizeEnum.,
ResultShow="sssssss",
OutResultShow="sssssss",
},
};
det6.CameraCollects = CameraCollects6;
det6.ModelconfThreshold = Conf;
@ -400,6 +444,13 @@ namespace DHSoftware
det6.IsEnabled = true;
det6.ShowLocation.X = 2;
det6.ShowLocation.Y = 2;
det6.DetectionLableList = new List<DetectionLable>()
{ new DetectionLable{ LabelName="xinquexian1",MaxArea=99999999,MinArea=1,MinSource=0.6,MaxSource=1 } ,
new DetectionLable{ LabelName="xinquexian2",MaxArea=99999999,MinArea=1,MinSource=0.6,MaxSource=1 } ,
new DetectionLable{ LabelName="xinquexian3",MaxArea=99999999,MinArea=1,MinSource=0.6,MaxSource=1 } ,
new DetectionLable{ LabelName="xinquexian4",MaxArea=99999999,MinArea=1,MinSource=0.6,MaxSource=1 } ,
};
det7.CameraCollects = CameraCollects7;
det7.ModelconfThreshold = Conf;
@ -409,6 +460,13 @@ namespace DHSoftware
det7.IsEnabled = true;
det7.ShowLocation.X = 3;
det7.ShowLocation.Y = 2;
det7.DetectionLableList = new List<DetectionLable>()
{ new DetectionLable{ LabelName="xinquexian1",MaxArea=99999999,MinArea=1,MinSource=0.6,MaxSource=1 } ,
new DetectionLable{ LabelName="xinquexian2",MaxArea=99999999,MinArea=1,MinSource=0.6,MaxSource=1 } ,
new DetectionLable{ LabelName="xinquexian3",MaxArea=99999999,MinArea=1,MinSource=0.6,MaxSource=1 } ,
new DetectionLable{ LabelName="xinquexian4",MaxArea=99999999,MinArea=1,MinSource=0.6,MaxSource=1 } ,
};
det8.CameraCollects = CameraCollects8;
det8.ModelconfThreshold = Conf;
@ -416,8 +474,27 @@ namespace DHSoftware
det8.ModelHeight = 640;
det8.in_lable_path = "D:\\PROJECTS\\X015\\Vision\\Cam8.txt";
det8.IsEnabled = true;
det8.IsAddStation = true;
det8.ShowLocation.X = 4;
det8.ShowLocation.Y = 2;
det8.DetectionLableList = new List<DetectionLable>()
{ new DetectionLable{ LabelName="xinquexian1",MaxArea=99999999,MinArea=1,MinSource=0.6,MaxSource=1 } ,
new DetectionLable{ LabelName="xinquexian2",MaxArea=99999999,MinArea=1,MinSource=0.6,MaxSource=1 } ,
new DetectionLable{ LabelName="xinquexian3",MaxArea=99999999,MinArea=1,MinSource=0.6,MaxSource=1 } ,
new DetectionLable{ LabelName="xinquexian4",MaxArea=99999999,MinArea=1,MinSource=0.6,MaxSource=1 } ,
};
det8.PreTreatCollects = new List<SizeTreatParam>()
{
new SizeTreatParam()
{
PreName="高度测量",
IsEnable=true,
PreType=SizeEnum.,
ResultShow="sssssss",
OutResultShow="sssssss",
},
};
DetectionConfigs.Add(det1);
DetectionConfigs.Add(det2);
@ -428,6 +505,32 @@ namespace DHSoftware
DetectionConfigs.Add(det7);
DetectionConfigs.Add(det8);
DHconfig = new ProcessConfigBase();
DHconfig.StationCode = "小齿轮";
DHconfig.DetectionConfigCollection = DetectionConfigs;
// DHconfig.ca = "小齿轮";
// **序列化**
string json = JsonSerializer.Serialize(DHconfig, new JsonSerializerOptions { WriteIndented = true });
Console.WriteLine("序列化后的 JSON:\n" + json);
var deserializedConfig = JsonSerializer.Deserialize<ProcessConfigBase>(json);
Console.WriteLine("Station Code: " + deserializedConfig?.StationCode);
}
private void HandleStartButton()
{
CurrentMachine = true;
//_visionEngine.Start();
//[Category("深度学习检测配置")]
//[DisplayName("检测标签定义集合")]
//[Description("定义检测标签的集合例如Seg/Detection模式断裂、油污、划伤...Class模式ok、ng、上面、下面、套环、正常...")]
//[TypeConverter(typeof(CollectionCountConvert))]
//[Editor(typeof(ComplexCollectionEditor<RecongnitionLabel>), typeof(UITypeEditor))]
Cameras.Clear();
HKCameras.Clear();
Dectection.Clear();
@ -477,7 +580,7 @@ namespace DHSoftware
#endif
DetectionConfigs.ForEach(detection =>
DHconfig?.DetectionConfigCollection.ForEach(detection =>
{
detection.CameraCollects.ForEach(cam =>
@ -504,7 +607,7 @@ namespace DHSoftware
_visionEngine = new SimboVisionDriver();
_visionEngine.DetectionConfigs = DetectionConfigs;
_visionEngine.DetectionConfigs =DHconfig?.DetectionConfigCollection;
_visionEngine.Init();
CtrlVisionRunBase ctrlVisionRun = new CtrlVisionRunBase(_visionEngine);
@ -1005,7 +1108,7 @@ namespace DHSoftware
Gain = 60,
Exposure = 10,
RotateImage = 0,
IsEnabled = false,
isEnabled = false,
};
CameraBase cam2 = new CameraBase
{
@ -1015,12 +1118,12 @@ namespace DHSoftware
Gain = 60,
Exposure = 10,
RotateImage = 0,
IsEnabled = false,
isEnabled = false,
};
listCamBase.Add(cam1);
listCamBase.Add(cam2);
SettingWindow1 settingWindow = new SettingWindow1();
SettingWindow1 settingWindow = new SettingWindow1(DHconfig);
settingWindow.Show();
//s.cameras = listCamBase;
//s.Show();

View File

@ -9,7 +9,7 @@ namespace DHSoftware
{
private static MainWindow mainWindow;
/// <summary>
/// 应用程序的主入口点
/// 应用程序的主入口点
/// </summary>
[STAThread]
static void Main()

View File

@ -1,10 +1,10 @@
//------------------------------------------------------------------------------
// <auto-generated>
// 此代码由工具生成
// 此代码由工具生成
// 运行时版本:4.0.30319.42000
//
// 对此文件的更改可能会导致不正确的行为,并且如果
// 重新生成代码,这些更改将会丢失
// 重新生成代码,这些更改将会丢失
// </auto-generated>
//------------------------------------------------------------------------------
@ -13,12 +13,12 @@ namespace DHSoftware.Properties {
/// <summary>
/// 一个强类型的资源类,用于查找本地化的字符串等
/// 一个强类型的资源类,用于查找本地化的字符串等
/// </summary>
// 此类是由 StronglyTypedResourceBuilder
// 类通过类似于 ResGen 或 Visual Studio 的工具自动生成的
// 类通过类似于 ResGen 或 Visual Studio 的工具自动生成的
// 若要添加或移除成员,请编辑 .ResX 文件,然后重新运行 ResGen
// (以 /str 作为命令选项),或重新生成 VS 项目
// (以 /str 作为命令选项),或重新生成 VS 项目
[global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "17.0.0.0")]
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
[global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()]
@ -33,7 +33,7 @@ namespace DHSoftware.Properties {
}
/// <summary>
/// 返回此类使用的缓存的 ResourceManager 实例
/// 返回此类使用的缓存的 ResourceManager 实例
/// </summary>
[global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)]
internal static global::System.Resources.ResourceManager ResourceManager {
@ -48,7 +48,7 @@ namespace DHSoftware.Properties {
/// <summary>
/// 重写当前线程的 CurrentUICulture 属性,对
/// 使用此强类型资源类的所有资源查找执行重写
/// 使用此强类型资源类的所有资源查找执行重写
/// </summary>
[global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)]
internal static global::System.Globalization.CultureInfo Culture {
@ -61,7 +61,7 @@ namespace DHSoftware.Properties {
}
/// <summary>
/// 查找 System.Drawing.Bitmap 类型的本地化资源
/// 查找 System.Drawing.Bitmap 类型的本地化资源
/// </summary>
internal static System.Drawing.Bitmap bg1 {
get {
@ -71,7 +71,7 @@ namespace DHSoftware.Properties {
}
/// <summary>
/// 查找 System.Drawing.Bitmap 类型的本地化资源
/// 查找 System.Drawing.Bitmap 类型的本地化资源
/// </summary>
internal static System.Drawing.Bitmap bg2 {
get {
@ -81,7 +81,7 @@ namespace DHSoftware.Properties {
}
/// <summary>
/// 查找 System.Drawing.Bitmap 类型的本地化资源
/// 查找 System.Drawing.Bitmap 类型的本地化资源
/// </summary>
internal static System.Drawing.Bitmap bg3 {
get {
@ -91,7 +91,7 @@ namespace DHSoftware.Properties {
}
/// <summary>
/// 查找 System.Drawing.Bitmap 类型的本地化资源
/// 查找 System.Drawing.Bitmap 类型的本地化资源
/// </summary>
internal static System.Drawing.Bitmap head {
get {
@ -101,7 +101,7 @@ namespace DHSoftware.Properties {
}
/// <summary>
/// 查找 System.Drawing.Bitmap 类型的本地化资源
/// 查找 System.Drawing.Bitmap 类型的本地化资源
/// </summary>
internal static System.Drawing.Bitmap head2 {
get {
@ -111,7 +111,7 @@ namespace DHSoftware.Properties {
}
/// <summary>
/// 查找 System.Drawing.Bitmap 类型的本地化资源
/// 查找 System.Drawing.Bitmap 类型的本地化资源
/// </summary>
internal static System.Drawing.Bitmap logo {
get {
@ -121,7 +121,7 @@ namespace DHSoftware.Properties {
}
/// <summary>
/// 查找 System.Drawing.Bitmap 类型的本地化资源
/// 查找 System.Drawing.Bitmap 类型的本地化资源
/// </summary>
internal static System.Drawing.Bitmap {
get {

View File

@ -1,49 +0,0 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using AntdUI;
namespace DHSoftware.Utils
{
public static class AdaptiveHelper
{
#region
public static void setTag(Control cons)
{
foreach (Control con in cons.Controls)
{
con.Tag = con.Width + ";" + con.Height + ";" + con.Left + ";" + con.Top + ";" + con.Font.Size;
if (con.Controls.Count > 0) setTag(con);
}
}
public static void setControls(float newx, float newy, Control cons)
{
//遍历窗体中的控件,重新设置控件的值
foreach (Control con in cons.Controls)
//获取控件的Tag属性值并分割后存储字符串数组
if (con.Tag != null)
{
var mytag = con.Tag.ToString().Split(';');
//根据窗体缩放的比例确定控件的值
con.Width = Convert.ToInt32(Convert.ToSingle(mytag[0]) * newx); //宽度
con.Height = Convert.ToInt32(Convert.ToSingle(mytag[1]) * newy); //高度
con.Left = Convert.ToInt32(Convert.ToSingle(mytag[2]) * newx); //左边距
con.Top = Convert.ToInt32(Convert.ToSingle(mytag[3]) * newy); //顶边距
var currentSize = Convert.ToSingle(mytag[4]) * newy; //字体大小
if (currentSize > 0) con.Font = new Font(con.Font.Name, currentSize, con.Font.Style, con.Font.Unit);
con.Focus();
if (con.Controls.Count > 0) setControls(newx, newy, con);
}
}
#endregion
}
}

View File

@ -1,155 +0,0 @@
using System;
using System.Collections.Generic;
using System.IO;
using System.Text.Json;
using System.Windows.Forms;
using DH.Commons.Enums;
using DH.Devices.Devices;
using DH.Devices.PLC;
namespace DH.Commons.Helper
{
// 配置数据模型
public class AppConfig
{
public List<CameraBase> Cameras { get; set; } = new List<CameraBase>();
public List<PLCBase> PLCs { get; set; } = new List<PLCBase>();
public List<DetectionConfig> Detections { get; set; } = new List<DetectionConfig>();
}
// 配置管理工具类
public static class ConfigManager
{
private static readonly JsonSerializerOptions _jsonOptions = new JsonSerializerOptions
{
WriteIndented = true,
PropertyNamingPolicy = JsonNamingPolicy.CamelCase,
IgnoreNullValues = true
};
// 默认路径配置
private static readonly string DefaultConfigDir = Path.Combine(
Application.StartupPath,
"configs"
);
public static readonly string DefaultConfigPath = Path.Combine(
DefaultConfigDir,
"appsettings.json"
);
/// <summary>
/// 保存配置文件(自动处理目录和备份)
/// </summary>
/// <param name="config">配置对象</param>
/// <param name="filePath">可选文件路径</param>
public static void SaveConfig(AppConfig config, string filePath = null)
{
try
{
// 使用默认路径如果未指定
filePath ??= DefaultConfigPath;
// 确保配置目录存在
var configDir = Path.GetDirectoryName(filePath);
if (!Directory.Exists(configDir))
{
Directory.CreateDirectory(configDir);
}
// 备份已有配置
if (File.Exists(filePath))
{
BackupConfig(filePath);
}
// 序列化并保存
string json = JsonSerializer.Serialize(config, _jsonOptions);
File.WriteAllText(filePath, json);
}
catch (Exception ex)
{
throw new InvalidOperationException("配置保存失败", ex);
}
}
/// <summary>
/// 加载配置文件
/// </summary>
/// <param name="filePath">可选文件路径</param>
/// <returns>配置对象</returns>
public static AppConfig LoadConfig(string filePath = null)
{
try
{
filePath ??= DefaultConfigPath;
if (!File.Exists(filePath))
{
return new AppConfig(); // 返回空配置而不是null
}
string json = File.ReadAllText(filePath);
return JsonSerializer.Deserialize<AppConfig>(json, _jsonOptions);
}
catch (Exception ex)
{
throw new InvalidOperationException("配置加载失败", ex);
}
}
/// <summary>
/// 创建带时间戳的备份文件
/// </summary>
private static void BackupConfig(string originalPath)
{
try
{
// 创建备份目录
var backupDir = Path.Combine(
Path.GetDirectoryName(originalPath),
"backups"
);
if (!Directory.Exists(backupDir))
{
Directory.CreateDirectory(backupDir);
}
// 生成带时间戳的文件名
string timestamp = DateTime.Now.ToString("yyyyMMdd_HHmmss");
string fileName = $"{Path.GetFileNameWithoutExtension(originalPath)}_" +
$"{timestamp}" +
$"{Path.GetExtension(originalPath)}";
// 执行备份
File.Copy(
originalPath,
Path.Combine(backupDir, fileName),
overwrite: true
);
}
catch (Exception ex)
{
throw new InvalidOperationException("配置备份失败", ex);
}
}
/// <summary>
/// 创建新的配置对象
/// </summary>
public static AppConfig CreateConfig(
List<CameraBase> cameras = null,
List<PLCBase> plcs = null,
List<DetectionConfig> detections = null)
{
return new AppConfig
{
Cameras = cameras ?? new List<CameraBase>(),
PLCs = plcs ?? new List<PLCBase>(),
Detections = detections ?? new List<DetectionConfig>()
};
}
}
}

View File

@ -1,162 +0,0 @@
namespace DHSoftware.Views
{
partial class AddCameraControl
{
/// <summary>
/// 必需的设计器变量。
/// </summary>
private System.ComponentModel.IContainer components = null;
/// <summary>
/// 清理所有正在使用的资源。
/// </summary>
/// <param name="disposing">如果应释放托管资源,为 true否则为 false。</param>
protected override void Dispose(bool disposing)
{
if (disposing && (components != null))
{
components.Dispose();
}
base.Dispose(disposing);
}
#region
/// <summary>
/// 设计器支持所需的方法 - 不要修改
/// 使用代码编辑器修改此方法的内容。
/// </summary>
private void InitializeComponent()
{
panel1 = new AntdUI.Panel();
input_name = new AntdUI.Input();
label3 = new AntdUI.Label();
divider1 = new AntdUI.Divider();
stackPanel1 = new AntdUI.StackPanel();
button_cancel = new AntdUI.Button();
button_ok = new AntdUI.Button();
divider2 = new AntdUI.Divider();
label1 = new AntdUI.Label();
panel1.SuspendLayout();
stackPanel1.SuspendLayout();
SuspendLayout();
//
// panel1
//
panel1.Controls.Add(input_name);
panel1.Controls.Add(label3);
panel1.Controls.Add(divider1);
panel1.Controls.Add(stackPanel1);
panel1.Controls.Add(divider2);
panel1.Controls.Add(label1);
panel1.Dock = DockStyle.Fill;
panel1.Location = new Point(0, 0);
panel1.Name = "panel1";
panel1.Padding = new Padding(12);
panel1.Shadow = 6;
panel1.Size = new Size(500, 194);
panel1.TabIndex = 0;
panel1.Text = "panel1";
//
// input_name
//
input_name.Dock = DockStyle.Top;
input_name.Font = new Font("Microsoft YaHei UI", 9F, FontStyle.Regular, GraphicsUnit.Point, 134);
input_name.Location = new Point(18, 134);
input_name.Name = "input_name";
input_name.Radius = 3;
input_name.Size = new Size(464, 38);
input_name.TabIndex = 22;
//
// label3
//
label3.Dock = DockStyle.Top;
label3.Font = new Font("Microsoft YaHei UI", 12F, FontStyle.Regular, GraphicsUnit.Point, 134);
label3.Location = new Point(18, 110);
label3.Name = "label3";
label3.Size = new Size(464, 24);
label3.TabIndex = 21;
label3.Text = "相机名称";
//
// divider1
//
divider1.Dock = DockStyle.Top;
divider1.Location = new Point(18, 98);
divider1.Name = "divider1";
divider1.Size = new Size(464, 12);
divider1.TabIndex = 20;
//
// stackPanel1
//
stackPanel1.Controls.Add(button_cancel);
stackPanel1.Controls.Add(button_ok);
stackPanel1.Dock = DockStyle.Top;
stackPanel1.Location = new Point(18, 54);
stackPanel1.Name = "stackPanel1";
stackPanel1.RightToLeft = RightToLeft.No;
stackPanel1.Size = new Size(464, 44);
stackPanel1.TabIndex = 19;
stackPanel1.Text = "stackPanel1";
//
// button_cancel
//
button_cancel.BorderWidth = 1F;
button_cancel.Font = new Font("Microsoft YaHei UI", 9F);
button_cancel.Ghost = true;
button_cancel.Location = new Point(84, 3);
button_cancel.Name = "button_cancel";
button_cancel.Size = new Size(75, 38);
button_cancel.TabIndex = 1;
button_cancel.Text = "取消";
//
// button_ok
//
button_ok.Font = new Font("Microsoft YaHei UI", 9F, FontStyle.Regular, GraphicsUnit.Point, 134);
button_ok.Location = new Point(3, 3);
button_ok.Name = "button_ok";
button_ok.Size = new Size(75, 38);
button_ok.TabIndex = 0;
button_ok.Text = "确定";
button_ok.Type = AntdUI.TTypeMini.Primary;
//
// divider2
//
divider2.Dock = DockStyle.Top;
divider2.Location = new Point(18, 42);
divider2.Name = "divider2";
divider2.Size = new Size(464, 12);
divider2.TabIndex = 18;
//
// label1
//
label1.Dock = DockStyle.Top;
label1.Font = new Font("Microsoft YaHei UI", 12F, FontStyle.Regular, GraphicsUnit.Point, 134);
label1.Location = new Point(18, 18);
label1.Name = "label1";
label1.Size = new Size(464, 24);
label1.TabIndex = 17;
label1.Text = "新增相机操作";
//
// AddCameraControl
//
Controls.Add(panel1);
Name = "AddCameraControl";
Size = new Size(500, 194);
panel1.ResumeLayout(false);
stackPanel1.ResumeLayout(false);
ResumeLayout(false);
}
#endregion
private AntdUI.Panel panel1;
private AntdUI.Label label1;
private AntdUI.Input input_name;
private AntdUI.Label label3;
private AntdUI.Divider divider1;
private AntdUI.StackPanel stackPanel1;
private AntdUI.Button button_cancel;
private AntdUI.Button button_ok;
private AntdUI.Divider divider2;
}
}

View File

@ -1,47 +0,0 @@

namespace DHSoftware.Views
{
public partial class AddCameraControl : UserControl
{
private AntdUI.Window window;
public bool submit;
public string CubicleName;
public AddCameraControl(AntdUI.Window _window)
{
this.window = _window;
InitializeComponent();
// 绑定事件
BindEventHandler();
}
private void BindEventHandler()
{
button_ok.Click += Button_ok_Click;
button_cancel.Click += Button_cancel_Click;
}
private void Button_cancel_Click(object sender, EventArgs e)
{
submit = false;
this.Dispose();
}
private void Button_ok_Click(object sender, EventArgs e)
{
input_name.Status = AntdUI.TType.None;
//检查输入内容
if (String.IsNullOrEmpty(input_name.Text))
{
input_name.Status = AntdUI.TType.Error;
AntdUI.Message.warn(window, "相机名称不能为空!", autoClose: 3);
return;
}
CubicleName=input_name.Text;
submit = true;
this.Dispose();
}
}
}

View File

@ -0,0 +1,81 @@
namespace DHSoftware.Views
{
partial class AddCameraWindow
{
/// <summary>
/// Required designer variable.
/// </summary>
private System.ComponentModel.IContainer components = null;
/// <summary>
/// Clean up any resources being used.
/// </summary>
/// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param>
protected override void Dispose(bool disposing)
{
if (disposing && (components != null))
{
components.Dispose();
}
base.Dispose(disposing);
}
#region Windows Form Designer generated code
/// <summary>
/// Required method for Designer support - do not modify
/// the contents of this method with the code editor.
/// </summary>
private void InitializeComponent()
{
btnOK = new AntdUI.Button();
btnCancel = new AntdUI.Button();
stName = new AntdUI.Select();
SuspendLayout();
//
// btnOK
//
btnOK.Location = new Point(170, 136);
btnOK.Name = "btnOK";
btnOK.Size = new Size(75, 40);
btnOK.TabIndex = 1;
btnOK.Text = "确定";
btnOK.Click += btnOK_Click;
//
// btnCancel
//
btnCancel.Location = new Point(259, 136);
btnCancel.Name = "btnCancel";
btnCancel.Size = new Size(75, 40);
btnCancel.TabIndex = 2;
btnCancel.Text = "取消";
btnCancel.Click += btnCancel_Click;
//
// stName
//
stName.Location = new Point(39, 46);
stName.Name = "stName";
stName.PlaceholderText = "请选择关联相机";
stName.Size = new Size(281, 50);
stName.TabIndex = 3;
//
// AddCameraWindow
//
AutoScaleDimensions = new SizeF(7F, 17F);
AutoScaleMode = AutoScaleMode.Font;
ClientSize = new Size(369, 188);
Controls.Add(stName);
Controls.Add(btnCancel);
Controls.Add(btnOK);
Name = "AddCameraWindow";
StartPosition = FormStartPosition.CenterParent;
Text = "AddCubicleWindow";
ResumeLayout(false);
}
#endregion
private AntdUI.Button btnOK;
private AntdUI.Button btnCancel;
private AntdUI.Select stName;
}
}

View File

@ -0,0 +1,61 @@
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
using System.Xml.Linq;
using AntdUI;
namespace DHSoftware.Views
{
public partial class AddCameraWindow : Window
{
public AddCameraWindow()
{
InitializeComponent();
btnOK.DialogResult = DialogResult.OK;
btnCancel.DialogResult = DialogResult.Cancel;
this.AcceptButton = btnOK;
this.CancelButton = btnCancel;
stName.Items.Clear();
for(int i = 1; i <= 8; i++)
{
stName.Items.Add($"Cam{i}");
}
}
public string CubicleName { get; private set; }
private void btnOK_Click(object sender, EventArgs e)
{
if (ValidateInput())
{
this.DialogResult = DialogResult.OK;
this.Close();
}
}
private void btnCancel_Click(object sender, EventArgs e)
{
this.DialogResult = DialogResult.Cancel;
this.Close();
}
private bool ValidateInput()
{
if (string.IsNullOrWhiteSpace(stName.Text))
{
MessageBox.Show("请选择关联相机", "输入错误",
MessageBoxButtons.OK,
MessageBoxIcon.Warning);
return false;
}
CubicleName = stName.Text.Trim();
return true;
}
}
}

View File

@ -1,162 +0,0 @@
namespace DHSoftware.Views
{
partial class AddCubicleControl
{
/// <summary>
/// 必需的设计器变量。
/// </summary>
private System.ComponentModel.IContainer components = null;
/// <summary>
/// 清理所有正在使用的资源。
/// </summary>
/// <param name="disposing">如果应释放托管资源,为 true否则为 false。</param>
protected override void Dispose(bool disposing)
{
if (disposing && (components != null))
{
components.Dispose();
}
base.Dispose(disposing);
}
#region
/// <summary>
/// 设计器支持所需的方法 - 不要修改
/// 使用代码编辑器修改此方法的内容。
/// </summary>
private void InitializeComponent()
{
panel1 = new AntdUI.Panel();
input_name = new AntdUI.Input();
label3 = new AntdUI.Label();
divider1 = new AntdUI.Divider();
stackPanel1 = new AntdUI.StackPanel();
button_cancel = new AntdUI.Button();
button_ok = new AntdUI.Button();
divider2 = new AntdUI.Divider();
label1 = new AntdUI.Label();
panel1.SuspendLayout();
stackPanel1.SuspendLayout();
SuspendLayout();
//
// panel1
//
panel1.Controls.Add(input_name);
panel1.Controls.Add(label3);
panel1.Controls.Add(divider1);
panel1.Controls.Add(stackPanel1);
panel1.Controls.Add(divider2);
panel1.Controls.Add(label1);
panel1.Dock = DockStyle.Fill;
panel1.Location = new Point(0, 0);
panel1.Name = "panel1";
panel1.Padding = new Padding(12);
panel1.Shadow = 6;
panel1.Size = new Size(500, 194);
panel1.TabIndex = 0;
panel1.Text = "panel1";
//
// input_name
//
input_name.Dock = DockStyle.Top;
input_name.Font = new Font("Microsoft YaHei UI", 9F, FontStyle.Regular, GraphicsUnit.Point, 134);
input_name.Location = new Point(18, 134);
input_name.Name = "input_name";
input_name.Radius = 3;
input_name.Size = new Size(464, 38);
input_name.TabIndex = 22;
//
// label3
//
label3.Dock = DockStyle.Top;
label3.Font = new Font("Microsoft YaHei UI", 12F, FontStyle.Regular, GraphicsUnit.Point, 134);
label3.Location = new Point(18, 110);
label3.Name = "label3";
label3.Size = new Size(464, 24);
label3.TabIndex = 21;
label3.Text = "工位名称";
//
// divider1
//
divider1.Dock = DockStyle.Top;
divider1.Location = new Point(18, 98);
divider1.Name = "divider1";
divider1.Size = new Size(464, 12);
divider1.TabIndex = 20;
//
// stackPanel1
//
stackPanel1.Controls.Add(button_cancel);
stackPanel1.Controls.Add(button_ok);
stackPanel1.Dock = DockStyle.Top;
stackPanel1.Location = new Point(18, 54);
stackPanel1.Name = "stackPanel1";
stackPanel1.RightToLeft = RightToLeft.No;
stackPanel1.Size = new Size(464, 44);
stackPanel1.TabIndex = 19;
stackPanel1.Text = "stackPanel1";
//
// button_cancel
//
button_cancel.BorderWidth = 1F;
button_cancel.Font = new Font("Microsoft YaHei UI", 9F);
button_cancel.Ghost = true;
button_cancel.Location = new Point(84, 3);
button_cancel.Name = "button_cancel";
button_cancel.Size = new Size(75, 38);
button_cancel.TabIndex = 1;
button_cancel.Text = "取消";
//
// button_ok
//
button_ok.Font = new Font("Microsoft YaHei UI", 9F, FontStyle.Regular, GraphicsUnit.Point, 134);
button_ok.Location = new Point(3, 3);
button_ok.Name = "button_ok";
button_ok.Size = new Size(75, 38);
button_ok.TabIndex = 0;
button_ok.Text = "确定";
button_ok.Type = AntdUI.TTypeMini.Primary;
//
// divider2
//
divider2.Dock = DockStyle.Top;
divider2.Location = new Point(18, 42);
divider2.Name = "divider2";
divider2.Size = new Size(464, 12);
divider2.TabIndex = 18;
//
// label1
//
label1.Dock = DockStyle.Top;
label1.Font = new Font("Microsoft YaHei UI", 12F, FontStyle.Regular, GraphicsUnit.Point, 134);
label1.Location = new Point(18, 18);
label1.Name = "label1";
label1.Size = new Size(464, 24);
label1.TabIndex = 17;
label1.Text = "新增工位操作";
//
// AddCubicleControl
//
Controls.Add(panel1);
Name = "AddCubicleControl";
Size = new Size(500, 194);
panel1.ResumeLayout(false);
stackPanel1.ResumeLayout(false);
ResumeLayout(false);
}
#endregion
private AntdUI.Panel panel1;
private AntdUI.Label label1;
private AntdUI.Input input_name;
private AntdUI.Label label3;
private AntdUI.Divider divider1;
private AntdUI.StackPanel stackPanel1;
private AntdUI.Button button_cancel;
private AntdUI.Button button_ok;
private AntdUI.Divider divider2;
}
}

View File

@ -1,47 +0,0 @@

namespace DHSoftware.Views
{
public partial class AddCubicleControl : UserControl
{
private AntdUI.Window window;
public bool submit;
public string CubicleName;
public AddCubicleControl(AntdUI.Window _window)
{
this.window = _window;
InitializeComponent();
// 绑定事件
BindEventHandler();
}
private void BindEventHandler()
{
button_ok.Click += Button_ok_Click;
button_cancel.Click += Button_cancel_Click;
}
private void Button_cancel_Click(object sender, EventArgs e)
{
submit = false;
this.Dispose();
}
private void Button_ok_Click(object sender, EventArgs e)
{
input_name.Status = AntdUI.TType.None;
//检查输入内容
if (String.IsNullOrEmpty(input_name.Text))
{
input_name.Status = AntdUI.TType.Error;
AntdUI.Message.warn(window, "工位名称不能为空!", autoClose: 3);
return;
}
CubicleName=input_name.Text;
submit = true;
this.Dispose();
}
}
}

View File

@ -0,0 +1,82 @@
namespace DHSoftware.Views
{
partial class AddCubicleWindow
{
/// <summary>
/// Required designer variable.
/// </summary>
private System.ComponentModel.IContainer components = null;
/// <summary>
/// Clean up any resources being used.
/// </summary>
/// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param>
protected override void Dispose(bool disposing)
{
if (disposing && (components != null))
{
components.Dispose();
}
base.Dispose(disposing);
}
#region Windows Form Designer generated code
/// <summary>
/// Required method for Designer support - do not modify
/// the contents of this method with the code editor.
/// </summary>
private void InitializeComponent()
{
txtName = new AntdUI.Input();
btnOK = new AntdUI.Button();
btnCancel = new AntdUI.Button();
SuspendLayout();
//
// txtName
//
txtName.Location = new Point(35, 47);
txtName.Name = "txtName";
txtName.PlaceholderText = "请输入新增工位名称";
txtName.Size = new Size(299, 48);
txtName.TabIndex = 0;
//
// btnOK
//
btnOK.Location = new Point(170, 136);
btnOK.Name = "btnOK";
btnOK.Size = new Size(75, 40);
btnOK.TabIndex = 1;
btnOK.Text = "确定";
btnOK.Click += btnOK_Click;
//
// btnCancel
//
btnCancel.Location = new Point(259, 136);
btnCancel.Name = "btnCancel";
btnCancel.Size = new Size(75, 40);
btnCancel.TabIndex = 2;
btnCancel.Text = "取消";
btnCancel.Click += btnCancel_Click;
//
// AddCubicleWindow
//
AutoScaleDimensions = new SizeF(7F, 17F);
AutoScaleMode = AutoScaleMode.Font;
ClientSize = new Size(369, 188);
Controls.Add(btnCancel);
Controls.Add(btnOK);
Controls.Add(txtName);
Name = "AddCubicleWindow";
StartPosition = FormStartPosition.CenterParent;
Text = "AddCubicleWindow";
ResumeLayout(false);
}
#endregion
private AntdUI.Input txtName;
private AntdUI.Button btnOK;
private AntdUI.Button btnCancel;
}
}

View File

@ -0,0 +1,55 @@
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
using System.Xml.Linq;
using AntdUI;
namespace DHSoftware.Views
{
public partial class AddCubicleWindow : Window
{
public AddCubicleWindow()
{
InitializeComponent();
btnOK.DialogResult = DialogResult.OK;
btnCancel.DialogResult = DialogResult.Cancel;
this.AcceptButton = btnOK;
this.CancelButton = btnCancel;
}
public string CubicleName { get; private set; }
private void btnOK_Click(object sender, EventArgs e)
{
if (ValidateInput())
{
this.DialogResult = DialogResult.OK;
this.Close();
}
}
private void btnCancel_Click(object sender, EventArgs e)
{
this.DialogResult = DialogResult.Cancel;
this.Close();
}
private bool ValidateInput()
{
if (string.IsNullOrWhiteSpace(txtName.Text))
{
MessageBox.Show("请输入有效的名称", "输入错误",
MessageBoxButtons.OK,
MessageBoxIcon.Warning);
txtName.Focus();
return false;
}
CubicleName = txtName.Text.Trim();
return true;
}
}
}

View File

@ -1,197 +0,0 @@
namespace DHSoftware.Views
{
partial class AddMotionControl
{
/// <summary>
/// 必需的设计器变量。
/// </summary>
private System.ComponentModel.IContainer components = null;
/// <summary>
/// 清理所有正在使用的资源。
/// </summary>
/// <param name="disposing">如果应释放托管资源,为 true否则为 false。</param>
protected override void Dispose(bool disposing)
{
if (disposing && (components != null))
{
components.Dispose();
}
base.Dispose(disposing);
}
#region
/// <summary>
/// 设计器支持所需的方法 - 不要修改
/// 使用代码编辑器修改此方法的内容。
/// </summary>
private void InitializeComponent()
{
panel1 = new AntdUI.Panel();
input_name = new AntdUI.Input();
label3 = new AntdUI.Label();
divider1 = new AntdUI.Divider();
stackPanel1 = new AntdUI.StackPanel();
button_cancel = new AntdUI.Button();
button_ok = new AntdUI.Button();
divider2 = new AntdUI.Divider();
label1 = new AntdUI.Label();
label2 = new AntdUI.Label();
divider3 = new AntdUI.Divider();
select_type = new AntdUI.Select();
panel1.SuspendLayout();
stackPanel1.SuspendLayout();
SuspendLayout();
//
// panel1
//
panel1.Controls.Add(select_type);
panel1.Controls.Add(label2);
panel1.Controls.Add(divider3);
panel1.Controls.Add(input_name);
panel1.Controls.Add(label3);
panel1.Controls.Add(divider1);
panel1.Controls.Add(stackPanel1);
panel1.Controls.Add(divider2);
panel1.Controls.Add(label1);
panel1.Dock = DockStyle.Fill;
panel1.Location = new Point(0, 0);
panel1.Name = "panel1";
panel1.Padding = new Padding(12);
panel1.Shadow = 6;
panel1.Size = new Size(500, 260);
panel1.TabIndex = 0;
panel1.Text = "panel1";
//
// input_name
//
input_name.Dock = DockStyle.Top;
input_name.Font = new Font("Microsoft YaHei UI", 9F, FontStyle.Regular, GraphicsUnit.Point, 134);
input_name.Location = new Point(18, 134);
input_name.Name = "input_name";
input_name.Radius = 3;
input_name.Size = new Size(464, 38);
input_name.TabIndex = 22;
//
// label3
//
label3.Dock = DockStyle.Top;
label3.Font = new Font("Microsoft YaHei UI", 12F, FontStyle.Regular, GraphicsUnit.Point, 134);
label3.Location = new Point(18, 110);
label3.Name = "label3";
label3.Size = new Size(464, 24);
label3.TabIndex = 21;
label3.Text = "运动控制名称";
//
// divider1
//
divider1.Dock = DockStyle.Top;
divider1.Location = new Point(18, 98);
divider1.Name = "divider1";
divider1.Size = new Size(464, 12);
divider1.TabIndex = 20;
//
// stackPanel1
//
stackPanel1.Controls.Add(button_cancel);
stackPanel1.Controls.Add(button_ok);
stackPanel1.Dock = DockStyle.Top;
stackPanel1.Location = new Point(18, 54);
stackPanel1.Name = "stackPanel1";
stackPanel1.RightToLeft = RightToLeft.No;
stackPanel1.Size = new Size(464, 44);
stackPanel1.TabIndex = 19;
stackPanel1.Text = "stackPanel1";
//
// button_cancel
//
button_cancel.BorderWidth = 1F;
button_cancel.Font = new Font("Microsoft YaHei UI", 9F);
button_cancel.Ghost = true;
button_cancel.Location = new Point(84, 3);
button_cancel.Name = "button_cancel";
button_cancel.Size = new Size(75, 38);
button_cancel.TabIndex = 1;
button_cancel.Text = "取消";
//
// button_ok
//
button_ok.Font = new Font("Microsoft YaHei UI", 9F, FontStyle.Regular, GraphicsUnit.Point, 134);
button_ok.Location = new Point(3, 3);
button_ok.Name = "button_ok";
button_ok.Size = new Size(75, 38);
button_ok.TabIndex = 0;
button_ok.Text = "确定";
button_ok.Type = AntdUI.TTypeMini.Primary;
//
// divider2
//
divider2.Dock = DockStyle.Top;
divider2.Location = new Point(18, 42);
divider2.Name = "divider2";
divider2.Size = new Size(464, 12);
divider2.TabIndex = 18;
//
// label1
//
label1.Dock = DockStyle.Top;
label1.Font = new Font("Microsoft YaHei UI", 12F, FontStyle.Regular, GraphicsUnit.Point, 134);
label1.Location = new Point(18, 18);
label1.Name = "label1";
label1.Size = new Size(464, 24);
label1.TabIndex = 17;
label1.Text = "新增运动控制操作";
//
// label2
//
label2.Dock = DockStyle.Top;
label2.Font = new Font("Microsoft YaHei UI", 12F, FontStyle.Regular, GraphicsUnit.Point, 134);
label2.Location = new Point(18, 184);
label2.Name = "label2";
label2.Size = new Size(464, 24);
label2.TabIndex = 24;
label2.Text = "运动控制类型";
//
// divider3
//
divider3.Dock = DockStyle.Top;
divider3.Location = new Point(18, 172);
divider3.Name = "divider3";
divider3.Size = new Size(464, 12);
divider3.TabIndex = 23;
//
// select_type
//
select_type.Dock = DockStyle.Top;
select_type.Location = new Point(18, 208);
select_type.Name = "select_type";
select_type.Size = new Size(464, 37);
select_type.TabIndex = 25;
//
// AddMotionControl
//
Controls.Add(panel1);
Name = "AddMotionControl";
Size = new Size(500, 260);
panel1.ResumeLayout(false);
stackPanel1.ResumeLayout(false);
ResumeLayout(false);
}
#endregion
private AntdUI.Panel panel1;
private AntdUI.Label label1;
private AntdUI.Input input_name;
private AntdUI.Label label3;
private AntdUI.Divider divider1;
private AntdUI.StackPanel stackPanel1;
private AntdUI.Button button_cancel;
private AntdUI.Button button_ok;
private AntdUI.Divider divider2;
private AntdUI.Select select_type;
private AntdUI.Label label2;
private AntdUI.Divider divider3;
}
}

View File

@ -1,49 +0,0 @@

namespace DHSoftware.Views
{
public partial class AddMotionControl : UserControl
{
private AntdUI.Window window;
public bool submit;
public string MotionName;
public string MotionType;
public AddMotionControl(AntdUI.Window _window)
{
this.window = _window;
InitializeComponent();
// 绑定事件
BindEventHandler();
}
private void BindEventHandler()
{
button_ok.Click += Button_ok_Click;
button_cancel.Click += Button_cancel_Click;
}
private void Button_cancel_Click(object sender, EventArgs e)
{
submit = false;
this.Dispose();
}
private void Button_ok_Click(object sender, EventArgs e)
{
input_name.Status = AntdUI.TType.None;
//检查输入内容
if (String.IsNullOrEmpty(input_name.Text))
{
input_name.Status = AntdUI.TType.Error;
AntdUI.Message.warn(window, "运动控制名称不能为空!", autoClose: 3);
return;
}
MotionName = input_name.Text;
MotionType = select_type.Text;
submit = true;
this.Dispose();
}
}
}

View File

@ -1,120 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<root>
<!--
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
associated with the data types.
Example:
... ado.net/XML headers & schema ...
<resheader name="resmimetype">text/microsoft-resx</resheader>
<resheader name="version">2.0</resheader>
<resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
<resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
<data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data>
<data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
<data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
<value>[base64 mime encoded serialized .NET Framework object]</value>
</data>
<data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
<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
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
mimetype set.
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
read any of the formats listed below.
mimetype: application/x-microsoft.net.object.binary.base64
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
: 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
: using a System.ComponentModel.TypeConverter
: and then encoded with base64 encoding.
-->
<xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
<xsd:import namespace="http://www.w3.org/XML/1998/namespace" />
<xsd:element name="root" msdata:IsDataSet="true">
<xsd:complexType>
<xsd:choice maxOccurs="unbounded">
<xsd:element name="metadata">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" />
</xsd:sequence>
<xsd:attribute name="name" use="required" type="xsd:string" />
<xsd:attribute name="type" type="xsd:string" />
<xsd:attribute name="mimetype" type="xsd:string" />
<xsd:attribute ref="xml:space" />
</xsd:complexType>
</xsd:element>
<xsd:element name="assembly">
<xsd:complexType>
<xsd:attribute name="alias" type="xsd:string" />
<xsd:attribute name="name" type="xsd:string" />
</xsd:complexType>
</xsd:element>
<xsd:element name="data">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
<xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" use="required" msdata:Ordinal="1" />
<xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
<xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
<xsd:attribute ref="xml:space" />
</xsd:complexType>
</xsd:element>
<xsd:element name="resheader">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" use="required" />
</xsd:complexType>
</xsd:element>
</xsd:choice>
</xsd:complexType>
</xsd:element>
</xsd:schema>
<resheader name="resmimetype">
<value>text/microsoft-resx</value>
</resheader>
<resheader name="version">
<value>2.0</value>
</resheader>
<resheader name="reader">
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
<resheader name="writer">
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
</root>

View File

@ -4,14 +4,14 @@
{
/// <summary>
/// 必需的设计器变量
/// 必需的设计器变量
/// </summary>
private System.ComponentModel.IContainer components = null;
/// <summary>
/// 清理所有正在使用的资源
/// 清理所有正在使用的资源
/// </summary>
/// <param name="disposing">如果应释放托管资源,为 true否则为 false</param>
/// <param name="disposing">如果应释放托管资源,为 true否则为 false </param>
protected override void Dispose(bool disposing)
{
if (disposing && (components != null))
@ -25,7 +25,7 @@
/// <summary>
/// 设计器支持所需的方法 - 不要修改
/// 使用代码编辑器修改此方法的内容
/// 使用代码编辑器修改此方法的内容
/// </summary>
private void InitializeComponent()
{

View File

@ -3,14 +3,14 @@
partial class CameraConfigControl
{
/// <summary>
/// 必需的设计器变量
/// 必需的设计器变量
/// </summary>
private System.ComponentModel.IContainer components = null;
/// <summary>
/// 清理所有正在使用的资源
/// 清理所有正在使用的资源
/// </summary>
/// <param name="disposing">如果应释放托管资源,为 true否则为 false</param>
/// <param name="disposing">如果应释放托管资源,为 true否则为 false </param>
protected override void Dispose(bool disposing)
{
if (disposing && (components != null))
@ -24,7 +24,7 @@
/// <summary>
/// 设计器支持所需的方法 - 不要修改
/// 使用代码编辑器修改此方法的内容
/// 使用代码编辑器修改此方法的内容
/// </summary>
private void InitializeComponent()
{

View File

@ -1,313 +0,0 @@
namespace DHSoftware.Views
{
partial class CameraControl
{
/// <summary>
/// 必需的设计器变量。
/// </summary>
private System.ComponentModel.IContainer components = null;
/// <summary>
/// 清理所有正在使用的资源。
/// </summary>
/// <param name="disposing">如果应释放托管资源,为 true否则为 false。</param>
protected override void Dispose(bool disposing)
{
if (disposing && (components != null))
{
components.Dispose();
}
base.Dispose(disposing);
}
#region
/// <summary>
/// 设计器支持所需的方法 - 不要修改
/// 使用代码编辑器修改此方法的内容。
/// </summary>
private void InitializeComponent()
{
swhEnable = new AntdUI.Switch();
label18 = new AntdUI.Label();
label1 = new AntdUI.Label();
label2 = new AntdUI.Label();
label3 = new AntdUI.Label();
iptExposure = new AntdUI.InputNumber();
iptGain = new AntdUI.InputNumber();
iptRevolve = new AntdUI.InputNumber();
label4 = new AntdUI.Label();
sltAcquisitionMode = new AntdUI.Select();
label5 = new AntdUI.Label();
sltTriggerMode = new AntdUI.Select();
label7 = new AntdUI.Label();
iptROIW = new AntdUI.InputNumber();
iptROIY = new AntdUI.InputNumber();
iptROIX = new AntdUI.InputNumber();
iptROIH = new AntdUI.InputNumber();
pictureBox1 = new PictureBox();
btnSizeAdd = new AntdUI.Button();
button1 = new AntdUI.Button();
button2 = new AntdUI.Button();
button3 = new AntdUI.Button();
((System.ComponentModel.ISupportInitialize)pictureBox1).BeginInit();
SuspendLayout();
//
// swhEnable
//
swhEnable.CheckedText = "启用";
swhEnable.Location = new Point(84, 13);
swhEnable.Name = "swhEnable";
swhEnable.Size = new Size(93, 33);
swhEnable.TabIndex = 13;
swhEnable.UnCheckedText = "关闭";
//
// label18
//
label18.Location = new Point(28, 23);
label18.Name = "label18";
label18.Size = new Size(59, 23);
label18.TabIndex = 12;
label18.Text = "状 态";
//
// label1
//
label1.Location = new Point(28, 71);
label1.Name = "label1";
label1.Size = new Size(59, 23);
label1.TabIndex = 14;
label1.Text = "曝 光";
//
// label2
//
label2.Location = new Point(28, 113);
label2.Name = "label2";
label2.Size = new Size(59, 23);
label2.TabIndex = 15;
label2.Text = "增 益";
//
// label3
//
label3.Location = new Point(28, 155);
label3.Name = "label3";
label3.Size = new Size(59, 23);
label3.TabIndex = 16;
label3.Text = "旋转角度";
//
// iptExposure
//
iptExposure.Location = new Point(84, 57);
iptExposure.Name = "iptExposure";
iptExposure.Size = new Size(93, 37);
iptExposure.TabIndex = 17;
iptExposure.Tag = "";
iptExposure.Text = "0";
//
// iptGain
//
iptGain.Location = new Point(84, 100);
iptGain.Name = "iptGain";
iptGain.Size = new Size(93, 37);
iptGain.TabIndex = 18;
iptGain.Text = "0";
//
// iptRevolve
//
iptRevolve.Location = new Point(84, 143);
iptRevolve.Name = "iptRevolve";
iptRevolve.Size = new Size(93, 37);
iptRevolve.TabIndex = 19;
iptRevolve.Text = "0";
//
// label4
//
label4.Location = new Point(28, 199);
label4.Name = "label4";
label4.Size = new Size(59, 23);
label4.TabIndex = 20;
label4.Text = "采图模式";
//
// sltAcquisitionMode
//
sltAcquisitionMode.List = true;
sltAcquisitionMode.Location = new Point(84, 186);
sltAcquisitionMode.Name = "sltAcquisitionMode";
sltAcquisitionMode.Size = new Size(93, 36);
sltAcquisitionMode.TabIndex = 21;
//
// label5
//
label5.Location = new Point(28, 244);
label5.Name = "label5";
label5.Size = new Size(59, 23);
label5.TabIndex = 22;
label5.Text = "触发模式";
//
// sltTriggerMode
//
sltTriggerMode.List = true;
sltTriggerMode.Location = new Point(84, 231);
sltTriggerMode.Name = "sltTriggerMode";
sltTriggerMode.Size = new Size(93, 36);
sltTriggerMode.TabIndex = 26;
//
// label7
//
label7.Location = new Point(28, 354);
label7.Name = "label7";
label7.Size = new Size(59, 23);
label7.TabIndex = 28;
label7.Text = "ROI范围";
//
// iptROIW
//
iptROIW.Location = new Point(84, 371);
iptROIW.Name = "iptROIW";
iptROIW.Size = new Size(93, 37);
iptROIW.TabIndex = 31;
iptROIW.Text = "0";
//
// iptROIY
//
iptROIY.Location = new Point(84, 328);
iptROIY.Name = "iptROIY";
iptROIY.Size = new Size(93, 37);
iptROIY.TabIndex = 30;
iptROIY.Text = "0";
//
// iptROIX
//
iptROIX.Location = new Point(84, 285);
iptROIX.Name = "iptROIX";
iptROIX.Size = new Size(93, 37);
iptROIX.TabIndex = 29;
iptROIX.Tag = "";
iptROIX.Text = "0";
//
// iptROIH
//
iptROIH.Location = new Point(84, 414);
iptROIH.Name = "iptROIH";
iptROIH.Size = new Size(93, 37);
iptROIH.TabIndex = 32;
iptROIH.Text = "0";
//
// pictureBox1
//
pictureBox1.BorderStyle = BorderStyle.FixedSingle;
pictureBox1.Location = new Point(219, 23);
pictureBox1.Name = "pictureBox1";
pictureBox1.Size = new Size(659, 429);
pictureBox1.TabIndex = 33;
pictureBox1.TabStop = false;
//
// btnSizeAdd
//
btnSizeAdd.BorderWidth = 2F;
btnSizeAdd.Font = new Font("Microsoft YaHei UI", 9F, FontStyle.Regular, GraphicsUnit.Point, 134);
btnSizeAdd.Ghost = true;
btnSizeAdd.IconRatio = 0F;
btnSizeAdd.IconSvg = "";
btnSizeAdd.Location = new Point(280, 458);
btnSizeAdd.Name = "btnSizeAdd";
btnSizeAdd.Size = new Size(80, 38);
btnSizeAdd.TabIndex = 34;
btnSizeAdd.Text = "连接相机";
//
// button1
//
button1.BorderWidth = 2F;
button1.Font = new Font("Microsoft YaHei UI", 9F, FontStyle.Regular, GraphicsUnit.Point, 134);
button1.Ghost = true;
button1.IconRatio = 0F;
button1.IconSvg = "";
button1.Location = new Point(438, 458);
button1.Name = "button1";
button1.Size = new Size(80, 38);
button1.TabIndex = 35;
button1.Text = "断开相机";
//
// button2
//
button2.BorderWidth = 2F;
button2.Font = new Font("Microsoft YaHei UI", 9F, FontStyle.Regular, GraphicsUnit.Point, 134);
button2.Ghost = true;
button2.IconRatio = 0F;
button2.IconSvg = "";
button2.Location = new Point(593, 458);
button2.Name = "button2";
button2.Size = new Size(80, 38);
button2.TabIndex = 36;
button2.Text = "单次触发";
//
// button3
//
button3.BorderWidth = 2F;
button3.Font = new Font("Microsoft YaHei UI", 9F, FontStyle.Regular, GraphicsUnit.Point, 134);
button3.Ghost = true;
button3.IconRatio = 0F;
button3.IconSvg = "";
button3.Location = new Point(741, 458);
button3.Name = "button3";
button3.Size = new Size(80, 38);
button3.TabIndex = 37;
button3.Text = "连续触发";
//
// CameraControl
//
AutoScaleDimensions = new SizeF(7F, 17F);
AutoScaleMode = AutoScaleMode.Font;
Controls.Add(button3);
Controls.Add(button2);
Controls.Add(button1);
Controls.Add(btnSizeAdd);
Controls.Add(pictureBox1);
Controls.Add(iptROIH);
Controls.Add(iptROIW);
Controls.Add(iptROIY);
Controls.Add(iptROIX);
Controls.Add(label7);
Controls.Add(sltTriggerMode);
Controls.Add(label5);
Controls.Add(sltAcquisitionMode);
Controls.Add(label4);
Controls.Add(iptRevolve);
Controls.Add(iptGain);
Controls.Add(iptExposure);
Controls.Add(label3);
Controls.Add(label2);
Controls.Add(label1);
Controls.Add(swhEnable);
Controls.Add(label18);
Name = "CameraControl";
Size = new Size(909, 505);
((System.ComponentModel.ISupportInitialize)pictureBox1).EndInit();
ResumeLayout(false);
}
#endregion
private AntdUI.Switch swhEnable;
private AntdUI.Label label18;
private AntdUI.Label label1;
private AntdUI.Label label2;
private AntdUI.Label label3;
private AntdUI.InputNumber iptExposure;
private AntdUI.InputNumber iptGain;
private AntdUI.InputNumber iptRevolve;
private AntdUI.Label label4;
private AntdUI.Select sltAcquisitionMode;
private AntdUI.Label label5;
private AntdUI.Select sltTriggerMode;
private AntdUI.Label label7;
private AntdUI.InputNumber iptROIW;
private AntdUI.InputNumber iptROIY;
private AntdUI.InputNumber iptROIX;
private AntdUI.InputNumber iptROIH;
private PictureBox pictureBox1;
private AntdUI.Button btnSizeAdd;
private AntdUI.Button button1;
private AntdUI.Button button2;
private AntdUI.Button button3;
}
}

View File

@ -1,97 +0,0 @@
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
using AntdUI;
using DH.Commons.Enums;
using DH.Devices.Devices;
namespace DHSoftware.Views
{
public partial class CameraControl : UserControl
{
Window window;
CameraBase CameraBase;
public CameraControl(Window _window,CameraBase cameraBase)
{
window= _window;
CameraBase = cameraBase;
InitializeComponent();
InitData();
BindData();
}
private void SltAcquisitionMode_SelectedIndexChanged(object sender, IntEventArgs e)
{
switch (e.Value)
{
case (int)CameraAcquisitionMode.:
sltTriggerMode.Enabled = false;
break;
case (int)CameraAcquisitionMode.:
sltTriggerMode.Enabled = true;
break;
default:
break;
}
}
private void BindData()
{
// 启用状态绑定
swhEnable.DataBindings.Add(nameof(swhEnable.Checked), CameraBase, nameof(CameraBase.IsEnabled),
true, DataSourceUpdateMode.OnPropertyChanged);
// 曝光时间绑定假设iptExposure是NumericUpDown
iptExposure.DataBindings.Add(nameof(iptExposure.Value), CameraBase, nameof(CameraBase.Exposure),
true, DataSourceUpdateMode.OnPropertyChanged, 0M, "N2");
// 增益绑定
iptGain.DataBindings.Add(nameof(iptGain.Value), CameraBase, nameof(CameraBase.Gain),
true, DataSourceUpdateMode.OnPropertyChanged, 0M, "N2");
// 旋转角度绑定
iptRevolve.DataBindings.Add(nameof(iptRevolve.Value), CameraBase, nameof(CameraBase.RotateImage),
true, DataSourceUpdateMode.OnPropertyChanged, 0M, "N2");
// ROI坐标绑定
iptROIX.DataBindings.Add(nameof(iptROIX.Value), CameraBase, nameof(CameraBase.ROIX));
iptROIY.DataBindings.Add(nameof(iptROIY.Value), CameraBase, nameof(CameraBase.ROIY));
iptROIW.DataBindings.Add(nameof(iptROIW.Value), CameraBase, nameof(CameraBase.ROIW));
iptROIH.DataBindings.Add(nameof(iptROIH.Value), CameraBase, nameof(CameraBase.ROIH));
// 采集模式下拉框处理
sltAcquisitionMode.SelectedIndexChanged += (s, e) =>
{
CameraBase.IsContinueMode = sltAcquisitionMode.SelectedIndex == 0;
};
// 触发模式下拉框处理
sltTriggerMode.SelectedIndexChanged += (s, e) =>
{
CameraBase.IsHardwareTrigger = sltTriggerMode.SelectedIndex == 1;
};
}
private void InitData()
{
// 初始化下拉框选项
sltAcquisitionMode.Items.AddRange(new[] { "连续模式", "触发模式" });
sltTriggerMode.Items.AddRange(new[] { "软触发", "硬触发" });
// 设置初始选择
sltAcquisitionMode.SelectedIndex = CameraBase.IsContinueMode ? 0 : 1;
sltTriggerMode.SelectedIndex = CameraBase.IsHardwareTrigger ? 1 : 0;
}
}
}

View File

@ -1,120 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<root>
<!--
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
associated with the data types.
Example:
... ado.net/XML headers & schema ...
<resheader name="resmimetype">text/microsoft-resx</resheader>
<resheader name="version">2.0</resheader>
<resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
<resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
<data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data>
<data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
<data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
<value>[base64 mime encoded serialized .NET Framework object]</value>
</data>
<data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
<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
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
mimetype set.
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
read any of the formats listed below.
mimetype: application/x-microsoft.net.object.binary.base64
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
: 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
: using a System.ComponentModel.TypeConverter
: and then encoded with base64 encoding.
-->
<xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
<xsd:import namespace="http://www.w3.org/XML/1998/namespace" />
<xsd:element name="root" msdata:IsDataSet="true">
<xsd:complexType>
<xsd:choice maxOccurs="unbounded">
<xsd:element name="metadata">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" />
</xsd:sequence>
<xsd:attribute name="name" use="required" type="xsd:string" />
<xsd:attribute name="type" type="xsd:string" />
<xsd:attribute name="mimetype" type="xsd:string" />
<xsd:attribute ref="xml:space" />
</xsd:complexType>
</xsd:element>
<xsd:element name="assembly">
<xsd:complexType>
<xsd:attribute name="alias" type="xsd:string" />
<xsd:attribute name="name" type="xsd:string" />
</xsd:complexType>
</xsd:element>
<xsd:element name="data">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
<xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" use="required" msdata:Ordinal="1" />
<xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
<xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
<xsd:attribute ref="xml:space" />
</xsd:complexType>
</xsd:element>
<xsd:element name="resheader">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" use="required" />
</xsd:complexType>
</xsd:element>
</xsd:choice>
</xsd:complexType>
</xsd:element>
</xsd:schema>
<resheader name="resmimetype">
<value>text/microsoft-resx</value>
</resheader>
<resheader name="version">
<value>2.0</value>
</resheader>
<resheader name="reader">
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
<resheader name="writer">
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
</root>

View File

@ -3,14 +3,14 @@
partial class CorrelatedCameraEdit
{
/// <summary>
/// 必需的设计器变量
/// 必需的设计器变量
/// </summary>
private System.ComponentModel.IContainer components = null;
/// <summary>
/// 清理所有正在使用的资源
/// 清理所有正在使用的资源
/// </summary>
/// <param name="disposing">如果应释放托管资源,为 true否则为 false</param>
/// <param name="disposing">如果应释放托管资源,为 true否则为 false </param>
protected override void Dispose(bool disposing)
{
if (disposing && (components != null))
@ -24,7 +24,7 @@
/// <summary>
/// 设计器支持所需的方法 - 不要修改
/// 使用代码编辑器修改此方法的内容
/// 使用代码编辑器修改此方法的内容
/// </summary>
private void InitializeComponent()
{

View File

@ -3,14 +3,14 @@
partial class CtrlVisionDisplay
{
/// <summary>
/// 必需的设计器变量
/// 必需的设计器变量
/// </summary>
private System.ComponentModel.IContainer components = null;
/// <summary>
/// 清理所有正在使用的资源
/// 清理所有正在使用的资源
/// </summary>
/// <param name="disposing">如果应释放托管资源,为 true否则为 false</param>
/// <param name="disposing">如果应释放托管资源,为 true否则为 false </param>
protected override void Dispose(bool disposing)
{
if (disposing && (components != null))
@ -24,7 +24,7 @@
/// <summary>
/// 设计器支持所需的方法 - 不要修改
/// 使用代码编辑器修改此方法的内容
/// 使用代码编辑器修改此方法的内容
/// </summary>
private void InitializeComponent()
{

View File

@ -4,14 +4,14 @@ namespace XKRS.UI.Device.Winform
partial class CtrlVisionRunBase
{
/// <summary>
/// 必需的设计器变量
/// 必需的设计器变量
/// </summary>
private System.ComponentModel.IContainer components = null;
/// <summary>
/// 清理所有正在使用的资源
/// 清理所有正在使用的资源
/// </summary>
/// <param name="disposing">如果应释放托管资源,为 true否则为 false</param>
/// <param name="disposing">如果应释放托管资源,为 true否则为 false </param>
protected override void Dispose(bool disposing)
{
if (disposing && (components != null))
@ -25,7 +25,7 @@ namespace XKRS.UI.Device.Winform
/// <summary>
/// 设计器支持所需的方法 - 不要修改
/// 使用代码编辑器修改此方法的内容
/// 使用代码编辑器修改此方法的内容
/// </summary>
private void InitializeComponent()
{

View File

@ -3,14 +3,14 @@
partial class DefectRowEdit
{
/// <summary>
/// 必需的设计器变量
/// 必需的设计器变量
/// </summary>
private System.ComponentModel.IContainer components = null;
/// <summary>
/// 清理所有正在使用的资源
/// 清理所有正在使用的资源
/// </summary>
/// <param name="disposing">如果应释放托管资源,为 true否则为 false</param>
/// <param name="disposing">如果应释放托管资源,为 true否则为 false </param>
protected override void Dispose(bool disposing)
{
if (disposing && (components != null))
@ -24,7 +24,7 @@
/// <summary>
/// 设计器支持所需的方法 - 不要修改
/// 使用代码编辑器修改此方法的内容
/// 使用代码编辑器修改此方法的内容
/// </summary>
private void InitializeComponent()
{

View File

@ -3,14 +3,14 @@
partial class DetectConfigControl
{
/// <summary>
/// 必需的设计器变量
/// 必需的设计器变量
/// </summary>
private System.ComponentModel.IContainer components = null;
/// <summary>
/// 清理所有正在使用的资源
/// 清理所有正在使用的资源
/// </summary>
/// <param name="disposing">如果应释放托管资源,为 true否则为 false</param>
/// <param name="disposing">如果应释放托管资源,为 true否则为 false </param>
protected override void Dispose(bool disposing)
{
if (disposing && (components != null))
@ -24,7 +24,7 @@
/// <summary>
/// 设计器支持所需的方法 - 不要修改
/// 使用代码编辑器修改此方法的内容
/// 使用代码编辑器修改此方法的内容
/// </summary>
private void InitializeComponent()
{

View File

@ -3,14 +3,14 @@
partial class DetectControl
{
/// <summary>
/// 必需的设计器变量
/// 必需的设计器变量
/// </summary>
private System.ComponentModel.IContainer components = null;
/// <summary>
/// 清理所有正在使用的资源
/// 清理所有正在使用的资源
/// </summary>
/// <param name="disposing">如果应释放托管资源,为 true否则为 false</param>
/// <param name="disposing">如果应释放托管资源,为 true否则为 false </param>
protected override void Dispose(bool disposing)
{
if (disposing && (components != null))
@ -24,7 +24,7 @@
/// <summary>
/// 设计器支持所需的方法 - 不要修改
/// 使用代码编辑器修改此方法的内容
/// 使用代码编辑器修改此方法的内容
/// </summary>
private void InitializeComponent()
{
@ -41,9 +41,9 @@
preTable = new AntdUI.Table();
label3 = new AntdUI.Label();
btnPath = new AntdUI.Button();
switch1 = new AntdUI.Switch();
swtPre = new AntdUI.Switch();
label2 = new AntdUI.Label();
iptPath = new AntdUI.Input();
iptPrePath = new AntdUI.Input();
label1 = new AntdUI.Label();
tabPage2 = new AntdUI.TabPage();
btnLableDelete = new AntdUI.Button();
@ -59,28 +59,26 @@
label6 = new AntdUI.Label();
switch5 = new AntdUI.Switch();
label12 = new AntdUI.Label();
input1 = new AntdUI.Input();
iptScore = new AntdUI.Input();
label5 = new AntdUI.Label();
flowPanel1 = new AntdUI.FlowPanel();
label11 = new AntdUI.Label();
switch3 = new AntdUI.Switch();
swIsAddStation = new AntdUI.Switch();
label10 = new AntdUI.Label();
stDetectType = new AntdUI.Select();
label9 = new AntdUI.Label();
btnCorrelatedCamera = new AntdUI.Button();
btnPath2 = new AntdUI.Button();
switch2 = new AntdUI.Switch();
swIsEnabled = new AntdUI.Switch();
label7 = new AntdUI.Label();
iptPath2 = new AntdUI.Input();
iptModelPath = new AntdUI.Input();
label8 = new AntdUI.Label();
tabPage3 = new AntdUI.TabPage();
tabPage4 = new AntdUI.TabPage();
switch8 = new AntdUI.Switch();
btnSizeDel = new AntdUI.Button();
btnSizeAdd = new AntdUI.Button();
SizeTable = new AntdUI.Table();
label17 = new AntdUI.Label();
label18 = new AntdUI.Label();
tabs1.SuspendLayout();
tabPage1.SuspendLayout();
tabPage2.SuspendLayout();
@ -98,7 +96,6 @@
tabs1.Pages.Add(tabPage1);
tabs1.Pages.Add(tabPage2);
tabs1.Pages.Add(tabPage3);
tabs1.SelectedIndex = 2;
tabs1.Size = new Size(915, 609);
tabs1.Style = styleLine1;
tabs1.TabIndex = 1;
@ -115,11 +112,11 @@
tabPage1.Controls.Add(preTable);
tabPage1.Controls.Add(label3);
tabPage1.Controls.Add(btnPath);
tabPage1.Controls.Add(switch1);
tabPage1.Controls.Add(swtPre);
tabPage1.Controls.Add(label2);
tabPage1.Controls.Add(iptPath);
tabPage1.Controls.Add(iptPrePath);
tabPage1.Controls.Add(label1);
tabPage1.Location = new Point(-909, -575);
tabPage1.Location = new Point(3, 31);
tabPage1.Name = "tabPage1";
tabPage1.Size = new Size(909, 575);
tabPage1.TabIndex = 0;
@ -222,14 +219,14 @@
btnPath.TabIndex = 7;
btnPath.Text = "打开";
//
// switch1
// swtPre
//
switch1.CheckedText = "启用";
switch1.Location = new Point(207, 33);
switch1.Name = "switch1";
switch1.Size = new Size(82, 33);
switch1.TabIndex = 4;
switch1.UnCheckedText = "关闭";
swtPre.CheckedText = "启用";
swtPre.Location = new Point(207, 33);
swtPre.Name = "swtPre";
swtPre.Size = new Size(82, 33);
swtPre.TabIndex = 4;
swtPre.UnCheckedText = "关闭";
//
// label2
//
@ -239,22 +236,22 @@
label2.TabIndex = 3;
label2.Text = "状 态";
//
// iptPath
// iptPrePath
//
iptPath.Location = new Point(191, 79);
iptPath.Name = "iptPath";
iptPath.PlaceholderText = "请点击打开按钮选择模型路径";
iptPath.ReadOnly = true;
iptPath.Size = new Size(423, 42);
iptPath.TabIndex = 1;
iptPrePath.Location = new Point(191, 79);
iptPrePath.Name = "iptPrePath";
iptPrePath.PlaceholderText = "请点击打开按钮选择预处理路径";
iptPrePath.ReadOnly = true;
iptPrePath.Size = new Size(423, 42);
iptPrePath.TabIndex = 1;
//
// label1
//
label1.Location = new Point(110, 89);
label1.Name = "label1";
label1.Size = new Size(75, 23);
label1.Size = new Size(86, 23);
label1.TabIndex = 0;
label1.Text = "模型路径";
label1.Text = "预处理路径";
//
// tabPage2
//
@ -271,19 +268,19 @@
tabPage2.Controls.Add(label6);
tabPage2.Controls.Add(switch5);
tabPage2.Controls.Add(label12);
tabPage2.Controls.Add(input1);
tabPage2.Controls.Add(iptScore);
tabPage2.Controls.Add(label5);
tabPage2.Controls.Add(flowPanel1);
tabPage2.Controls.Add(label11);
tabPage2.Controls.Add(switch3);
tabPage2.Controls.Add(swIsAddStation);
tabPage2.Controls.Add(label10);
tabPage2.Controls.Add(stDetectType);
tabPage2.Controls.Add(label9);
tabPage2.Controls.Add(btnCorrelatedCamera);
tabPage2.Controls.Add(btnPath2);
tabPage2.Controls.Add(switch2);
tabPage2.Controls.Add(swIsEnabled);
tabPage2.Controls.Add(label7);
tabPage2.Controls.Add(iptPath2);
tabPage2.Controls.Add(iptModelPath);
tabPage2.Controls.Add(label8);
tabPage2.Location = new Point(-909, -575);
tabPage2.Name = "tabPage2";
@ -416,14 +413,13 @@
label12.TabIndex = 36;
label12.Text = "OK原图";
//
// input1
// iptScore
//
input1.Location = new Point(649, 24);
input1.Name = "input1";
input1.PlaceholderText = "";
input1.ReadOnly = true;
input1.Size = new Size(117, 42);
input1.TabIndex = 35;
iptScore.Location = new Point(649, 24);
iptScore.Name = "iptScore";
iptScore.PlaceholderText = "";
iptScore.Size = new Size(117, 42);
iptScore.TabIndex = 35;
//
// label5
//
@ -451,14 +447,14 @@
label11.TabIndex = 32;
label11.Text = "关联相机";
//
// switch3
// swIsAddStation
//
switch3.CheckedText = "启用";
switch3.Location = new Point(270, 26);
switch3.Name = "switch3";
switch3.Size = new Size(82, 33);
switch3.TabIndex = 31;
switch3.UnCheckedText = "关闭";
swIsAddStation.CheckedText = "启用";
swIsAddStation.Location = new Point(270, 26);
swIsAddStation.Name = "swIsAddStation";
swIsAddStation.Size = new Size(82, 33);
swIsAddStation.TabIndex = 31;
swIsAddStation.UnCheckedText = "关闭";
//
// label10
//
@ -512,14 +508,14 @@
btnPath2.TabIndex = 20;
btnPath2.Text = "打开";
//
// switch2
// swIsEnabled
//
switch2.CheckedText = "启用";
switch2.Location = new Point(110, 26);
switch2.Name = "switch2";
switch2.Size = new Size(82, 33);
switch2.TabIndex = 19;
switch2.UnCheckedText = "关闭";
swIsEnabled.CheckedText = "启用";
swIsEnabled.Location = new Point(110, 26);
swIsEnabled.Name = "swIsEnabled";
swIsEnabled.Size = new Size(82, 33);
swIsEnabled.TabIndex = 19;
swIsEnabled.UnCheckedText = "关闭";
//
// label7
//
@ -529,14 +525,14 @@
label7.TabIndex = 18;
label7.Text = "状 态";
//
// iptPath2
// iptModelPath
//
iptPath2.Location = new Point(110, 75);
iptPath2.Name = "iptPath2";
iptPath2.PlaceholderText = "请点击打开按钮选择模型路径";
iptPath2.ReadOnly = true;
iptPath2.Size = new Size(656, 42);
iptPath2.TabIndex = 17;
iptModelPath.Location = new Point(110, 75);
iptModelPath.Name = "iptModelPath";
iptModelPath.PlaceholderText = "请点击打开按钮选择模型路径";
iptModelPath.ReadOnly = true;
iptModelPath.Size = new Size(656, 42);
iptModelPath.TabIndex = 17;
//
// label8
//
@ -549,7 +545,7 @@
// tabPage3
//
tabPage3.Controls.Add(tabPage4);
tabPage3.Location = new Point(3, 31);
tabPage3.Location = new Point(-909, -575);
tabPage3.Name = "tabPage3";
tabPage3.Size = new Size(909, 575);
tabPage3.TabIndex = 3;
@ -557,27 +553,16 @@
//
// tabPage4
//
tabPage4.Controls.Add(switch8);
tabPage4.Controls.Add(btnSizeDel);
tabPage4.Controls.Add(btnSizeAdd);
tabPage4.Controls.Add(SizeTable);
tabPage4.Controls.Add(label17);
tabPage4.Controls.Add(label18);
tabPage4.Location = new Point(8, 8);
tabPage4.Name = "tabPage4";
tabPage4.Size = new Size(909, 575);
tabPage4.TabIndex = 1;
tabPage4.Text = "预处理";
//
// switch8
//
switch8.CheckedText = "启用";
switch8.Location = new Point(120, 33);
switch8.Name = "switch8";
switch8.Size = new Size(82, 33);
switch8.TabIndex = 11;
switch8.UnCheckedText = "关闭";
//
// btnSizeDel
//
btnSizeDel.BorderWidth = 2F;
@ -585,7 +570,7 @@
btnSizeDel.Ghost = true;
btnSizeDel.IconRatio = 0.8F;
btnSizeDel.IconSvg = resources.GetString("btnSizeDel.IconSvg");
btnSizeDel.Location = new Point(747, 192);
btnSizeDel.Location = new Point(775, 192);
btnSizeDel.Name = "btnSizeDel";
btnSizeDel.Size = new Size(80, 38);
btnSizeDel.TabIndex = 10;
@ -598,7 +583,7 @@
btnSizeAdd.Ghost = true;
btnSizeAdd.IconRatio = 0.8F;
btnSizeAdd.IconSvg = resources.GetString("btnSizeAdd.IconSvg");
btnSizeAdd.Location = new Point(747, 148);
btnSizeAdd.Location = new Point(775, 148);
btnSizeAdd.Name = "btnSizeAdd";
btnSizeAdd.Size = new Size(80, 38);
btnSizeAdd.TabIndex = 9;
@ -606,28 +591,21 @@
//
// SizeTable
//
SizeTable.Location = new Point(38, 118);
SizeTable.AutoSizeColumnsMode = AntdUI.ColumnsMode.Fill;
SizeTable.Location = new Point(38, 65);
SizeTable.Name = "SizeTable";
SizeTable.Size = new Size(686, 402);
SizeTable.Size = new Size(705, 455);
SizeTable.TabIndex = 8;
SizeTable.Text = "table1";
//
// label17
//
label17.Location = new Point(38, 89);
label17.Location = new Point(38, 24);
label17.Name = "label17";
label17.Size = new Size(91, 23);
label17.TabIndex = 1;
label17.Text = "配 置";
//
// label18
//
label18.Location = new Point(38, 43);
label18.Name = "label18";
label18.Size = new Size(91, 23);
label18.TabIndex = 3;
label18.Text = "状 态";
//
// DetectControl
//
AutoScaleDimensions = new SizeF(7F, 17F);
@ -635,6 +613,7 @@
Controls.Add(tabs1);
Name = "DetectControl";
Size = new Size(915, 609);
Load += DetectControl_Load;
tabs1.ResumeLayout(false);
tabPage1.ResumeLayout(false);
tabPage2.ResumeLayout(false);
@ -650,9 +629,9 @@
private AntdUI.TabPage tabPage2;
private AntdUI.TabPage tabPage3;
private AntdUI.Label label1;
private AntdUI.Input iptPath;
private AntdUI.Input iptPrePath;
private AntdUI.Label label2;
private AntdUI.Switch switch1;
private AntdUI.Switch swtPre;
private AntdUI.Button btnPath;
private AntdUI.Label label3;
private AntdUI.Button btnPreDelete;
@ -664,18 +643,18 @@
private AntdUI.Table PreOutTable;
private AntdUI.Button btnCorrelatedCamera;
private AntdUI.Button btnPath2;
private AntdUI.Switch switch2;
private AntdUI.Switch swIsEnabled;
private AntdUI.Label label7;
private AntdUI.Input iptPath2;
private AntdUI.Input iptModelPath;
private AntdUI.Label label8;
private AntdUI.Select stDetectType;
private AntdUI.Label label9;
private AntdUI.Switch switch3;
private AntdUI.Switch swIsAddStation;
private AntdUI.Label label10;
private AntdUI.Label label11;
private AntdUI.FlowPanel flowPanel1;
private AntdUI.Label label5;
private AntdUI.Input input1;
private AntdUI.Input iptScore;
private AntdUI.Switch switch4;
private AntdUI.Label label6;
private AntdUI.Switch switch5;
@ -694,7 +673,5 @@
private AntdUI.Button btnSizeAdd;
private AntdUI.Table SizeTable;
private AntdUI.Label label17;
private AntdUI.Label label18;
private AntdUI.Switch switch8;
}
}

View File

@ -21,16 +21,198 @@ namespace DHSoftware.Views
public partial class DetectControl : UserControl
{
Window window;
// DetectionConfig detectionConfig;
private DetectionConfig _config;
List<RelatedCamera> relatedCameras = new List<RelatedCamera>();
AntList<PreTreatParam> PreTreatList;
AntList<PreTreatParam> PreOutTreatList;
AntList<DetectionLable> DetectionLableList;
AntList<SizeTreatParam> SizeLableList;
PreTreatParam curPreTreat;
PreTreatParam curPreOutTreat;
DetectionLable curDetectionLable;
SizeTreatParam SizeParamLable;
public DetectionConfig detectionConfig
{
get => _config;
set
{
if (_config != null)
{
_config.PropertyChanged -= Config_PropertyChanged; // 解绑旧的
}
_config = value;
if (_config != null)
{
_config.PropertyChanged += Config_PropertyChanged; // 绑定新的
UpdateUI(); // 初始化 UI
}
}
}
private void Config_PropertyChanged(object sender, PropertyChangedEventArgs e)
{
// 监听所有属性变化
switch (e.PropertyName)
{
case nameof(DetectionConfig.IsAddStation):
swIsAddStation.Checked = _config.IsAddStation;
break;
case nameof(DetectionConfig.IsEnabled):
swIsEnabled.Checked = _config.IsEnabled;
break;
case nameof(DetectionConfig.ModelType):
stDetectType.SelectedIndex = (int)_config.ModelType-1;
break;
case nameof(DetectionConfig.ModelconfThreshold):
if (iptScore.InvokeRequired)
{
iptScore.Invoke(() => iptScore.Text = _config.ModelconfThreshold.ToString());
}
else
{
iptScore.Text = _config.ModelconfThreshold.ToString();
}
break;
case nameof(DetectionConfig.PreTreatCollects):
break;
}
}
private void UpdateUI()
{
if (_config == null) return;
swIsAddStation.Checked = _config.IsAddStation;
swIsEnabled.Checked = _config.IsEnabled;
stDetectType.SelectedIndex = (int)_config.ModelType - 1;
iptScore.Text = _config.ModelconfThreshold.ToString();
iptModelPath.Text = _config.ModelPath;
swtPre.Checked = _config.IsPreEnabled;
iptPrePath.Text = _config.HalconAlgorithemPath_Pre;
// textBoxName.Text = _config.Name;
// checkBoxEnableGPU.Checked = _config.IsEnableGPU;
}
public DetectControl(Window _window)
{
window = _window;
InitializeComponent();
//this.detectionConfig = detectionConfig;
//初始化表格列头
InitTableColumns();
InitData();
BindEventHandler();
}
foreach (var item in MLModelTypes)
{
stDetectType.Items.Add(item.Key);
}
BindEventHandler();
// 如果你的控件是通过设计器生成的,确保事件已经在设计器文件中绑定。
swtPre.CheckedChanged += swtPre_CheckedChanged; // 确保控件的事件处理器被注册
swIsAddStation.CheckedChanged += swIsAddStation_CheckedChanged; // 确保控件的事件处理器被注册
swIsEnabled.CheckedChanged += swIsEnabled_CheckedChanged; // 确保控件的事件处理器被注册
stDetectType.SelectedIndexChanged += stDetectType_SelectedIndexChanged; // 确保控件的事件处理器被注册
iptScore.TextChanged += IptScore_TextChanged;
iptModelPath.TextChanged += IptModelPath_TextChanged;
}
private void IptScore_TextChanged(object sender, EventArgs e)
{
if (_config != null && !string.IsNullOrEmpty(iptScore.Text))
{
if (float.TryParse(iptScore.Text, out float score) && _config.ModelconfThreshold != score)
{
_config.ModelconfThreshold = score;
}
else
{
iptScore.Text = _config.ModelconfThreshold.ToString();
}
}
}
private void IptModelPath_TextChanged(object sender, EventArgs e)
{
if (_config != null && !string.IsNullOrEmpty(iptModelPath.Text))
{
if ( _config.ModelPath != iptModelPath.Text)
{
_config.ModelPath = iptModelPath.Text;
}
else
{
iptModelPath.Text = _config.ModelPath;
}
}
}
private void stDetectType_SelectedIndexChanged(object sender, EventArgs e)
{
// 下拉选项变更事件处理
if (_config != null && stDetectType.SelectedIndex != -1)
{
// 防止循环更新
if ((int)_config.ModelType != stDetectType.SelectedIndex + 1)
{
_config.ModelType = (MLModelType)(stDetectType.SelectedIndex + 1);
}
}
}
private void swtPre_CheckedChanged(object sender, EventArgs e)
{
// 当用户改变控件的值时,更新数据模型的属性
if (_config != null)
{
_config.IsPreEnabled = swtPre.Checked;
}
}
private void swIsAddStation_CheckedChanged(object sender, EventArgs e)
{
// 当用户改变控件的值时,更新数据模型的属性
if (_config != null)
{
_config.IsAddStation = swIsAddStation.Checked;
}
}
private void swIsEnabled_CheckedChanged(object sender, EventArgs e)
{
// 当用户改变控件的值时,更新数据模型的属性
if (_config != null)
{
_config.IsEnabled = swIsEnabled.Checked;
}
}
/// <summary>
/// 更新尺寸测量表格
/// </summary>
private void UpdatePreTreatCollectsFromSizeTable()
{
// 假设 SizeLableList 是 SizeTable 的数据源
List<SizeTreatParam> updatedPreTreatCollects = new List<SizeTreatParam>();
foreach (var sizeTreat in SizeLableList)
{
var preTreatCollect = new SizeTreatParam
{
IsEnable = sizeTreat.IsEnable,
PreName = sizeTreat.PreName,
PrePix = sizeTreat.PrePix,
PreType = sizeTreat.PreType,
ResultShow = sizeTreat.ResultShow,
OutResultShow = sizeTreat.OutResultShow
};
updatedPreTreatCollects.Add(preTreatCollect);
}
// 将更新后的数据设置到 PreTreatCollects
detectionConfig.PreTreatCollects = updatedPreTreatCollects;
}
private void BindEventHandler()
{
//预处理
@ -46,6 +228,9 @@ namespace DHSoftware.Views
//中处理
btnPath2.Click += BtnPath2_Click;
btnCorrelatedCamera.Click += BtnCorrelatedCamera_Click;
btnPic.Click += BtnPic_Click;
btnLableAdd.Click += BtnLableAdd_Click;
btnLableDelete.Click += BtnLableDelete_Click;
@ -113,6 +298,8 @@ namespace DHSoftware.Views
OnClose = () =>
{
AntdUI.Message.info(window, "结束编辑", autoClose: 1);
UpdatePreTreatCollectsFromSizeTable();
}
});
break;
@ -120,6 +307,7 @@ namespace DHSoftware.Views
var result = Modal.open(window, "删除警告!", "确认要删除选择的数据吗?", TType.Warn);
if (result == DialogResult.OK)
SizeLableList.Remove(sizeTreat);
UpdatePreTreatCollectsFromSizeTable();
break;
case "进行测量":
var sizeType = ((int)SizeParamLable.PreType).ToString();
@ -150,7 +338,7 @@ namespace DHSoftware.Views
MessageBox.Show("未定义的测量类型!");
break;
}
UpdatePreTreatCollectsFromSizeTable();
//使用clone可以防止table中的image被修改
//Preview.open(new Preview.Config(window, (Image)SizeParamLable.CellImages[0].Image.Clone()));
break;
@ -237,7 +425,7 @@ namespace DHSoftware.Views
//CellBadge = new CellBadge(SizeEnum.Circle.GetEnumDescription()),
CellLinks = new CellLink[] {
new CellButton(Guid.NewGuid().ToString(),"编辑",TTypeMini.Primary),
new CellButton(Guid.NewGuid().ToString(),"删除",TTypeMini.Error),
new CellButton(Guid.NewGuid().ToString(),"进行测量",TTypeMini.Primary)
}
@ -260,7 +448,7 @@ namespace DHSoftware.Views
}
List<RelatedCamera> relatedCameras = new List<RelatedCamera>();
private void BtnCorrelatedCamera_Click(object? sender, EventArgs e)
{
@ -274,37 +462,8 @@ namespace DHSoftware.Views
if (form.submit)
{
flowPanel1.Controls.Clear();
if (relatedCameras.Count > 0)
{
foreach (var item in relatedCameras)
{
var control = new AntdUI.Tag()
{
Font = new System.Drawing.Font("Microsoft YaHei UI", 9F),
Size = new Size(90, 42),
Text = item.CameraSourceId,
CloseIcon = true
};
control.CloseChanged += (sender, e) =>
{
var tag = sender as Tag;
foreach (var item in relatedCameras)
{
if (item.CameraSourceId.Equals(tag.Text))
{
relatedCameras.Remove(item);
break;
}
}
return true;
};
// 通过主窗口设置DPI控制添加控件保持缩放比例
window.AutoDpi(control);
flowPanel1.Controls.Add(control);
control.BringToFront();
}
}
InitRelatedCamera();
detectionConfig.CameraCollects=relatedCameras;
}
}
@ -329,8 +488,8 @@ namespace DHSoftware.Views
{
string filePath = openFileDialog.FileName;
iptPath2.Text = filePath;
iptModelPath.Text = filePath;
_config.ModelPath = filePath;
}
}
}
@ -398,7 +557,7 @@ namespace DHSoftware.Views
{
PreTreatParam preParam = new PreTreatParam()
{
CellLinks = new CellLink[] {
new CellButton(Guid.NewGuid().ToString(),"编辑",TTypeMini.Primary),
new CellButton(Guid.NewGuid().ToString(),"删除",TTypeMini.Error),
@ -500,37 +659,112 @@ namespace DHSoftware.Views
}
}
AntList<PreTreatParam> PreTreatList;
AntList<PreTreatParam> PreOutTreatList;
AntList<DetectionLable> DetectionLableList;
AntList<SizeTreatParam> SizeLableList;
PreTreatParam curPreTreat;
PreTreatParam curPreOutTreat;
DetectionLable curDetectionLable;
SizeTreatParam SizeParamLable;
//加载相机
private void InitRelatedCamera()
{
if (relatedCameras.Count > 0)
{
foreach (var item in relatedCameras)
{
var control = new AntdUI.Tag()
{
Font = new System.Drawing.Font("Microsoft YaHei UI", 9F),
Size = new Size(90, 42),
Text = item.CameraSourceId,
CloseIcon = true
};
control.CloseChanged += (sender, e) =>
{
var tag = sender as Tag;
foreach (var item in relatedCameras)
{
if (item.CameraSourceId.Equals(tag.Text))
{
relatedCameras.Remove(item);
break;
}
}
detectionConfig.CameraCollects = relatedCameras;
return true;
};
// 通过主窗口设置DPI控制添加控件保持缩放比例
window.AutoDpi(control);
flowPanel1.Controls.Add(control);
control.BringToFront();
}
}
}
private void InitData()
{
PreTreatList = new AntList<PreTreatParam>();
relatedCameras = detectionConfig.CameraCollects;
InitRelatedCamera();
// swIsAddStation. = detectionConfig.IsAddStation;
PreTreatList = new AntList<PreTreatParam>();
foreach (var item in detectionConfig.PreTreatParams)
{
PreTreatParam lable = item;
lable.CellLinks = new CellLink[] {
new CellButton(Guid.NewGuid().ToString(),"编辑",TTypeMini.Primary),
new CellButton(Guid.NewGuid().ToString(),"删除",TTypeMini.Error),
};
PreTreatList.Add(lable);
}
preTable.Binding(PreTreatList);
PreOutTreatList = new AntList<PreTreatParam>();
foreach (var item in detectionConfig.OUTPreTreatParams)
{
PreTreatParam lable = item;
lable.CellLinks = new CellLink[] {
new CellButton(Guid.NewGuid().ToString(),"编辑",TTypeMini.Primary),
new CellButton(Guid.NewGuid().ToString(),"删除",TTypeMini.Error),
};
PreOutTreatList.Add(lable);
}
PreOutTable.Binding(PreOutTreatList);
foreach (var item in MLModelTypes)
DetectionLableList = new AntList<DetectionLable>();
foreach (var item in detectionConfig.DetectionLableList)
{
stDetectType.Items.Add(item.Key);
DetectionLable lable = item;
lable.CellLinks = new CellLink[] {
new CellButton(Guid.NewGuid().ToString(),"编辑",TTypeMini.Primary),
new CellButton(Guid.NewGuid().ToString(),"删除",TTypeMini.Error),
};
DetectionLableList.Add(lable);
}
DetectionLableList = new AntList<DetectionLable>();
lableTable.Binding(DetectionLableList);
SizeLableList = new AntList<SizeTreatParam>();
// SizeLableList = new AntList<SizeTreatParam>(_config.PreTreatCollects);
foreach (var item in _config.PreTreatCollects)
{
item.CellLinks = new CellLink[] {
new CellButton(Guid.NewGuid().ToString(),"编辑",TTypeMini.Primary),
new CellButton(Guid.NewGuid().ToString(),"删除",TTypeMini.Error),
new CellButton(Guid.NewGuid().ToString(),"进行测量",TTypeMini.Primary)
};
// SizeLableList.Add(item);
}
// 将 List<PreTreatCollect> 转换为 AntList<PreTreatCollect>
SizeLableList = new AntList<SizeTreatParam>(_config.PreTreatCollects);
// 绑定转换后的数据到 SizeTable
SizeTable.Binding(SizeLableList);
//SizeTable.Binding(_config.PreTreatCollects);
}
@ -564,14 +798,16 @@ namespace DHSoftware.Views
SizeTable.Columns = new ColumnCollection() {
new ColumnCheck("Selected"){Fixed = true},
new ColumnSwitch("IsEnable", "是否启用", ColumnAlign.Center),
new Column("PreName", "测量名称",ColumnAlign.Center),
new Column("PreType", "测量类型", ColumnAlign.Center),
new Column("PrePix", "阈值", ColumnAlign.Center),
new Column("ResultShow", "输入参数", ColumnAlign.Center),
new Column("OutResultShow", "输出参数", ColumnAlign.Center),
new Column("CellLinks", "操作", ColumnAlign.Center)
new ColumnSwitch("IsEnable", "是否启用") {Width = "10%" },
new Column("PreName", "测量名称") { Width = "15%" },
new Column("PreType", "测量类型") { Width = "10%" },
new Column("PrePix", "阈值") { Width = "5%" },
new Column("ResultShow", "输入参数") { Width = "15%" },
new Column("OutResultShow", "输出参数") { Width = "15%" },
new Column("CellLinks", "操作") { Width = "30%" }
};
}
private void btnPath_Click(object? sender, EventArgs e)
@ -590,7 +826,7 @@ namespace DHSoftware.Views
{
string filePath = openFileDialog.FileName;
iptPath.Text = filePath;
iptPrePath.Text = filePath;
}
}
@ -608,6 +844,12 @@ namespace DHSoftware.Views
}
private void DetectControl_Load(object sender, EventArgs e)
{
InitData();
}
public static List<KeyValuePair<string, int>> GetFilteredEnumDescriptionsAndValues<T>() where T : Enum
{
return Enum.GetValues(typeof(T))

View File

@ -3,14 +3,14 @@
partial class DetectionLableEdit
{
/// <summary>
/// 必需的设计器变量
/// 必需的设计器变量
/// </summary>
private System.ComponentModel.IContainer components = null;
/// <summary>
/// 清理所有正在使用的资源
/// 清理所有正在使用的资源
/// </summary>
/// <param name="disposing">如果应释放托管资源,为 true否则为 false</param>
/// <param name="disposing">如果应释放托管资源,为 true否则为 false </param>
protected override void Dispose(bool disposing)
{
if (disposing && (components != null))
@ -24,7 +24,7 @@
/// <summary>
/// 设计器支持所需的方法 - 不要修改
/// 使用代码编辑器修改此方法的内容
/// 使用代码编辑器修改此方法的内容
/// </summary>
private void InitializeComponent()
{

View File

@ -3,14 +3,14 @@
partial class PreTreatEdit
{
/// <summary>
/// 必需的设计器变量
/// 必需的设计器变量
/// </summary>
private System.ComponentModel.IContainer components = null;
/// <summary>
/// 清理所有正在使用的资源
/// 清理所有正在使用的资源
/// </summary>
/// <param name="disposing">如果应释放托管资源,为 true否则为 false</param>
/// <param name="disposing">如果应释放托管资源,为 true否则为 false </param>
protected override void Dispose(bool disposing)
{
if (disposing && (components != null))
@ -24,7 +24,7 @@
/// <summary>
/// 设计器支持所需的方法 - 不要修改
/// 使用代码编辑器修改此方法的内容
/// 使用代码编辑器修改此方法的内容
/// </summary>
private void InitializeComponent()
{

View File

@ -3,14 +3,14 @@
partial class PreTreatUserControl
{
/// <summary>
/// 必需的设计器变量
/// 必需的设计器变量
/// </summary>
private System.ComponentModel.IContainer components = null;
/// <summary>
/// 清理所有正在使用的资源
/// 清理所有正在使用的资源
/// </summary>
/// <param name="disposing">如果应释放托管资源,为 true否则为 false</param>
/// <param name="disposing">如果应释放托管资源,为 true否则为 false </param>
protected override void Dispose(bool disposing)
{
if (disposing && (components != null))
@ -24,7 +24,7 @@
/// <summary>
/// 设计器支持所需的方法 - 不要修改
/// 使用代码编辑器修改此方法的内容
/// 使用代码编辑器修改此方法的内容
/// </summary>
private void InitializeComponent()
{

View File

@ -57,7 +57,29 @@ namespace DHSoftware.Views
IconSvg = "VideoCameraAddOutlined"
}
};
AntdUI.ContextMenuStrip.open(menu1, it =>
{
if (it.Text == "关联相机")
{
using (var dlg = new AddCameraWindow())
{
if (dlg.ShowDialog() == DialogResult.OK)
{
var newItem = new MenuItem(dlg.CubicleName);
newItem.IconSvg = "VideoCameraOutlined";
//// 防止重复添加
//if (!menu1.Items.Cast<MenuItem>().Any(m => m.Text == newItem.Text))
//{
clickedItem.Sub.Add(newItem);
//}
//else
//{
// AntdUI.Notification.warn(this, "新增失败", $"{dlg.CubicleName}已存在!", autoClose: 3, align: TAlignFrom.TR);
//}
}
}
}
}, menulist);
}
}
}
@ -84,28 +106,23 @@ namespace DHSoftware.Views
private void btnAdd_Click(object sender, EventArgs e)
{
var form = new AddCubicleControl(this) { Size = new Size(400, 300) };
AntdUI.Modal.open(new AntdUI.Modal.Config(this, "", form, TType.None)
using (var dlg = new AddCubicleWindow())
{
BtnHeight = 0,
});
if (form.submit)
{
var newItem = new MenuItem(form.CubicleName);
newItem.IconSvg = "AppstoreOutlined";
// 防止重复添加
if (!menu1.Items.Cast<MenuItem>().Any(m => m.Text == newItem.Text))
if (dlg.ShowDialog() == DialogResult.OK)
{
menu1.Items.Add(newItem);
}
else
{
AntdUI.Notification.warn(this, "新增工位失败", $"{form.CubicleName}已存在!", autoClose: 3, align: TAlignFrom.TR);
var newItem = new MenuItem(dlg.CubicleName);
newItem.IconSvg = "AppstoreOutlined";
// 防止重复添加
if (!menu1.Items.Cast<MenuItem>().Any(m => m.Text == newItem.Text))
{
menu1.Items.Add(newItem);
}
else
{
AntdUI.Notification.warn(this, "新增工位失败", $"{dlg.CubicleName}已存在!", autoClose: 3, align: TAlignFrom.TR);
}
}
}
}
private void menu1_MouseClick(object sender, MouseEventArgs e)

View File

@ -28,15 +28,14 @@
/// </summary>
private void InitializeComponent()
{
AntdUI.MenuItem menuItem4 = new AntdUI.MenuItem();
AntdUI.MenuItem menuItem5 = new AntdUI.MenuItem();
AntdUI.MenuItem menuItem6 = new AntdUI.MenuItem();
AntdUI.Tabs.StyleCard styleCard2 = new AntdUI.Tabs.StyleCard();
AntdUI.MenuItem menuItem1 = new AntdUI.MenuItem();
AntdUI.MenuItem menuItem2 = new AntdUI.MenuItem();
AntdUI.MenuItem menuItem3 = new AntdUI.MenuItem();
AntdUI.Tabs.StyleCard styleCard1 = new AntdUI.Tabs.StyleCard();
pageHeader1 = new AntdUI.PageHeader();
panel1 = new AntdUI.Panel();
panel2 = new AntdUI.StackPanel();
btnSave = new AntdUI.Dropdown();
btnAdd = new AntdUI.Dropdown();
panel2 = new AntdUI.Panel();
btnAdd = new AntdUI.Button();
menu1 = new AntdUI.Menu();
panel3 = new AntdUI.Panel();
tabs1 = new AntdUI.Tabs();
@ -72,62 +71,47 @@
//
// panel2
//
panel2.Back = SystemColors.Window;
panel2.BackColor = SystemColors.Window;
panel2.Controls.Add(btnSave);
panel2.Controls.Add(btnAdd);
panel2.Dock = DockStyle.Fill;
panel2.Location = new Point(0, 632);
panel2.Location = new Point(0, 497);
panel2.Name = "panel2";
panel2.Size = new Size(141, 34);
panel2.Size = new Size(141, 169);
panel2.TabIndex = 1;
panel2.Text = "panel2";
//
// btnSave
//
btnSave.BackActive = SystemColors.Control;
btnSave.BackColor = SystemColors.Control;
btnSave.Dock = DockStyle.Right;
btnSave.Font = new Font("Microsoft YaHei UI", 10.5F, FontStyle.Regular, GraphicsUnit.Point, 134);
btnSave.ForeColor = Color.Black;
btnSave.IconSvg = "SaveOutlined";
btnSave.Location = new Point(72, 3);
btnSave.Name = "btnSave";
btnSave.Size = new Size(63, 28);
btnSave.TabIndex = 2;
btnSave.Text = "保存";
//
// btnAdd
//
btnAdd.BackActive = SystemColors.Control;
btnAdd.BackColor = SystemColors.Control;
btnAdd.Dock = DockStyle.Left;
btnAdd.Font = new Font("Microsoft YaHei UI", 10.5F, FontStyle.Regular, GraphicsUnit.Point, 134);
btnAdd.Dock = DockStyle.Bottom;
btnAdd.ForeColor = Color.Black;
btnAdd.IconRatio = 1F;
btnAdd.IconSvg = "AppstoreAddOutlined";
btnAdd.Location = new Point(3, 3);
btnAdd.Location = new Point(0, 138);
btnAdd.Name = "btnAdd";
btnAdd.Placement = AntdUI.TAlignFrom.TL;
btnAdd.Size = new Size(63, 28);
btnAdd.Size = new Size(141, 31);
btnAdd.TabIndex = 1;
btnAdd.Text = "新增";
btnAdd.Trigger = AntdUI.Trigger.Hover;
btnAdd.Click += btnAdd_Click;
//
// menu1
//
menu1.BackColor = SystemColors.Window;
menu1.Dock = DockStyle.Top;
menuItem4.IconSvg = "VideoCameraOutlined";
menuItem4.Text = "相机设置";
menuItem5.IconSvg = "AppstoreOutlined";
menuItem5.Text = "工位设置";
menuItem6.IconSvg = "ControlOutlined";
menuItem6.Text = "运控设置";
menu1.Items.Add(menuItem4);
menu1.Items.Add(menuItem5);
menu1.Items.Add(menuItem6);
menuItem1.IconSvg = "VideoCameraOutlined";
menuItem1.Text = "相机设置";
menuItem2.IconSvg = "AppstoreOutlined";
menuItem2.ID = "Station";
menuItem2.Text = "工位设置";
menuItem3.IconSvg = "ControlOutlined";
menuItem3.Text = "运控设置";
menu1.Items.Add(menuItem1);
menu1.Items.Add(menuItem2);
menu1.Items.Add(menuItem3);
menu1.Location = new Point(0, 0);
menu1.Name = "menu1";
menu1.Size = new Size(141, 632);
menu1.Size = new Size(141, 497);
menu1.TabIndex = 0;
menu1.Text = "menu1";
menu1.MouseDown += menu1_MouseDown;
@ -152,8 +136,7 @@
tabs1.Location = new Point(151, 33);
tabs1.Name = "tabs1";
tabs1.Size = new Size(891, 666);
styleCard2.Closable = true;
tabs1.Style = styleCard2;
tabs1.Style = styleCard1;
tabs1.TabIndex = 5;
tabs1.Text = "tabs1";
tabs1.Type = AntdUI.TabType.Card;
@ -179,6 +162,7 @@
Name = "SettingWindow1";
StartPosition = FormStartPosition.CenterScreen;
Text = "SettingWinform";
Load += SettingWindow1_Load;
panel1.ResumeLayout(false);
panel2.ResumeLayout(false);
panel3.ResumeLayout(false);
@ -189,12 +173,11 @@
private AntdUI.PageHeader pageHeader1;
private AntdUI.Panel panel1;
private AntdUI.StackPanel panel2;
private AntdUI.Panel panel2;
private AntdUI.Button btnAdd;
private AntdUI.Menu menu1;
private AntdUI.Panel panel3;
private AntdUI.Tabs tabs1;
private AntdUI.Divider divider1;
private AntdUI.Dropdown btnAdd;
private AntdUI.Button btnSave;
}
}

View File

@ -5,139 +5,58 @@ using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Text.Json;
using System.Threading.Tasks;
using System.Windows.Forms;
using AntdUI;
using AntdUI.Svg;
using DH.Commons.Enums;
using DH.Commons.Helper;
using DH.Devices.Devices;
using DH.Devices.PLC;
using DHSoftware.Utils;
using AntdUIDemo.Models;
using DH.Process;
using static System.Windows.Forms.VisualStyles.VisualStyleElement;
using Window = AntdUI.Window;
namespace DHSoftware.Views
{
public partial class SettingWindow1 : Window
{
private UserControl currControl;
List<CameraBase> CameraBaseList = new List<CameraBase>();
List<PLCBase> PLCBaseList = new List<PLCBase>();
List<DetectionConfig> DetectionList = new List<DetectionConfig>();
public SettingWindow1()
ProcessConfigBase DHconfig;
public SettingWindow1(ProcessConfigBase _DHconfig)
{
InitializeComponent();
BindEventHandler();
InitData();
}
private void BindEventHandler()
{
Resize += SettingWindow1_Resize;
btnAdd.SelectedValueChanged += btnAdd_SelectedValueChanged;
btnSave.Click += BtnSave_Click;
}
private float x; //定义当前窗体的宽度
private float y; //定义当前窗体的高度
private void InitData()
{
btnAdd.Items.Clear();
btnAdd.Items.Add("相机设置");
btnAdd.Items.Add("工位设置");
btnAdd.Items.Add("运控设置");
x = Width;
y = Height;
AdaptiveHelper.setTag(this);
// 从文件加载配置
var loadedConfig = ConfigManager.LoadConfig();
if (loadedConfig != null)
DHconfig = _DHconfig;
AntdUI.TooltipComponent tooltip = new AntdUI.TooltipComponent()
{
// 更新当前列表
CameraBaseList = loadedConfig.Cameras;
PLCBaseList = loadedConfig.PLCs;
DetectionList = loadedConfig.Detections;
if (CameraBaseList.Count > 0)
{
var workstationItem = FindMenuItem(menu1.Items, "相机设置");
Font = new Font("Microsoft YaHei UI", 9F, FontStyle.Regular, GraphicsUnit.Point, ((byte)(134))),
};
tooltip.ArrowAlign = AntdUI.TAlign.Right;
tooltip.SetTip(btnAdd, "新增工位");
if (workstationItem != null)
}
private void btnAdd_Click(object sender, EventArgs e)
{
// 查找工位设置项
var workstationItem = FindMenuItem(menu1.Items, "工位设置");
if (workstationItem != null)
{
using (var dlg = new AddCubicleWindow())
{
if (dlg.ShowDialog() == DialogResult.OK)
{
foreach (var item in CameraBaseList)
{
var newItem = new MenuItem();
newItem.Text = item.CameraName;
newItem.IconSvg = "VideoCameraOutlined";
workstationItem.Sub.Add(newItem);
}
AddSubItem(workstationItem, dlg.CubicleName);
}
}
if (DetectionList.Count > 0)
{
var workstationItem = FindMenuItem(menu1.Items, "工位设置");
if (workstationItem != null)
else
{
foreach (var item in DetectionList)
{
var newItem = new MenuItem();
newItem.Text = item.Name;
newItem.IconSvg = "AppstoreOutlined";
workstationItem.Sub.Add(newItem);
}
}
}
if (PLCBaseList.Count > 0)
{
var workstationItem = FindMenuItem(menu1.Items, "运控设置");
if (workstationItem != null)
{
foreach (var item in PLCBaseList)
{
var newItem = new MenuItem();
newItem.Text = item.PLCName;
newItem.IconSvg = "ControlOutlined";
workstationItem.Sub.Add(newItem);
}
AntdUI.Notification.error(this, "操作失败", "未找到工位设置项", TAlignFrom.TR);
}
}
}
}
private void BtnSave_Click(object? sender, EventArgs e)
{
var config = ConfigManager.CreateConfig(CameraBaseList, PLCBaseList, DetectionList);
ConfigManager.SaveConfig(config);
MessageBox.Show("保存成功!");
}
private void SettingWindow1_Resize(object? sender, EventArgs e)
{
var newx = Width / x;
var newy = Height / y;
AdaptiveHelper.setControls(newx, newy, this);
}
// 递归查找菜单项
private MenuItem FindMenuItem(MenuItemCollection items, string targetText)
{
@ -153,196 +72,208 @@ namespace DHSoftware.Views
return null;
}
// 添加子项方法
private void AddSubItem(MenuItem parentItem, string cubicleName)
{
// 创建带图标的菜单项
var newItem = new MenuItem(cubicleName)
{
IconSvg = "AppstoreOutlined",
Tag = Guid.NewGuid() // 添加唯一标识
};
// 检查重复项根据名称和ID
if (!parentItem.Sub.Cast<MenuItem>().Any(m =>
m.Text == cubicleName &&
m.Tag?.ToString() == newItem.Tag.ToString()))
{
parentItem.Sub.Add(newItem);
// 自动展开父项
if (!parentItem.Expand) parentItem.Expand = true;
// 刷新菜单布局
menu1.Invalidate();
}
else
{
AntdUI.Notification.warn(this, "添加失败", "工位名称已存在", TAlignFrom.TR);
}
}
bool isUpdatingTabs = false;
private void InitDecetion()
{
MenuItem clickedItem = menu1.Items[1];
switch (clickedItem.Text)
{
case "相机设置":
break;
case "工位设置":
// 检查是否已存在同名 TabPage
//foreach (var tab in tabs1.Pages)
//{
// if (tab is AntdUI.TabPage existingTab && existingTab.Text == $"{clickedItem.PARENTITEM.Text}-{clickedItem.Text}")
// {
// isUpdatingTabs = true;
// tabs1.SelectedTab = existingTab; // 直接跳转到已存在的 TabPage
// isUpdatingTabs = false;
// currControl = existingTab.Controls.Count > 0 ? existingTab.Controls[0] as UserControl : null;
// return;
// }
//}
foreach (var item in DHconfig.DetectionConfigCollection)
{
AddSubItem(clickedItem, item.Name);
DetectControl control = new DetectControl(this);
control.detectionConfig = item;
if (control != null)
{
//容器添加控件需要调整dpi
control.Dock = DockStyle.Fill;
AutoDpi(control);
AntdUI.TabPage tabPage = new AntdUI.TabPage()
{
Text = $"{clickedItem.Text}-{item.Name}",
};
tabPage.Controls.Add(control);
tabs1.Pages.Add(tabPage);
isUpdatingTabs = true;
tabs1.SelectedTab = tabPage;
isUpdatingTabs = false;
currControl = control;
}
//tabs1.Pages[1].
}
break;
case "运控设置":
break;
}
}
private void LoadMenu(string filter = "")
{
menu1.Items.Clear();
Dictionary<string, List<MenuItems>> Menu_decetion = new Dictionary<string, List<MenuItems>>();
string lang = AntdUI.Localization.CurrentLanguage;
var menuItems = DataUtil.Menu_decetion;
//var menuIcons = DataUtil.MenuIcons_zhcn;
//if (lang.StartsWith("en"))
//{
// menuItems = DataUtil.MenuItems_enus;
// menuIcons = DataUtil.MenuIcons_enus;
//}
foreach (var rootItem in Menu_decetion)
{
var rootKey = rootItem.Key.ToLower();
var rootMenu = new AntdUI.MenuItem
{
Text = rootItem.Key,
//IconSvg = menuIcons.TryGetValue(rootItem.Key, out var icon) ? icon : "UnorderedListOutlined",
};
bool rootVisible = false; // 用于标记是否显示根节点
foreach (var item in rootItem.Value)
{
var childText = item.Text.ToLower();
// 如果子节点包含搜索文本
if (childText.Contains(filter))
{
var menuItem = new AntdUI.MenuItem
{
Text = item.Text,
IconSvg = item.IconSvg,
Tag = item.Tag,
};
rootMenu.Sub.Add(menuItem);
rootVisible = true; // 如果有子节点包含,则显示根节点
}
}
// 如果根节点包含搜索文本,或有可见的子节点,则显示根节点
if (rootKey.Contains(filter) || rootVisible)
{
menu1.Items.Add(rootMenu);
}
}
}
private void menu1_MouseDown(object sender, MouseEventArgs e)
{
// 转换坐标到控件内部坐标系(考虑滚动条)
Point clickPoint = new Point(e.X, e.Y + menu1.ScrollBar.Value);
if (e.Button == MouseButtons.Left)
// 递归查找命中的菜单项
MenuItem clickedItem = FindClickedItem(menu1.Items, clickPoint);
if (clickedItem != null)
{
// 转换坐标到控件内部坐标系(考虑滚动条)
Point clickPoint = new Point(e.X, e.Y + menu1.ScrollBar.Value);
// 递归查找命中的菜单项
MenuItem clickedItem = FindClickedItem(menu1.Items, clickPoint);
if (clickedItem != null)
if (clickedItem.PARENTITEM == null)
{
if (clickedItem.PARENTITEM == null)
{
return;
}
switch (clickedItem.PARENTITEM.Text)
{
case "相机设置":
foreach (var tab in tabs1.Pages)
{
if (tab is AntdUI.TabPage existingTab && existingTab.Text == $"{clickedItem.PARENTITEM.Text}-{clickedItem.Text}")
{
isUpdatingTabs = true;
tabs1.SelectedTab = existingTab; // 直接跳转到已存在的 TabPage
isUpdatingTabs = false;
currControl = existingTab.Controls.Count > 0 ? existingTab.Controls[0] as UserControl : null;
return;
}
}
//先获取是否存在该名称的配置
//如果没有新建项
CameraBase? CameraBase= CameraBaseList.Where(c => c.CameraName == clickedItem.Text).FirstOrDefault();
if (CameraBase == null)
{
CameraBase=new CameraBase();
}
UserControl control = null;
control = new CameraControl(this, CameraBase);
if (control != null)
{
//容器添加控件需要调整dpi
control.Dock = DockStyle.Fill;
AutoDpi(control);
AntdUI.TabPage tabPage = new AntdUI.TabPage()
{
Text = $"{clickedItem.PARENTITEM.Text}-{clickedItem.Text}",
ReadOnly = false,
};
tabPage.Controls.Add(control);
tabs1.Pages.Add(tabPage);
isUpdatingTabs = true;
tabs1.SelectedTab = tabPage;
isUpdatingTabs = false;
currControl = control;
}
break;
case "工位设置":
// 检查是否已存在同名 TabPage
foreach (var tab in tabs1.Pages)
{
if (tab is AntdUI.TabPage existingTab && existingTab.Text == $"{clickedItem.PARENTITEM.Text}-{clickedItem.Text}")
{
isUpdatingTabs = true;
tabs1.SelectedTab = existingTab; // 直接跳转到已存在的 TabPage
isUpdatingTabs = false;
currControl = existingTab.Controls.Count > 0 ? existingTab.Controls[0] as UserControl : null;
return;
}
}
UserControl control1 = null;
control1 = new DetectControl(this);
if (control1 != null)
{
//容器添加控件需要调整dpi
control1.Dock = DockStyle.Fill;
AutoDpi(control1);
AntdUI.TabPage tabPage = new AntdUI.TabPage()
{
Text = $"{clickedItem.PARENTITEM.Text}-{clickedItem.Text}",
ReadOnly = false ,
};
tabPage.Controls.Add(control1);
tabs1.Pages.Add(tabPage);
isUpdatingTabs = true;
tabs1.SelectedTab = tabPage;
isUpdatingTabs = false;
currControl = control1;
}
break;
case "运控设置":
break;
}
return;
}
switch (clickedItem.PARENTITEM.Text)
{
case "相机设置":
break;
case "工位设置":
// 检查是否已存在同名 TabPage
foreach (var tab in tabs1.Pages)
{
if (tab is AntdUI.TabPage existingTab && existingTab.Text == $"{clickedItem.PARENTITEM.Text}-{clickedItem.Text}")
{
isUpdatingTabs = true;
tabs1.SelectedTab = existingTab; // 直接跳转到已存在的 TabPage
isUpdatingTabs = false;
currControl = existingTab.Controls.Count > 0 ? existingTab.Controls[0] as UserControl : null;
return;
}
}
UserControl control = null;
control = new DetectControl(this);
if (control != null)
{
//容器添加控件需要调整dpi
control.Dock = DockStyle.Fill;
AutoDpi(control);
AntdUI.TabPage tabPage = new AntdUI.TabPage()
{
Text = $"{clickedItem.PARENTITEM.Text}-{clickedItem.Text}",
};
tabPage.Controls.Add(control);
tabs1.Pages.Add(tabPage);
isUpdatingTabs = true;
tabs1.SelectedTab = tabPage;
isUpdatingTabs = false;
currControl = control;
}
break;
case "运控设置":
break;
}
}
else if (e.Button == MouseButtons.Right)
{
// 转换坐标到控件内部坐标系(考虑滚动条)
Point clickPoint = new Point(e.X, e.Y + menu1.ScrollBar.Value);
// 递归查找命中的菜单项
MenuItem clickedItem = FindClickedItem(menu1.Items, clickPoint);
if (clickedItem != null)
{
if (clickedItem.PARENTITEM == null)
{
return;
}
switch (clickedItem.PARENTITEM.Text)
{
case "相机设置":
var menulist = new AntdUI.IContextMenuStripItem[]
{
new AntdUI.ContextMenuStripItem("删除相机", "")
{
IconSvg = "DeleteOutlined"
}
};
AntdUI.ContextMenuStrip.open(menu1, it =>
{
menu1.Remove(clickedItem);
foreach (var tab in tabs1.Pages)
{
if (tab is AntdUI.TabPage existingTab && existingTab.Text == $"{clickedItem.PARENTITEM.Text}-{clickedItem.Text}")
{
isUpdatingTabs = true;
tabs1.Pages.Remove(tab);
CameraBaseList.RemoveAll(c => c.CameraName == clickedItem.Text);
isUpdatingTabs = false;
currControl = existingTab.Controls.Count > 0 ? existingTab.Controls[0] as UserControl : null;
return;
}
}
CameraBaseList.RemoveAll(c => c.CameraName == clickedItem.Text);
}, menulist);
break;
case "工位设置":
var menulist1 = new AntdUI.IContextMenuStripItem[]
{
new AntdUI.ContextMenuStripItem("删除工位", "")
{
IconSvg = "DeleteOutlined"
}
};
AntdUI.ContextMenuStrip.open(menu1, it =>
{
menu1.Remove(clickedItem);
foreach (var tab in tabs1.Pages)
{
if (tab is AntdUI.TabPage existingTab && existingTab.Text == $"{clickedItem.PARENTITEM.Text}-{clickedItem.Text}")
{
isUpdatingTabs = true;
//tabs1.SelectedTab = existingTab; // 直接跳转到已存在的 TabPage
tabs1.Pages.Remove(tab);
isUpdatingTabs = false;
currControl = existingTab.Controls.Count > 0 ? existingTab.Controls[0] as UserControl : null;
return;
}
}
}, menulist1);
break;
case "运控设置":
break;
}
}
}
}
@ -366,74 +297,9 @@ namespace DHSoftware.Views
return null;
}
private void btnAdd_SelectedValueChanged(object sender, ObjectNEventArgs e)
private void SettingWindow1_Load(object sender, EventArgs e)
{
string selectedValue = e.Value.ToString();
switch (selectedValue)
{
case "相机设置":
var workstationItem = FindMenuItem(menu1.Items, "相机设置");
if (workstationItem != null)
{
var form = new AddCameraControl(this) { Size = new Size(300, 200) };
AntdUI.Modal.open(new AntdUI.Modal.Config(this, "", form, TType.None)
{
BtnHeight = 0,
});
if (form.submit)
{
var newItem = new MenuItem(form.CubicleName);
newItem.IconSvg = "VideoCameraOutlined";
// 防止重复添加
if (!menu1.Items.Cast<MenuItem>().Any(m => m.Text == newItem.Text))
{
workstationItem.Sub.Add(newItem);
CameraBase cameraBase = new CameraBase();
cameraBase.CameraName = form.CubicleName;
CameraBaseList.Add(cameraBase);
}
else
{
AntdUI.Notification.warn(this, "新增相机失败", $"{form.CubicleName}已存在!", autoClose: 3, align: TAlignFrom.TR);
}
}
}
break;
case "工位设置":
// 查找工位设置项
var workstationItem1= FindMenuItem(menu1.Items, "工位设置");
if (workstationItem1 != null)
{
var form = new AddCubicleControl(this) { Size = new Size(300, 200) };
AntdUI.Modal.open(new AntdUI.Modal.Config(this, "", form, TType.None)
{
BtnHeight = 0,
});
if (form.submit)
{
var newItem = new MenuItem(form.CubicleName);
newItem.IconSvg = "AppstoreOutlined";
// 防止重复添加
if (!menu1.Items.Cast<MenuItem>().Any(m => m.Text == newItem.Text))
{
workstationItem1.Sub.Add(newItem);
}
else
{
AntdUI.Notification.warn(this, "新增工位失败", $"{form.CubicleName}已存在!", autoClose: 3, align: TAlignFrom.TR);
}
}
}
break;
case "运控设置":
break;
}
InitDecetion();
}
}
}

View File

@ -1,7 +1,7 @@
<?xml version="1.0" encoding="utf-8"?>
<root>
<!--
Microsoft ResX Schema
Microsoft ResX Schema
Version 2.0
@ -48,7 +48,7 @@
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
: System.Runtime.Serialization.Formatters.Soap.SoapFormatter

View File

@ -3,14 +3,14 @@
partial class SizeConfigControl
{
/// <summary>
/// 必需的设计器变量
/// 必需的设计器变量
/// </summary>
private System.ComponentModel.IContainer components = null;
/// <summary>
/// 清理所有正在使用的资源
/// 清理所有正在使用的资源
/// </summary>
/// <param name="disposing">如果应释放托管资源,为 true否则为 false</param>
/// <param name="disposing">如果应释放托管资源,为 true否则为 false </param>
protected override void Dispose(bool disposing)
{
if (disposing && (components != null))
@ -24,7 +24,7 @@
/// <summary>
/// 设计器支持所需的方法 - 不要修改
/// 使用代码编辑器修改此方法的内容
/// 使用代码编辑器修改此方法的内容
/// </summary>
private void InitializeComponent()
{

View File

@ -3,14 +3,14 @@
partial class SizeLabelEdit
{
/// <summary>
/// 必需的设计器变量
/// 必需的设计器变量
/// </summary>
private System.ComponentModel.IContainer components = null;
/// <summary>
/// 清理所有正在使用的资源
/// 清理所有正在使用的资源
/// </summary>
/// <param name="disposing">如果应释放托管资源,为 true否则为 false</param>
/// <param name="disposing">如果应释放托管资源,为 true否则为 false </param>
protected override void Dispose(bool disposing)
{
if (disposing && (components != null))
@ -24,7 +24,7 @@
/// <summary>
/// 设计器支持所需的方法 - 不要修改
/// 使用代码编辑器修改此方法的内容
/// 使用代码编辑器修改此方法的内容
/// </summary>
private void InitializeComponent()
{

View File

@ -3,14 +3,14 @@
partial class UserConfigFrm
{
/// <summary>
/// 必需的设计器变量
/// 必需的设计器变量
/// </summary>
private System.ComponentModel.IContainer components = null;
/// <summary>
/// 清理所有正在使用的资源
/// 清理所有正在使用的资源
/// </summary>
/// <param name="disposing">如果应释放托管资源,为 true否则为 false</param>
/// <param name="disposing">如果应释放托管资源,为 true否则为 false </param>
protected override void Dispose(bool disposing)
{
if (disposing && (components != null))
@ -24,7 +24,7 @@
/// <summary>
/// 设计器支持所需的方法 - 不要修改
/// 使用代码编辑器修改此方法的内容
/// 使用代码编辑器修改此方法的内容
/// </summary>
private void InitializeComponent()
{

View File

@ -236,23 +236,23 @@ namespace DHSoftware.Views
private void btnAdd_Click(object sender, EventArgs e)
{
//using (var dlg = new AddCubicleWindow())
//{
// if (dlg.ShowDialog() == DialogResult.OK)
// {
// var newItem = new MenuItem(dlg.CubicleName);
// //newItem.IconSvg = "AppstoreOutlined";
// // 防止重复添加
// if (!menu.Items.Cast<MenuItem>().Any(m => m.Text == newItem.Text))
// {
// menu.Items.Add(newItem);
// }
// else
// {
// // AntdUI.Notification.warn(this, "新增工位失败", $"{dlg.CubicleName}已存在!", autoClose: 3, align: TAlignFrom.TR);
// }
// }
//}
using (var dlg = new AddCubicleWindow())
{
if (dlg.ShowDialog() == DialogResult.OK)
{
var newItem = new MenuItem(dlg.CubicleName);
//newItem.IconSvg = "AppstoreOutlined";
// 防止重复添加
if (!menu.Items.Cast<MenuItem>().Any(m => m.Text == newItem.Text))
{
menu.Items.Add(newItem);
}
else
{
// AntdUI.Notification.warn(this, "新增工位失败", $"{dlg.CubicleName}已存在!", autoClose: 3, align: TAlignFrom.TR);
}
}
}
}
}
}

View File

@ -3,14 +3,14 @@
partial class UserDetetion
{
/// <summary>
/// 必需的设计器变量
/// 必需的设计器变量
/// </summary>
private System.ComponentModel.IContainer components = null;
/// <summary>
/// 清理所有正在使用的资源
/// 清理所有正在使用的资源
/// </summary>
/// <param name="disposing">如果应释放托管资源,为 true否则为 false</param>
/// <param name="disposing">如果应释放托管资源,为 true否则为 false </param>
protected override void Dispose(bool disposing)
{
if (disposing && (components != null))
@ -24,7 +24,7 @@
/// <summary>
/// 设计器支持所需的方法 - 不要修改
/// 使用代码编辑器修改此方法的内容
/// 使用代码编辑器修改此方法的内容
/// </summary>
private void InitializeComponent()
{

View File

@ -3,14 +3,14 @@
partial class _MotionControl
{
/// <summary>
/// 必需的设计器变量
/// 必需的设计器变量
/// </summary>
private System.ComponentModel.IContainer components = null;
/// <summary>
/// 清理所有正在使用的资源
/// 清理所有正在使用的资源
/// </summary>
/// <param name="disposing">如果应释放托管资源,为 true否则为 false</param>
/// <param name="disposing">如果应释放托管资源,为 true否则为 false </param>
protected override void Dispose(bool disposing)
{
if (disposing && (components != null))
@ -24,7 +24,7 @@
/// <summary>
/// 设计器支持所需的方法 - 不要修改
/// 使用代码编辑器修改此方法的内容
/// 使用代码编辑器修改此方法的内容
/// </summary>
private void InitializeComponent()
{

View File

@ -6,15 +6,15 @@
<requestedPrivileges xmlns="urn:schemas-microsoft-com:asm.v3">
<!-- UAC 清单选项
如果想要更改 Windows 用户帐户控制级别,请使用
以下节点之一替换 requestedExecutionLevel 节点
以下节点之一替换 requestedExecutionLevel 节点
<requestedExecutionLevel level="asInvoker" uiAccess="false" />
<requestedExecutionLevel level="requireAdministrator" uiAccess="false" />
<requestedExecutionLevel level="highestAvailable" uiAccess="false" />
指定 requestedExecutionLevel 元素将禁用文件和注册表虚拟化
指定 requestedExecutionLevel 元素将禁用文件和注册表虚拟化
如果你的应用程序需要此虚拟化来实现向后兼容性,则移除此
元素
元素
-->
<requestedExecutionLevel level="asInvoker" uiAccess="false" />
</requestedPrivileges>
@ -24,8 +24,8 @@
<compatibility xmlns="urn:schemas-microsoft-com:compatibility.v1">
<application>
<!-- 设计此应用程序与其一起工作且已针对此应用程序进行测试的
Windows 版本的列表取消评论适当的元素,
Windows 将自动选择最兼容的环境 -->
Windows 版本的列表 取消评论适当的元素,
Windows 将自动选择最兼容的环境 -->
<!-- Windows Vista -->
<!--<supportedOS Id="{e2011457-1546-43c5-a5fe-008deee3d3f0}" />-->
@ -46,11 +46,11 @@
</compatibility>
<!-- 指示该应用程序可感知 DPI 且 Windows 在 DPI 较高时将不会对其进行
自动缩放Windows Presentation Foundation (WPF)应用程序自动感知 DPI无需
选择加入选择加入此设置的 Windows 窗体应用程序(面向 .NET Framework 4.6)还应
在其 app.config 中将 "EnableWindowsFormsHighDpiAutoResizing" 设置设置为 "true"
自动缩放 Windows Presentation Foundation (WPF)应用程序自动感知 DPI无需
选择加入 选择加入此设置的 Windows 窗体应用程序(面向 .NET Framework 4.6)还应
在其 app.config 中将 "EnableWindowsFormsHighDpiAutoResizing" 设置设置为 "true"
将应用程序设为感知长路径请参阅 https://docs.microsoft.com/windows/win32/fileio/maximum-file-path-limitation -->
将应用程序设为感知长路径 请参阅 https://docs.microsoft.com/windows/win32/fileio/maximum-file-path-limitation -->
<application xmlns="urn:schemas-microsoft-com:asm.v3">
<windowsSettings>