40 Commits

Author SHA1 Message Date
TD
b2ccd0c91a 1 2025-04-10 15:13:23 +08:00
4765e0e5bd 修改统计 2025-04-10 14:08:55 +08:00
TD
ab38ee029a 同上 2025-04-02 20:14:41 +08:00
TD
dbf412713b 修改所有的保存图片 2025-04-02 20:14:06 +08:00
TD
67ba78f268 村结果图有问题 2025-04-02 19:13:18 +08:00
TD
d63a6c42b3 保存图片有问题 2025-04-02 18:26:34 +08:00
babc40d36a 保存图片更新试试 2025-04-02 14:41:26 +08:00
409089e2ca 增加日志 2025-04-01 18:15:30 +08:00
e08386333a 1 2025-03-31 08:56:01 +08:00
b19feb5a44 释放模型 2025-03-27 18:03:07 +08:00
TD
0865af247a 111 2025-03-27 17:51:07 +08:00
TD
8d32269ee0 Merge branch 'dev_lilili' of https://gitea.star-rising.cn/xiaohuimin/DHDHSoftware into dev_lilili 2025-03-27 15:31:37 +08:00
TD
b4569f8ccc 清理 2025-03-27 15:31:36 +08:00
9e38ea85c8 修改UPH 2025-03-27 15:30:52 +08:00
TD
3be4b185d6 提交UPH 准备修改 2025-03-27 15:11:48 +08:00
5d77eebc67 提交 2025-03-27 12:07:23 +08:00
8868915944 提交 2025-03-27 11:41:44 +08:00
2d98b2d8b8 提交整体修改 2025-03-27 11:37:48 +08:00
bee7dc6f03 上传UPH 2025-03-26 11:37:23 +08:00
1046978877 Merge branch 'dev_xiao' into dev_lilili 2025-03-25 19:05:06 +08:00
bc981fc7a9 首次提交lilili 2025-03-25 18:55:59 +08:00
TD
09c2eb37fe 修改界面 2025-03-25 15:33:35 +08:00
TD
2a6019bfbd 初步界面测试 2025-03-25 13:56:48 +08:00
fabc7606e7 代码清理 2025-03-24 19:24:16 +08:00
fb1ae0bb08 修改标签 2025-03-24 19:20:16 +08:00
8619d8ba2e yb 2025-03-24 19:04:03 +08:00
b60d2759b1 修改标签路径 2025-03-24 19:03:30 +08:00
959a2bf642 只有在没数据库的情况下才初始化种子 2025-03-24 18:41:23 +08:00
cb7e216b3a 提交单例模式释放错误 2025-03-24 18:26:01 +08:00
33c2994455 提交 2025-03-24 18:22:03 +08:00
2b32e1a649 加载界面、程序关闭界面、单例模式 2025-03-24 18:21:21 +08:00
TD
d881dc6ec0 1 2025-03-24 17:24:14 +08:00
126db6bf91 Merge branch 'dev_xiao' of https://gitea.star-rising.cn/xiaohuimin/DHDHSoftware into dev_xiao 2025-03-24 15:21:21 +08:00
447cf4326b 提交 2025-03-24 15:21:16 +08:00
9973470e55 Merge branch 'dev_xiao' of https://gitea.star-rising.cn/xiaohuimin/DHDHSoftware into dev_xiao 2025-03-24 15:20:45 +08:00
b8d7371a56 推送 2025-03-24 15:20:33 +08:00
8aec9ba7fa 修改一点界面 2025-03-22 16:16:34 +08:00
f0f88624ae 修改一些变量和界面 2025-03-21 16:29:08 +08:00
9a5d3be528 提交 2025-03-21 08:51:20 +08:00
0dedff36fd 提交 2025-03-18 14:19:33 +08:00
128 changed files with 23010 additions and 3800 deletions

View File

@ -1,130 +0,0 @@
using System.ComponentModel;
using System.Drawing.Imaging;
using OpenCvSharp;
namespace DH.Devices.Devices
{
public class CameraBase
{
public volatile int SnapshotCount = 0;
public virtual bool isEnabled { get; set; } = false;
[Category("采图模式")]
[Description("是否连续模式。true连续模式采图false触发模式采图")]
[DisplayName("连续模式")]
public bool IsContinueMode { get; set; } = false;
public virtual bool isSavePicEnabled { get; set; } = false;
[Category("图片保存")]
[Description("图片保存文件夹")]
[DisplayName("图片保存文件夹")]
public virtual string ImageSaveDirectory { get; set; }
[Category("图片保存")]
[Description("图片保存格式")]
[DisplayName("图片保存格式")]
public ImageFormat ImageFormat { get; set; } = ImageFormat.Jpeg;
[Category("采图模式")]
[Description("是否硬触发模式。true硬触发false软触发")]
[DisplayName("硬触发")]
public bool IsHardwareTrigger { get; set; } = false;
public string SerialNumber { get; set; } = string.Empty;
public string CameraName { get; set; } = string.Empty;
public string CameraIP { get; set; } = string.Empty;
public string ComputerIP { get; set; } = string.Empty;
// public StreamFormat dvpStreamFormat = dvpStreamFormat.;
[Category("采图模式")]
[Description("是否传感器直接硬触发。true传感器硬触发不通过软件触发false通过软件触发IO 的硬触发模式")]
[DisplayName("是否传感器直接硬触发")]
public bool IsDirectHardwareTrigger { get; set; } = false;
/// <summary>
/// 增益
/// </summary>
[Category("相机设置")]
[DisplayName("增益")]
[Description("Gain增益,-1:不设置不同型号相机的增益请参考mvs")]
public float Gain { get; set; } = -1;
[Category("图像旋转")]
[Description("默认旋转,相机开启后默认不旋转")]
[DisplayName("默认旋转")]
public virtual float RotateImage { get; set; } = 0;
[Category("取像配置")]
[Description("曝光")]
[DisplayName("曝光")]
public virtual float Exposure { get; set; } = 200;
[Category("相机设置")]
[DisplayName("硬触发后的延迟")]
[Description("TriggerDelay:硬触发后的延迟,单位us 微秒")]
public float TriggerDelay { get; set; } = 0;
/// <summary>
/// 滤波时间
/// </summary>
[Category("相机设置")]
[DisplayName("滤波时间")]
[Description("LineDebouncerTimeI/O去抖时间 单位us")]
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

@ -1,186 +0,0 @@
using System.Collections;
using System.ComponentModel;
using System.Drawing;
using System.Drawing.Imaging;
using DH.Commons.Enums;
using HalconDotNet;
using OpenCvSharp;
namespace DH.Devices.Devices
{
/// <summary>
/// 视觉处理引擎1.传统视觉 2.深度学习
/// CV深度学习 四大领域
/// Image Classification 图像分类:判别图中物体是什么,比如是猫还是狗;
/// Semantic Segmentation 语义分割:对图像进行像素级分类,预测每个像素属于的类别,不区分个体;
/// Object Detection 目标检测:寻找图像中的物体并进行定位;
/// Instance Segmentation 实例分割:定位图中每个物体,并进行像素级标注,区分不同个体;
/// </summary>
public abstract class VisionEngineBase
{
public List<DetectionConfig> DetectionConfigs = new List<DetectionConfig>();
#region event
public event Action<string, List<double>> OnCropParamsOutput;
public event Action<string, Bitmap, List<IShapeElement>> OnDetectionDone;
public event Action<string> OnDetectionWarningStop;//有无检测 需要报警停机
#endregion
//public VisionEngineInitialConfigBase IConfig
//{
// get => InitialConfig as VisionEngineInitialConfigBase;
//}
// public ImageSaveHelper ImageSaveHelper { get; set; } = new ImageSaveHelper();
public string BatchNO { get; set; }
public HTuple hv_ModelID;
public abstract DetectStationResult RunInference(Mat originImgSet, string detectionId = null);
//public abstract void SaveDetectResultAsync(DetectStationResult detectResult);
public virtual void DetectionDone(string detectionId, Bitmap image, List<IShapeElement> detectionResults)
{
OnDetectionDone?.Invoke(detectionId, image, detectionResults);
}
public virtual void DetectionWarningStop(string detectionDes)
{
OnDetectionWarningStop?.Invoke(detectionDes);
}
public virtual void SaveImageAsync(string fullname, Bitmap saveMap, ImageFormat imageFormat)
{
if (saveMap != null)
{
//ImageSaveSet imageSaveSet = new ImageSaveSet()
//{
// FullName = fullname,
// SaveImage = saveMap.CopyBitmap(),
// ImageFormat = imageFormat.DeepSerializeClone()
//};
//ImageSaveHelper.ImageSaveAsync(imageSaveSet);
}
}
}
public class CamModuleXY
{
[Category("图片行")]
[DisplayName("行")]
[Description("行")]
// [TypeConverter(typeof(DeviceIdSelectorConverter<CameraBase>))]
//[TypeConverter(typeof(CollectionCountConvert))]
public int PicRows { get; set; } = 1;
[Category("图片列")]
[DisplayName("列")]
[Description("列")]
// [TypeConverter(typeof(DeviceIdSelectorConverter<CameraBase>))]
//[TypeConverter(typeof(CollectionCountConvert))]
public int PicCols { get; set; } = 1;
public string GetDisplayText()
{
return "行:" + PicRows.ToString() + "列:" + PicCols.ToString();
}
}
//public class RelatedCamera
//{
// [Category("关联相机")]
// [DisplayName("关联相机")]
// [Description("关联相机描述")]
// //[TypeConverter(typeof(DeviceIdSelectorConverter<CameraBase>))]
// //[TypeConverter(typeof(CollectionCountConvert))]
// public string CameraSourceId { get; set; } = "";
// //public string GetDisplayText()
// //{
// // using (var scope = GlobalVar.Container.BeginLifetimeScope())
// // {
// // List<IDevice> deviceList = scope.Resolve<List<IDevice>>();
// // IDevice CameraDevice = deviceList.FirstOrDefault(dev => dev.Id.Equals(CameraSourceId));
// // if (CameraDevice != null && CameraDevice is CameraBase)
// // {
// // return CameraDevice.Name;
// // }
// // }
// // return CameraSourceId;
// //}
//}
public class VisionEngineInitialConfigBase //: InitialConfigBase
{
[Category("深度学习检测配置")]
[DisplayName("检测配置集合")]
[Description("检测配置集合")]
//[TypeConverter(typeof(CollectionCountConvert))]
//[Editor(typeof(ComplexCollectionEditor<DetectionConfig>), typeof(UITypeEditor))]
public List<DetectionConfig> DetectionConfigs { get; set; } = new List<DetectionConfig>();
[Category("深度学习检测配置")]
[DisplayName("标签分类")]
[Description("标签分类,A_NG,B_TBD...")]
// [TypeConverter(typeof(CollectionCountConvert))]
// [Editor(typeof(ComplexCollectionEditor<RecongnitionLabelCategory>), typeof(UITypeEditor))]
public List<RecongnitionLabelCategory> RecongnitionLabelCategoryList { get; set; } = new List<RecongnitionLabelCategory>();
[Category("深度学习检测配置")]
[DisplayName("检测标签定义集合")]
[Description("定义检测标签的集合例如Seg/Detection模式断裂、油污、划伤...Class模式ok、ng、上面、下面、套环、正常...")]
// [TypeConverter(typeof(CollectionCountConvert))]
// [Editor(typeof(ComplexCollectionEditor<RecongnitionLabel>), typeof(UITypeEditor))]
public List<RecongnitionLabel> RecongnitionLabelList { get; set; } = new List<RecongnitionLabel>();
[Category("深度学习检测配置")]
[DisplayName("标签置信度")]
[Description("标签置信度,过滤小于改置信度的标签,大于该设置的标签才能识别")]
public float Score { get; set; } = 0.5f;
[Category("深度学习检测配置")]
[DisplayName("CPU线程数量")]
[Description("用于深度学习的CPU线程数量不要设置太大会单独占用线程影响其他程序运行")]
public int CPUNums { get; set; } = 1;
//[Category("深度学习检测配置")]
//[DisplayName("检测项GPU指定")]
//[Description("将检测项指定到GPU")]
// [TypeConverter(typeof(CollectionCountConvert))]
// [Editor(typeof(ComplexCollectionEditor<DetectionGPUConfig>), typeof(UITypeEditor))]
// public List<DetectionGPUConfig> DetectionGPUList { get; set; } = new List<DetectionGPUConfig>();
// [Category("数据保存配置")]
//[DisplayName("是否保存检测明细CSV")]
//[Description("是否保存 检测明细CSV")]
//public override bool IsEnableCSV { get; set; } = true;
//[Category("数据保存配置")]
//[DisplayName("是否保存检测图片")]
//[Description("是否保存 检测图片,总开关")]
//public bool IsSaveImage { get; set; } = true;
//[Category("数据保存配置")]
//[Description("检测图片 保存文件夹")]
//[DisplayName("检测图片保存文件夹")]
//[Editor(typeof(FoldDialogEditor), typeof(UITypeEditor))]
//public string ImageSaveDirectory { get; set; } = "D:\\PROJECTS\\X017\\Images";
//[Category("数据保存配置")]
//[Description("检测明细CSV文件夹")]
//[DisplayName("检测明细CSV文件夹")]
//[Editor(typeof(FoldDialogEditor), typeof(UITypeEditor))]
//public string CSVDataPath { get; set; } = "D:\\PROJECTS\\X017\\Images";
}
}

View File

@ -17,9 +17,11 @@
</ItemGroup> </ItemGroup>
<ItemGroup> <ItemGroup>
<PackageReference Include="AntdUI" Version="1.8.9" />
<PackageReference Include="OpenCvSharp4" Version="4.10.0.20241108" /> <PackageReference Include="OpenCvSharp4" Version="4.10.0.20241108" />
<PackageReference Include="OpenCvSharp4.Extensions" Version="4.10.0.20241108" /> <PackageReference Include="OpenCvSharp4.Extensions" Version="4.10.0.20241108" />
<PackageReference Include="OpenCvSharp4.runtime.win" Version="4.10.0.20241108" /> <PackageReference Include="OpenCvSharp4.runtime.win" Version="4.10.0.20241108" />
<PackageReference Include="System.IO.Ports" Version="9.0.3" />
</ItemGroup> </ItemGroup>
<ItemGroup> <ItemGroup>

View File

@ -0,0 +1,360 @@
using System;
using System.ComponentModel;
using System.Drawing.Imaging;
using AntdUI;
using DH.Commons.Enums;
using HalconDotNet;
using OpenCvSharp;
namespace DH.Commons.Base
{
public class MatSet
{
public DateTime ImageTime { get; set; } = DateTime.Now;
private string id = "";
public string Id
{
get
{
if (string.IsNullOrWhiteSpace(id))
{
id = ImageTime.ToString("HHmmssfff");
}
return id;
}
set
{
id = value;
}
}
public string CameraId { get; set; }
public Mat _mat { get; set; } = null;
public ImageFormat _imageFormat { get; set; } = ImageFormat.Jpeg;
public virtual void Dispose()
{
_mat?.Dispose();
_mat = null;
}
}
public class CameraBase : NotifyProperty
{
// public LoggerHelper LoggerHelper { get; set; } = new LoggerHelper();
// 私有字段 + 带通知的属性与DetectionLabel风格一致
private bool _isEnabled = false;
private bool _isallPicEnabled = true;//默认全画幅
private bool _isContinueMode = false;
private bool _isSavePicEnabled = false;
private string _imageSaveDirectory;
private EnumCamType _CamType;
private ImageFormat _imageFormat = ImageFormat.Jpeg;
private bool _isHardwareTrigger = true;
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 =6;
private float _rotateImage = 0;
private float _exposure = 200;
private float _triggerDelay = 0;
private decimal _roiX = 0;
private decimal _roiY = 0;
private decimal _roiW = 2448;
private decimal _roiH = 2048;
private int _lineDebouncerTime = 0;
public volatile int SnapshotCount = 0;
[Category("采图模式")]
[DisplayName("连续模式")]
[Description("是否连续模式。true连续模式采图false触发模式采图")]
public bool IsContinueMode
{
get => _isContinueMode;
set
{
if (_isContinueMode == value) return;
_isContinueMode = value;
OnPropertyChanged(nameof(IsContinueMode));
}
}
public virtual bool IsEnabled
{
get => _isEnabled;
set
{
if (_isEnabled == value) return;
_isEnabled = value;
OnPropertyChanged(nameof(IsEnabled));
}
}
public virtual bool IsAllPicEnabled
{
get => _isallPicEnabled;
set
{
if (_isallPicEnabled == value) return;
_isallPicEnabled = value;
OnPropertyChanged(nameof(IsAllPicEnabled));
}
}
public virtual bool IsSavePicEnabled
{
get => _isSavePicEnabled;
set
{
if (_isSavePicEnabled == value) return;
_isSavePicEnabled = value;
OnPropertyChanged(nameof(IsSavePicEnabled));
}
}
[Category("图片保存")]
[DisplayName("图片保存文件夹")]
[Description("图片保存文件夹")]
public virtual string ImageSaveDirectory
{
get => _imageSaveDirectory;
set
{
if (_imageSaveDirectory == value) return;
_imageSaveDirectory = value;
OnPropertyChanged(nameof(ImageSaveDirectory));
}
}
[Category("图片保存")]
[DisplayName("图片保存格式")]
[Description("图片保存格式")]
public ImageFormat ImageFormat
{
get => _imageFormat;
set
{
if (_imageFormat == value) return;
_imageFormat = value;
OnPropertyChanged(nameof(ImageFormat));
}
}
[Category("设备配置")]
[DisplayName("相机类型")]
[Description("相机类型")]
public EnumCamType CamType
{
get => _CamType;
set
{
if (_CamType == value) return;
_CamType = value;
OnPropertyChanged(nameof(CamType));
}
}
[Category("采图模式")]
[DisplayName("硬触发")]
[Description("是否硬触发模式。true硬触发false软触发")]
public bool IsHardwareTrigger
{
get => _isHardwareTrigger;
set
{
if (_isHardwareTrigger == value) return;
_isHardwareTrigger = value;
OnPropertyChanged(nameof(IsHardwareTrigger));
}
}
public string SerialNumber
{
get => _serialNumber;
set
{
if (_serialNumber == value) return;
_serialNumber = value;
OnPropertyChanged(nameof(SerialNumber));
}
}
public string CameraName
{
get => _cameraName;
set
{
if (_cameraName == value) return;
_cameraName = value;
OnPropertyChanged(nameof(CameraName));
}
}
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));
}
}
[Category("采图模式")]
[DisplayName("是否传感器直接硬触发")]
[Description("是否传感器直接硬触发。true传感器硬触发不通过软件触发false通过软件触发IO 的硬触发模式")]
public bool IsDirectHardwareTrigger
{
get => _isDirectHardwareTrigger;
set
{
if (_isDirectHardwareTrigger == value) return;
_isDirectHardwareTrigger = value;
OnPropertyChanged(nameof(IsDirectHardwareTrigger));
}
}
[Category("相机设置")]
[DisplayName("增益")]
[Description("Gain增益,-1:不设置不同型号相机的增益请参考mvs")]
public float Gain
{
get => _gain;
set
{
if (_gain.Equals(value)) return;
_gain = value;
OnPropertyChanged(nameof(Gain));
}
}
[Category("图像旋转")]
[DisplayName("默认旋转")]
[Description("默认旋转,相机开启后默认不旋转")]
public virtual float RotateImage
{
get => _rotateImage;
set
{
if (_rotateImage.Equals(value)) return;
_rotateImage = value;
OnPropertyChanged(nameof(RotateImage));
}
}
[Category("取像配置")]
[DisplayName("曝光")]
[Description("曝光")]
public virtual float Exposure
{
get => _exposure;
set
{
if (_exposure.Equals(value)) return;
_exposure = value;
OnPropertyChanged(nameof(Exposure));
}
}
[Category("相机设置")]
[DisplayName("硬触发后的延迟")]
[Description("TriggerDelay:硬触发后的延迟,单位us 微秒")]
public float TriggerDelay
{
get => _triggerDelay;
set
{
if (_triggerDelay.Equals(value)) return;
_triggerDelay = value;
OnPropertyChanged(nameof(TriggerDelay));
}
}
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));
}
}
[Category("相机设置")]
[DisplayName("滤波时间")]
[Description("LineDebouncerTimeI/O去抖时间 单位us")]
public int LineDebouncerTime
{
get => _lineDebouncerTime;
set
{
if (_lineDebouncerTime == value) return;
_lineDebouncerTime = value;
OnPropertyChanged(nameof(LineDebouncerTime));
}
}
// 其他方法保持原有逻辑
public Action<DateTime, CameraBase, Mat> OnHImageOutput { get; set; }
public virtual bool CameraConnect() { return false; }
public virtual bool CameraDisConnect() { return false; }
public virtual void SetExposure(int exposureTime, string cameraName) { }
public virtual void SetGain(int gain, string cameraName) { }
internal virtual void SetAcquisitionMode(int mode) { }
internal virtual void SetAcqRegion(int offsetV, int offsetH, int imageH, int imageW, string cameraName) { }
}
}

View File

@ -7,25 +7,13 @@ using System.Text;
using System.Drawing.Design; using System.Drawing.Design;
using AntdUI; using AntdUI;
using static DH.Commons.Enums.EnumHelper; using static DH.Commons.Enums.EnumHelper;
using System.Text.Json.Serialization;
using DH.Commons.Enums;
using System.Drawing.Imaging;
namespace DH.Commons.Base
namespace DH.Commons.Enums
{ {
public enum MLModelType
{
[Description("图像分类")]
ImageClassification = 1,
[Description("目标检测")]
ObjectDetection = 2,
//[Description("图像分割")]
//ImageSegmentation = 3
[Description("语义分割")]
SemanticSegmentation = 3,
[Description("实例分割")]
InstanceSegmentation = 4,
[Description("目标检测GPU")]
ObjectGPUDetection = 5
}
public class ModelLabel public class ModelLabel
{ {
public string LabelId { get; set; } public string LabelId { get; set; }
@ -71,20 +59,20 @@ namespace DH.Commons.Enums
//public int ImageResizeCount; //public int ImageResizeCount;
public bool IsCLDetection; public bool IsCLDetection;
public int ProCount; public int ProCount;
public string in_node_name; public string in_node_name;
public string out_node_name; public string out_node_name;
public string in_lable_path; public string in_lable_path;
public int ResizeImageSize; public int ResizeImageSize;
public int segmentWidth; public int segmentWidth;
public int ImageWidth; public int ImageWidth;
// public List<labelStringBase> OkClassTxtList; // public List<labelStringBase> OkClassTxtList;
public List<ModelLabel> LabelNames; public List<ModelLabel> LabelNames;
@ -117,20 +105,20 @@ namespace DH.Commons.Enums
/// </summary> /// </summary>
public class DetectionResultDetail public class DetectionResultDetail
{ {
#pragma warning disable CS8618 // 在退出构造函数时,不可为 null 的字段必须包含非 null 值。请考虑声明为可以为 null。
public string LabelBGR { get; set; }//识别到对象的标签BGR public string LabelBGR { get; set; }//识别到对象的标签BGR
public int LabelNo { get; set; } // 识别到对象的标签索引 public int LabelNo { get; set; } // 识别到对象的标签索引
#pragma warning disable CS8618 // 在退出构造函数时,不可为 null 的字段必须包含非 null 值。请考虑声明为可以为 null。
public string LabelName { get; set; }//识别到对象的标签名称 public string LabelName { get; set; }//识别到对象的标签名称
public double Score { get; set; }//识别目标结果的可能性、得分 public double Score { get; set; }//识别目标结果的可能性、得分
#pragma warning disable CS8618 // 在退出构造函数时,不可为 null 的字段必须包含非 null 值。请考虑声明为可以为 null。
public string LabelDisplay { get; set; }//识别到对象的 显示信息 public string LabelDisplay { get; set; }//识别到对象的 显示信息
@ -151,10 +139,10 @@ namespace DH.Commons.Enums
public class MLResult public class MLResult
{ {
public bool IsSuccess = false; public bool IsSuccess = false;
#pragma warning disable CS8618 // 在退出构造函数时,不可为 null 的字段必须包含非 null 值。请考虑声明为可以为 null。
public string ResultMessage; public string ResultMessage;
#pragma warning disable CS8618 // 在退出构造函数时,不可为 null 的字段必须包含非 null 值。请考虑声明为可以为 null。
public Bitmap ResultMap; public Bitmap ResultMap;
public List<DetectionResultDetail> ResultDetails = new List<DetectionResultDetail>(); public List<DetectionResultDetail> ResultDetails = new List<DetectionResultDetail>();
@ -178,8 +166,7 @@ namespace DH.Commons.Enums
public bool IsGPU; public bool IsGPU;
public int GPUId; public int GPUId;
public float Score_thre; 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) public MLInit(string modelFile, bool isGPU, int gpuId, float score_thre)
@ -204,18 +191,32 @@ namespace DH.Commons.Enums
} }
public class DetectStationResult public class DetectStationResult
{ {
#pragma warning disable CS8618 // 在退出构造函数时,不可为 null 的字段必须包含非 null 值。请考虑声明为可以为 null。 public DateTime ImageTime { get; set; } = DateTime.Now;
private string id = "";
public string Id
{
get
{
if (string.IsNullOrWhiteSpace(id))
{
id = ImageTime.ToString("HHmmssfff");
}
return id;
}
set
{
id = value;
}
}
public string Pid { get; set; } public string Pid { get; set; }
public string TempPid { get; set; }
#pragma warning disable CS8618 // 在退出构造函数时,不可为 null 的字段必须包含非 null 值。请考虑声明为可以为 null。
public string TempPid { get; set; }
/// <summary> /// <summary>
/// 检测工位名称 /// 检测工位名称
/// </summary> /// </summary>
#pragma warning disable CS8618 // 在退出构造函数时,不可为 null 的字段必须包含非 null 值。请考虑声明为可以为 null。
public string DetectName { get; set; } public string DetectName { get; set; }
@ -225,8 +226,11 @@ namespace DH.Commons.Enums
/// </summary> /// </summary>
public List<DetectionResultDetail> DetectDetails = new List<DetectionResultDetail>(); public List<DetectionResultDetail> DetectDetails = new List<DetectionResultDetail>();
public List<IShapeElement> DetectionResultShapes = new List<IShapeElement>(); public List<IShapeElement> DetectionResultShapes = new List<IShapeElement>();
/// <summary>
/// 视觉测量结果集合
/// </summary>
public List<IndexedSpec> realSpecs { get; set; } = new List<IndexedSpec>();
/// <summary> /// <summary>
/// 工位检测结果 /// 工位检测结果
/// </summary> /// </summary>
@ -251,35 +255,24 @@ namespace DH.Commons.Enums
/// 预处理阶段已经NG /// 预处理阶段已经NG
/// </summary> /// </summary>
public bool IsPreTreatNG { get; set; } = false; public bool IsPreTreatNG { get; set; } = false;
/// <summary>
/// 检测原图
/// </summary>
public Bitmap DetectionOriginImage { get; set; }
/// <summary> /// <summary>
/// 目标检测NG /// 目标检测NG
/// </summary> /// </summary>
public bool IsObjectDetectNG { get; set; } = false; public bool IsObjectDetectNG { get; set; } = false;
public ImageFormat ImageFormat { get; set; } = ImageFormat.Jpeg;
public DateTime EndTime { get; set; } public DateTime EndTime { get; set; }
public string ImageSaveDirectory { get; set; }
public int StationDetectElapsed { get; set; } public int StationDetectElapsed { get; set; }
public static string NormalizeAndClean(string input) public bool SaveOKOriginal = false;
{ public bool SaveNGOriginal = false;
#pragma warning disable CS8603 // 可能返回 null 引用。 public bool SaveOKDetect = false;
if (input == null) return null; public bool SaveNGDetect = false;
#pragma warning restore CS8603 // 可能返回 null 引用。
// Step 1: 标准化字符编码为 Form C (规范组合)
string normalizedString = input.Normalize(NormalizationForm.FormC);
// Step 2: 移除所有空白字符,包括制表符和换行符
string withoutWhitespace = Regex.Replace(normalizedString, @"\s+", "");
// Step 3: 移除控制字符 (Unicode 控制字符,范围 \u0000 - \u001F 和 \u007F)
string withoutControlChars = Regex.Replace(withoutWhitespace, @"[\u0000-\u001F\u007F]+", "");
// Step 4: 移除特殊的不可见字符(如零宽度空格等)
string cleanedString = Regex.Replace(withoutControlChars, @"[\u200B\u200C\u200D\uFEFF]+", "");
return cleanedString;
}
} }
public class RelatedCamera : NotifyProperty public class RelatedCamera : NotifyProperty
@ -402,7 +395,7 @@ namespace DH.Commons.Enums
public static double GetDistance(CustomizedPoint p1, CustomizedPoint p2) public static double GetDistance(CustomizedPoint p1, CustomizedPoint p2)
{ {
return Math.Sqrt(Math.Pow((p1.X - p2.X), 2) + Math.Pow((p1.Y - p2.Y), 2)); return Math.Sqrt(Math.Pow(p1.X - p2.X, 2) + Math.Pow(p1.Y - p2.Y, 2));
} }
public override string ToString() public override string ToString()
@ -443,13 +436,13 @@ namespace DH.Commons.Enums
public int CompareTo(CustomizedPoint other) public int CompareTo(CustomizedPoint other)
{ {
return (X == other.X && Y == other.Y) ? 0 : 1; return X == other.X && Y == other.Y ? 0 : 1;
} }
public override int GetHashCode() public override int GetHashCode()
{ {
//return (int)(X * 10 + Y); //return (int)(X * 10 + Y);
return (new Tuple<double, double>(X, Y)).GetHashCode(); return new Tuple<double, double>(X, Y).GetHashCode();
} }
public static CustomizedPoint operator -(CustomizedPoint p1, CustomizedPoint p2) public static CustomizedPoint operator -(CustomizedPoint p1, CustomizedPoint p2)
@ -462,193 +455,443 @@ namespace DH.Commons.Enums
return new CustomizedPoint(p1.X + p2.X, p1.Y + p2.Y); return new CustomizedPoint(p1.X + p2.X, p1.Y + p2.Y);
} }
} }
// public class PreTreatParam // public class PreTreatParam
// { // {
// /// <summary> // /// <summary>
// /// 参数名称 // /// 参数名称
// /// </summary> // /// </summary>
// /// // ///
// [Category("预处理参数")] // [Category("预处理参数")]
// [DisplayName("参数名称")] // [DisplayName("参数名称")]
// [Description("参数名称")] // [Description("参数名称")]
//#pragma warning disable CS8618 // 在退出构造函数时,不可为 null 的字段必须包含非 null 值。请考虑声明为可以为 null。 //#pragma warning disable CS8618 // 在退出构造函数时,不可为 null 的字段必须包含非 null 值。请考虑声明为可以为 null。
// public string Name { get; set; } // public string Name { get; set; }
// /// <summary> // /// <summary>
// /// 参数值 // /// 参数值
// /// </summary> // /// </summary>
// /// // ///
// [Category("预处理参数")] // [Category("预处理参数")]
// [DisplayName("参数值")] // [DisplayName("参数值")]
// [Description("参数值")] // [Description("参数值")]
//#pragma warning disable CS8618 // 在退出构造函数时,不可为 null 的字段必须包含非 null 值。请考虑声明为可以为 null。 //#pragma warning disable CS8618 // 在退出构造函数时,不可为 null 的字段必须包含非 null 值。请考虑声明为可以为 null。
// public string Value { get; set; } // public string Value { get; set; }
// } // }
public class DetectionConfig public class DetectionConfig : NotifyProperty
{ {
[ReadOnly(true)] #region
public string Id { get; set; } = Guid.NewGuid().ToString(); private string _id = Guid.NewGuid().ToString();
private string _name;
private string _cameraSourceId = "";
private List<RelatedCamera> _cameraCollects = new List<RelatedCamera>();
private bool _isEnableGPU;
private bool _isMixModel;
private bool _isPreEnabled;
private bool _isEnabled;
private bool _isAddStation = true;
private string _halconAlgorithemPath_Pre;
private AntList<PreTreatParam> _preTreatParams = new AntList<PreTreatParam>();
private AntList<PreTreatParam> _outPreTreatParams = new AntList<PreTreatParam>();
private ModelType _modelType = ModelType.;
private string _modelPath;
private int _modelWidth = 640;
private int _modelHeight = 640;
private string _modeloutNodeName = "output0";
private float _modelconfThreshold = 0.5f;
private string _in_lable_path;
private AntList<DetectionLable> _detectionLableList = new AntList<DetectionLable>();
private AntList<SizeTreatParam> _sizeTreatParamList = new AntList<SizeTreatParam>();
private CustomizedPoint _showLocation = new CustomizedPoint();
private string _imageSaveDirectory="D://Images";
private bool _saveOKOriginal = false;
private bool _saveNGOriginal = false;
private bool _saveOKDetect = false;
private bool _saveNGDetect = false;
#endregion
#region
[ReadOnly(true)]
public string Id
{
get => _id;
set
{
if (_id == value) return;
_id = value;
OnPropertyChanged(nameof(Id));
}
}
[Category("检测配置")] [Category("检测配置")]
[DisplayName("检测配置名称")] [DisplayName("检测配置名称")]
[Description("检测配置名称")] [Description("检测配置名称")]
public string Name { get; set; } public string Name
{
[Category("关联相机")] get => _name;
[DisplayName("关联相机")] set
[Description("关联相机描述")] {
if (_name == value) return;
_name = value;
public string CameraSourceId { get; set; } = ""; OnPropertyChanged(nameof(Name));
}
}
[Category("关联相机集合")] [Category("关联相机集合")]
[DisplayName("关联相机集合")] [DisplayName("关联相机集合")]
[Description("关联相机描述")] [Description("关联相机描述")]
//[TypeConverter(typeof(DeviceIdSelectorConverter<CameraBase>))] public List<RelatedCamera> CameraCollects
{
get => _cameraCollects;
set
public List<RelatedCamera> CameraCollects { get; set; } = new List<RelatedCamera>(); {
if (_cameraCollects == value) return;
_cameraCollects = value;
OnPropertyChanged(nameof(CameraCollects));
}
}
[Category("启用配置")] [Category("启用配置")]
[DisplayName("是否启用GPU检测")] [DisplayName("是否启用GPU检测")]
[Description("是否启用GPU检测")] [Description("是否启用GPU检测")]
public bool IsEnableGPU { get; set; } = false; public bool IsEnableGPU
{
get => _isEnableGPU;
set
{
if (_isEnableGPU == value) return;
_isEnableGPU = value;
OnPropertyChanged(nameof(IsEnableGPU));
}
}
[Category("启用配置")] [Category("启用配置")]
[DisplayName("是否混料模型")] [DisplayName("是否混料模型")]
[Description("是否混料模型")] [Description("是否混料模型")]
public bool IsMixModel { get; set; } = false; public bool IsMixModel
{
get => _isMixModel;
set
{
if (_isMixModel == value) return;
_isMixModel = value;
OnPropertyChanged(nameof(IsMixModel));
}
}
[Category("启用配置")]
[DisplayName("是否启用预处理")]
[Description("是否启用预处理")]
public bool IsPreEnabled
{
get => _isPreEnabled;
set
{
if (_isPreEnabled == value) return;
_isPreEnabled = value;
OnPropertyChanged(nameof(IsPreEnabled));
}
}
[Category("启用配置")] [Category("启用配置")]
[DisplayName("是否启用该检测")] [DisplayName("是否启用该检测")]
[Description("是否启用该检测")] [Description("是否启用该检测")]
public bool IsEnabled { get; set; } public bool IsEnabled
{
get => _isEnabled;
set
{
if (_isEnabled == value) return;
_isEnabled = value;
OnPropertyChanged(nameof(IsEnabled));
}
}
[Category("启用配置")] [Category("启用配置")]
[DisplayName("是否加入检测工位")] [DisplayName("是否加入检测工位")]
[Description("是否加入检测工位")] [Description("是否加入检测工位")]
public bool IsAddStation { get; set; } = true; public bool IsAddStation
{
get => _isAddStation;
set
{
if (_isAddStation == value) return;
_isAddStation = value;
OnPropertyChanged(nameof(IsAddStation));
}
}
[Category("图片保存")]
[DisplayName("图片保存文件夹")]
[Description("图片保存文件夹")]
public virtual string ImageSaveDirectory
{
get => _imageSaveDirectory;
set
{
if (_imageSaveDirectory == value) return;
_imageSaveDirectory = value;
OnPropertyChanged(nameof(ImageSaveDirectory));
}
}
[Category("1.预处理(视觉算子)")] [Category("1.预处理(视觉算子)")]
[DisplayName("预处理-算法文件路径")] [DisplayName("预处理-算法文件路径")]
// [Description("预处理算法文件路径配置")][Editor(typeof(FileDialogEditor), typeof(UITypeEditor))] public string HalconAlgorithemPath_Pre
public string HalconAlgorithemPath_Pre { get; set; } {
get => _halconAlgorithemPath_Pre;
// [Category("1.预处理(视觉算子)")] set
//[DisplayName("预处理-输出结果的SPEC标准")] {
//[Description("预处理输出结果的SPEC标准配置")] if (_halconAlgorithemPath_Pre == value) return;
_halconAlgorithemPath_Pre = value;
// public List<IndexedSpec> OutputSpec_Pre { get; set; } = new List<IndexedSpec>(); OnPropertyChanged(nameof(HalconAlgorithemPath_Pre));
}
}
[Category("1.预处理(视觉算子)")] [Category("1.预处理(视觉算子)")]
[DisplayName("预处理-参数列表")] [DisplayName("预处理-参数列表")]
[Description("预处理-参数列表")] [Description("预处理-参数列表")]
public AntList<PreTreatParam> PreTreatParams
public List<PreTreatParam> PreTreatParams { get; set; } = new List<PreTreatParam>(); {
get => _preTreatParams;
set
{
if (_preTreatParams == value) return;
_preTreatParams = value;
OnPropertyChanged(nameof(PreTreatParams));
}
}
[Category("1.预处理(视觉算子)")] [Category("1.预处理(视觉算子)")]
[DisplayName("预处理-输出参数列表")] [DisplayName("预处理-输出参数列表")]
[Description("预处理-输出参数列表")] [Description("预处理-输出参数列表")]
public AntList<PreTreatParam> OUTPreTreatParams
public List<PreTreatParam> OUTPreTreatParams { get; set; } = new List<PreTreatParam>(); {
get => _outPreTreatParams;
set
{
if (_outPreTreatParams == value) return;
_outPreTreatParams = value;
OnPropertyChanged(nameof(OUTPreTreatParams));
}
}
[Category("2.中检测(深度学习)")] [Category("2.中检测(深度学习)")]
[DisplayName("中检测-模型类型")] [DisplayName("中检测-模型类型")]
[Description("模型类型ImageClassification-图片分类ObjectDetection目标检测Segmentation-图像分割")] [Description("模型类型ImageClassification-图片分类ObjectDetection目标检测Segmentation-图像分割")]
//[TypeConverter(typeof(EnumDescriptionConverter<MLModelType>))] public ModelType ModelType
public MLModelType ModelType { get; set; } = MLModelType.ObjectDetection; {
get => _modelType;
//[Category("2.中检测(深度学习)")] set
//[DisplayName("中检测-GPU索引")] {
//[Description("GPU索引")] if (_modelType == value) return;
//public int GPUIndex { get; set; } = 0; _modelType = value;
OnPropertyChanged(nameof(ModelType));
}
}
[Category("2.中检测(深度学习)")] [Category("2.中检测(深度学习)")]
[DisplayName("中检测-模型文件路径")] [DisplayName("中检测-模型文件路径")]
[Description("中处理 深度学习模型文件路径,路径中不可含有中文字符,一般情况可以只配置中检测模型,当需要先用预检测过滤一次时,请先配置好与预检测相关配置")] [Description("中处理 深度学习模型文件路径")]
public string ModelPath
public string ModelPath { get; set; } {
get => _modelPath;
set
{
if (_modelPath == value) return;
_modelPath = value;
OnPropertyChanged(nameof(ModelPath));
}
}
[Category("2.中检测(深度学习)")] [Category("2.中检测(深度学习)")]
[DisplayName("中检测-模型宽度")] [DisplayName("中检测-模型宽度")]
[Description("中处理-模型宽度")] [Description("中处理-模型宽度")]
public int ModelWidth
public int ModelWidth { get; set; } = 640; {
get => _modelWidth;
set
{
if (_modelWidth == value) return;
_modelWidth = value;
OnPropertyChanged(nameof(ModelWidth));
}
}
[Category("2.中检测(深度学习)")] [Category("2.中检测(深度学习)")]
[DisplayName("中检测-模型高度")] [DisplayName("中检测-模型高度")]
[Description("中处理-模型高度")] [Description("中处理-模型高度")]
public int ModelHeight
public int ModelHeight { get; set; } = 640; {
get => _modelHeight;
set
{
if (_modelHeight == value) return;
_modelHeight = value;
OnPropertyChanged(nameof(ModelHeight));
}
}
[Category("2.中检测(深度学习)")] [Category("2.中检测(深度学习)")]
[DisplayName("中检测-模型节点名称")] [DisplayName("中检测-模型节点名称")]
[Description("中处理-模型节点名称")] [Description("中处理-模型节点名称")]
public string ModeloutNodeName
public string ModeloutNodeName { get; set; } = "output0"; {
get => _modeloutNodeName;
set
{
if (_modeloutNodeName == value) return;
_modeloutNodeName = value;
OnPropertyChanged(nameof(ModeloutNodeName));
}
}
[Category("2.中检测(深度学习)")] [Category("2.中检测(深度学习)")]
[DisplayName("中检测-模型置信度")] [DisplayName("中检测-模型置信度")]
[Description("中处理-模型置信度")] [Description("中处理-模型置信度")]
public float ModelconfThreshold
public float ModelconfThreshold { get; set; } = 0.5f; {
get => _modelconfThreshold;
set
{
if (_modelconfThreshold == value) return;
_modelconfThreshold = value;
OnPropertyChanged(nameof(ModelconfThreshold));
}
}
[Category("2.中检测(深度学习)")] [Category("2.中检测(深度学习)")]
[DisplayName("中检测-模型标签路径")] [DisplayName("中检测-模型标签路径")]
[Description("中处理-模型标签路径")] [Description("中处理-模型标签路径")]
public string In_lable_path
public string in_lable_path { get; set; }
[Category("4.最终过滤(逻辑过滤)")]
[DisplayName("过滤器集合")]
[Description("最后的逻辑过滤:可根据 识别出对象的 宽度、高度、面积、得分来设置最终检测结果,同一识别目标同一判定,多项过滤器之间为“或”关系")]
public List<DetectionFilter> DetectionFilterList { get; set; } = new List<DetectionFilter>();
/// <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();
public DetectionConfig()
{ {
get
{
if (string.IsNullOrEmpty(ModelPath) || string.IsNullOrWhiteSpace(ModelPath))
{
return string.Empty;
}
string dir = Path.GetDirectoryName(ModelPath);
string file = $"{Path.GetFileNameWithoutExtension(ModelPath)}.txt";
return Path.Combine(dir, file);
}
set
{
if (_in_lable_path == value) return;
_in_lable_path = value;
OnPropertyChanged(nameof(In_lable_path));
}
} }
public DetectionConfig(string name, MLModelType modelType, string modelPath, bool isEnableGPU,string sCameraSourceId)
{
[Category("显示配置")]
[DisplayName("显示位置")]
[Description("检测信息显示位置")]
public CustomizedPoint ShowLocation
{
get => _showLocation;
set
{
if (_showLocation == value) return;
_showLocation = value;
OnPropertyChanged(nameof(ShowLocation));
}
}
/// <summary>
/// 标签集合需确保DetectionLable也实现INotifyPropertyChanged
/// </summary>
public AntList<DetectionLable> DetectionLableList
{
get => _detectionLableList;
set
{
if (_detectionLableList == value) return;
_detectionLableList = value;
OnPropertyChanged(nameof(DetectionLableList));
}
}
public AntList<SizeTreatParam> SizeTreatParamList
{
get => _sizeTreatParamList;
set
{
if (_sizeTreatParamList == value) return;
_sizeTreatParamList = value;
OnPropertyChanged(nameof(SizeTreatParamList));
}
}
public bool SaveOKOriginal
{
get => _saveOKOriginal;
set
{
if (_saveOKOriginal == value) return;
_saveOKOriginal = value;
OnPropertyChanged(nameof(SaveOKOriginal));
}
}
public bool SaveNGOriginal
{
get => _saveNGOriginal;
set
{
if (_saveNGOriginal == value) return;
_saveNGOriginal = value;
OnPropertyChanged(nameof(SaveNGOriginal));
}
}
public bool SaveOKDetect
{
get => _saveOKDetect;
set
{
if (_saveOKDetect == value) return;
_saveOKDetect = value;
OnPropertyChanged(nameof(SaveOKDetect));
}
}
public bool SaveNGDetect
{
get => _saveNGDetect;
set
{
if (_saveNGDetect == value) return;
_saveNGDetect = value;
OnPropertyChanged(nameof(SaveNGDetect));
}
}
#endregion
#region
public DetectionConfig() { }
public DetectionConfig(
string name,
ModelType modelType,
string modelPath,
bool isEnableGPU,
string sCameraSourceId)
{
// 通过属性赋值触发通知
ModelPath = modelPath ?? string.Empty; ModelPath = modelPath ?? string.Empty;
Name = name; Name = name;
ModelType = modelType; ModelType = modelType;
IsEnableGPU = isEnableGPU; IsEnableGPU = isEnableGPU;
Id = Guid.NewGuid().ToString();
CameraSourceId = sCameraSourceId;
} }
#endregion
} }
//大改预处理类 //大改预处理类
@ -696,6 +939,7 @@ namespace DH.Commons.Enums
} }
private CellLink[] cellLinks; private CellLink[] cellLinks;
[JsonIgnore]
public CellLink[] CellLinks public CellLink[] CellLinks
{ {
get { return cellLinks; } get { return cellLinks; }
@ -714,10 +958,11 @@ namespace DH.Commons.Enums
public class DetectionLable : NotifyProperty public class DetectionLable : NotifyProperty
{ {
private bool _selected = false; private bool _selected = false;
private string _labelId; private string _labelId;
private string _labelName; private string _labelName;
private double _maxSource; private double _maxScore;
private double _minSource; private double _minScore;
private double _maxArea; private double _maxArea;
private double _minArea; private double _minArea;
private ResultState _resultState = ResultState.ResultTBD; private ResultState _resultState = ResultState.ResultTBD;
@ -760,25 +1005,25 @@ namespace DH.Commons.Enums
} }
} }
public double MaxSource public double MaxScore
{ {
get { return _maxSource; } get { return _maxScore; }
set set
{ {
if (_maxSource.Equals(value)) return; if (_maxScore.Equals(value)) return;
_maxSource = value; _maxScore = value;
OnPropertyChanged(nameof(MaxSource)); OnPropertyChanged(nameof(MaxScore));
} }
} }
public double MinSource public double MinScore
{ {
get { return _minSource; } get { return _minScore; }
set set
{ {
if (_minSource.Equals(value)) return; if (_minScore.Equals(value)) return;
_minSource = value; _minScore = value;
OnPropertyChanged(nameof(MinSource)); OnPropertyChanged(nameof(MinScore));
} }
} }
@ -816,6 +1061,7 @@ namespace DH.Commons.Enums
} }
private CellLink[] cellLinks; private CellLink[] cellLinks;
[JsonIgnore]
public CellLink[] CellLinks public CellLink[] CellLinks
{ {
get { return cellLinks; } get { return cellLinks; }
@ -936,6 +1182,7 @@ namespace DH.Commons.Enums
private CellLink[] cellLinks; private CellLink[] cellLinks;
[JsonIgnore]
public CellLink[] CellLinks public CellLink[] CellLinks
{ {
get { return cellLinks; } get { return cellLinks; }
@ -1109,7 +1356,7 @@ namespace DH.Commons.Enums
[DisplayName("过滤条件集合")] [DisplayName("过滤条件集合")]
[Description("过滤条件集合,集合之间为“且”关系")] [Description("过滤条件集合,集合之间为“且”关系")]
//[TypeConverter(typeof(CollectionCountConvert))] //[TypeConverter(typeof(CollectionCountConvert))]
// [Editor(typeof(ComplexCollectionEditor<FilterConditions>), typeof(UITypeEditor))] // [Editor(typeof(ComplexCollectionEditor<FilterConditions>), typeof(UITypeEditor))]
public List<FilterConditions> FilterConditionsCollection { get; set; } = new List<FilterConditions>(); public List<FilterConditions> FilterConditionsCollection { get; set; } = new List<FilterConditions>();

View File

@ -0,0 +1,389 @@

using DH.Commons.Enums;
using OpenCvSharp.Internal;
using System;
using System.ComponentModel;
using System.IO;
using System.Text.Json.Serialization;
using System.Threading;
using System.Threading.Tasks;
using static DH.Commons.Enums.EnumHelper;
using Timer = System.Threading.Timer;
namespace DH.Commons.Base
{
public abstract class DeviceBase : IDisposable
{
#region Event
[JsonIgnore]
[Browsable(false)]
public Action<DateTime, Exception> OnExceptionOccured { get; set; }
//public event Action<DateTime, LogLevel, string> OnLog;
public event Action<LogMsg> OnLog;
// public event Action<IDevice, DeviceState> OnDeviceStateChanged;
public event PropertyChangedEventHandler PropertyChanged;
#endregion
#region field
int RetryTime = 3;
/// <summary>
/// 和设备暂停状态关联的信号量
/// </summary>
private readonly ManualResetEvent pauseHandle = new ManualResetEvent(true);
readonly Timer stateChangedTimer;
#endregion
#region Property
#region State
private EnumHelper.DeviceState _currentStateToBe = EnumHelper.DeviceState.DSUninit;
/// <summary>
/// 当前设备状态
/// </summary>
[JsonIgnore]
internal EnumHelper.DeviceState CurrentStateToBe
{
get
{
return _currentStateToBe;
}
set
{
if (value != _currentStateToBe)
{
var initialState = _currentStateToBe;
_currentStateToBe = value;
if (_currentStateToBe != EnumHelper.DeviceState.DSExcept)
{
// OnStateChanged(initialState);
}
else
{
stateChangedTimer.Change(Timeout.Infinite, Timeout.Infinite);
}
}
}
}
//private EnumHelper.DeviceState initialState = EnumHelper.DeviceState.DSUninit;
private EnumHelper.DeviceState _currentState = EnumHelper.DeviceState.DSUninit;
public EnumHelper.DeviceState CurrentState
{
get
{
return _currentState;
}
set
{
_currentState = value;
if (value != EnumHelper.DeviceState.TBD)
{
// OnDeviceStateChanged?.Invoke(this, _currentState);
PropertyChanged?.Invoke(this, new PropertyChangedEventArgs("CurrentState"));
}
//else
//{
// initialState = _currentState;
//}
}
}
#endregion
/// <summary>
/// 设备标识符 从数据库获取
/// </summary>
public string Id { get; set; }
/// <summary>
/// 设备名称 从数据库获取
/// </summary>
public string Name { get; set; }
//private IInitialConfig initialConfig = null;
///// <summary>
///// 设备初始化配置 从数据库获取
///// </summary>
//public virtual IInitialConfig InitialConfig
//{
// get => initialConfig;
// set
// {
// initialConfig = value;
// Id = initialConfig.Id;
// Name = initialConfig.Name;
// LoggerHelper.LogPath = initialConfig.LogPath;
// LoggerHelper.LogPrefix = initialConfig.Name;
// }
//}
#endregion
#region
public DeviceBase()
{
RegisterFileWriterException();
// stateChangedTimer = new Timer(new TimerCallback(CheckDeviceOpTimeOut), null, Timeout.Infinite, Timeout.Infinite);
}
#endregion
#region
protected virtual void Init()
{
LogAsync(DateTime.Now, LogLevel.Information, $"{Name}初始化完成");
}
protected virtual void Start()
{
LogAsync(DateTime.Now, LogLevel.Information, $"{Name}启动");
}
protected virtual void Stop()
{
LogAsync(DateTime.Now, LogLevel.Information, $"{Name}停止");
}
//public abstract void AttachToProcess(IProcess process);
#endregion
/// <summary>
/// 常用操作封装方法
/// </summary>
/// <param name="opConfig"></param>
/// <returns></returns>
//public virtual ResponseMessage RunWrap(IOperationConfig opConfig)
//{
// ResponseMessage msg = new ResponseMessage();
// msg.Message = "设备基类默认操作";
// return msg;
//}
#region
//[DeviceExceptionAspect]
//public void StateChange(EnumHelper.DeviceState stateToBe)
//{
// if (CurrentState == stateToBe)
// {
// return;
// }
// if (!stateToBe.CheckPreStateValid((int)CurrentStateToBe))
// {
// string currentStateStr = CurrentStateToBe.GetEnumDescription();
// string stateToBeStr = stateToBe.GetEnumDescription();
// throw new ProcessException($"{InitialConfig.Name}设备的当前状态为{currentStateStr},无法切换至{stateToBeStr}");
// }
// CurrentState = EnumHelper.DeviceState.TBD;
// CurrentStateToBe = stateToBe;
//}
//[DeviceExceptionAspect]
//private void OnStateChanged(EnumHelper.DeviceState initialState)
//{
// try
// {
// if (CurrentStateToBe != EnumHelper.DeviceState.DSExcept)
// {
// }
// else
// {
// if (CurrentState == EnumHelper.DeviceState.DSExcept)
// {
// return;
// }
// else
// {
// throw new ProcessException($"{InitialConfig.Name}设备操作超时");
// }
// }
// if (RetryTime >= 0)
// {
// if (initialState == CurrentStateToBe)
// {
// CurrentState = CurrentStateToBe;
// return;
// }
// #region 状态切换操作
// switch (CurrentStateToBe)
// {
// case EnumHelper.DeviceState.DSInit:
// if (initialState == EnumHelper.DeviceState.DSOpen)
// {
// return;
// }
// else
// {
// Init();
// }
// break;
// case EnumHelper.DeviceState.DSOpen:
// if (initialState == EnumHelper.DeviceState.DSInit)
// {
// Start();
// }
// else if (initialState == EnumHelper.DeviceState.DSPause)
// {
// Resume();
// pauseHandle.Set();
// }
// break;
// case EnumHelper.DeviceState.DSPause:
// pauseHandle.Reset();
// Pause();
// break;
// case EnumHelper.DeviceState.DSClose:
// if (initialState != DeviceState.DSUninit)
// {
// Stop();
// }
// break;
// default:
// break;
// }
// RetryTime = 3;
// CurrentState = CurrentStateToBe;
// #endregion
// }
// stateChangedTimer.Change(Timeout.Infinite, Timeout.Infinite);
// }
// catch (Exception ex)
// {
// RetryTime--;
// if (RetryTime > 0)
// {
// OnStateChanged(initialState);
// }
// else
// {
// if (CurrentState != EnumHelper.DeviceState.DSExcept)
// {
// RetryTime = 3;
// throw new ProcessException($"设备{InitialConfig.Name}的{CurrentStateToBe.GetEnumDescription()}操作重复3次失败", ex, ExceptionLevel.Warning);
// }
// }
// }
//}
//private void CheckDeviceOpTimeOut(object state)
//{
// stateChangedTimer?.Change(Timeout.Infinite, Timeout.Infinite);
// if (CurrentState != EnumHelper.DeviceState.DSExcept)
// {
// StateChange(EnumHelper.DeviceState.DSExcept);
// }
//}
#endregion
#region
private void RegisterFileWriterException()
{
LoggerHelper.OnLogExceptionRaised -= LoggerHelper_OnLogExceptionRaised;
// CSVHelper.OnCSVExceptionRaised -= LoggerHelper_OnLogExceptionRaised;
LoggerHelper.OnLogExceptionRaised += LoggerHelper_OnLogExceptionRaised;
// CSVHelper.OnCSVExceptionRaised += LoggerHelper_OnLogExceptionRaised;
}
// public CSVHelper CSVHelper { get; set; } = new CSVHelper();
public LoggerHelper LoggerHelper { get; set; } = new LoggerHelper();
public virtual void LogAsync(LogMsg msg)
{
msg.MsgSource = Name;
msg.ThreadId = Thread.CurrentThread.ManagedThreadId;
//OnLog?.BeginInvoke(msg, null, null);
OnLog?.Invoke(msg);
//if (InitialConfig.IsEnableLog)
//{
// LoggerHelper.LogAsync(msg);
//}
}
public virtual void LogAsync(DateTime dt, LogLevel logLevel, string msg)
{
LogAsync(new LogMsg(dt, logLevel, msg));
}
private void LoggerHelper_OnLogExceptionRaised(DateTime dt, string msg)
{
OnLog?.Invoke(new LogMsg(dt, LogLevel.Error, msg));
}
/// <summary>
/// CSV异步数据输出
/// </summary>
/// <param name="csvFile">CSV输出文件的文件全路径</param>
/// <param name="csvData">CSV输出数据</param>
/// <param name="csvHead">CSV文件表头</param>
public virtual void CSVRecordAsync(string csvFile, string csvData, string csvHead = "")
{
// CSVHelper.CSVOutputAsync(csvFile, csvData, csvHead);
}
#endregion
#region
//object _alarmLock = new object();
//protected virtual async void SaveAlarmCSVAsync(DateTime now, string deviceName, IWarningSet ws)
//{
// await Task.Run(() =>
// {
// LogAsync(now, LogLevel.Warning, $"{ws.WarningCode}-{ws.WarningDescription} {(ws.CurrentStatus ? "发生" : "取消")}");
// if (string.IsNullOrWhiteSpace(this.InitialConfig.LogPath) || !InitialConfig.IsEnableCSV)
// return;
// string path = Path.Combine(InitialConfig.LogPath, $"Alarm_{Name}_{now.ToString("yyyyMMdd")}.csv");
// string head = "Time,Source,AlarmCode,AlarmDescription,AlarmStatus";
// string data = $"{now.ToString("HH:mm:ss.fff")},{deviceName},{ws.WarningCode},{ws.WarningDescription},{(ws.CurrentStatus ? "报警发生" : "报警取消")}";
// CSVRecordAsync(path, data, head);
// });
//}
#endregion
#region IDisposable Support
private bool disposedValue = false; // 要检测冗余调用
protected virtual void Dispose(bool disposing)
{
if (!disposedValue)
{
if (disposing)
{
//释放托管状态(托管对象)。
stateChangedTimer?.Dispose();
pauseHandle?.Dispose();
}
// TODO: 释放未托管的资源(未托管的对象)并在以下内容中替代终结器。
// TODO: 将大型字段设置为 null。
disposedValue = true;
}
}
// TODO: 仅当以上 Dispose(bool disposing) 拥有用于释放未托管资源的代码时才替代终结器。
// ~DeviceBase()
// {
// // 请勿更改此代码。将清理代码放入以上 Dispose(bool disposing) 中。
// Dispose(false);
// }
// 添加此代码以正确实现可处置模式。
public void Dispose()
{
// 请勿更改此代码。将清理代码放入以上 Dispose(bool disposing) 中。
Dispose(true);
// TODO: 如果在以上内容中替代了终结器,则取消注释以下行。
// GC.SuppressFinalize(this);
}
#endregion
}
}

View File

@ -0,0 +1,131 @@
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Xml.Linq;
using AntdUI;
namespace DH.Commons.Base
{
public class GlobalConfig : NotifyProperty
{
string _name;
private BindingList<PLCItem> _InitProcessList = new BindingList<PLCItem>();
private BindingList<PLCItem> _StartProcessList = new BindingList<PLCItem>();
private BindingList<PLCItem> _StopProcessList = new BindingList<PLCItem>();
private BindingList<PLCItem> _StartResetList = new BindingList<PLCItem>();
private BindingList<PLCItem> _StopResetList = new BindingList<PLCItem>();
public string Name
{
get => _name;
set
{
if (_name != value)
{
_name = value;
OnPropertyChanged(nameof(Name));
}
}
}
public BindingList<PLCItem> InitProcessList
{
get => _InitProcessList;
set
{
if (_InitProcessList == value) return;
_InitProcessList = value;
OnPropertyChanged(nameof(InitProcessList));
}
}
public BindingList<PLCItem> StartProcessList
{
get => _StartProcessList;
set
{
if (_StartProcessList == value) return;
_StartProcessList = value;
OnPropertyChanged(nameof(StartProcessList));
}
}
public BindingList<PLCItem> StopProcessList
{
get => _StopProcessList;
set
{
if (_StopProcessList == value) return;
_StopProcessList = value;
OnPropertyChanged(nameof(StopProcessList));
}
}
public BindingList<PLCItem> StartResetList
{
get => _StartResetList;
set
{
if (_StartResetList == value) return;
_StartResetList = value;
OnPropertyChanged(nameof(StartResetList));
}
}
public BindingList<PLCItem> StopResetList
{
get => _StopResetList;
set
{
if (_StopResetList == value) return;
_StopResetList = value;
OnPropertyChanged(nameof(StopResetList));
}
}
string _imgSavePath;
string _dbSavePath;
string _configSavePath;
public string ImgSavePath
{
get => _imgSavePath;
set
{
if (_imgSavePath != value)
{
_imgSavePath = value;
OnPropertyChanged(nameof(ImgSavePath));
}
}
}
public string DbSavePath
{
get => _dbSavePath;
set
{
if (_dbSavePath != value)
{
_dbSavePath = value;
OnPropertyChanged(nameof(DbSavePath));
}
}
}
public string ConfigSavePath
{
get => _configSavePath;
set
{
if (_configSavePath != value)
{
_configSavePath = value;
OnPropertyChanged(nameof(ConfigSavePath));
}
}
}
}
}

378
DH.Commons/Base/PLCBase.cs Normal file
View File

@ -0,0 +1,378 @@
using System.ComponentModel;
using System.IO.Ports;
using System.Text.Json.Serialization;
using AntdUI;
using DH.Commons.Enums; // 请确保此命名空间包含EnumPLCType
namespace DH.Commons.Base
{
public class PLCBase : NotifyProperty
{
// 私有字段
private bool _enable;
private bool _connected;
private string _plcName;
private EnumPLCType _plcType;
private string _com = "COM1";
private int _baudRate = 9600;
private int _dataBit = 8;
private StopBits _stopBit = StopBits.One;
private Parity _parity = Parity.None;
private string _ip = "192.168.6.61";
private int _port = 502;
private BindingList<PLCItem> _PLCItemList = new BindingList<PLCItem>();
[Category("设备配置")]
[DisplayName("是否启用")]
[Description("是否启用")]
public bool Enable
{
get => _enable;
set
{
if (_enable == value) return;
_enable = value;
OnPropertyChanged(nameof(Enable));
}
}
[Category("状态监控")]
[DisplayName("连接状态")]
[Description("PLC连接状态")]
public bool Connected
{
get => _connected;
set
{
if (_connected == value) return;
_connected = value;
OnPropertyChanged(nameof(Connected));
}
}
[Category("设备配置")]
[DisplayName("PLC名称")]
[Description("PLC设备名称")]
public string PLCName
{
get => _plcName;
set
{
if (_plcName == value) return;
_plcName = value;
OnPropertyChanged(nameof(PLCName));
}
}
[Category("设备配置")]
[DisplayName("PLC类型")]
[Description("PLC通信协议类型")]
public EnumPLCType PLCType
{
get => _plcType;
set
{
if (_plcType == value) return;
_plcType = value;
OnPropertyChanged(nameof(PLCType));
}
}
[Category("串口配置")]
[DisplayName("COM端口")]
[Description("串口号如COM1")]
public string COM
{
get => _com;
set
{
if (_com == value) return;
_com = value;
OnPropertyChanged(nameof(COM));
}
}
[Category("串口配置")]
[DisplayName("波特率")]
[Description("串口通信波特率")]
public int BaudRate
{
get => _baudRate;
set
{
if (_baudRate == value) return;
_baudRate = value;
OnPropertyChanged(nameof(BaudRate));
}
}
[Category("串口配置")]
[DisplayName("数据位")]
[Description("数据位长度(5/6/7/8)")]
public int DataBit
{
get => _dataBit;
set
{
if (_dataBit == value) return;
_dataBit = value;
OnPropertyChanged(nameof(DataBit));
}
}
[Category("串口配置")]
[DisplayName("停止位")]
[Description("停止位设置")]
public StopBits StopBit
{
get => _stopBit;
set
{
if (_stopBit == value) return;
_stopBit = value;
OnPropertyChanged(nameof(StopBit));
}
}
[Category("串口配置")]
[DisplayName("校验位")]
[Description("奇偶校验方式")]
public Parity Parity
{
get => _parity;
set
{
if (_parity == value) return;
_parity = value;
OnPropertyChanged(nameof(Parity));
}
}
[Category("网络配置")]
[DisplayName("IP地址")]
[Description("PLC网络地址")]
public string IP
{
get => _ip;
set
{
if (_ip == value) return;
_ip = value;
OnPropertyChanged(nameof(IP));
}
}
[Category("网络配置")]
[DisplayName("端口号")]
[Description("网络通信端口")]
public int Port
{
get => _port;
set
{
if (_port == value) return;
_port = value;
OnPropertyChanged(nameof(Port));
}
}
[Category("点位配置")]
[DisplayName("点位配置")]
[Description("点位配置")]
public BindingList<PLCItem> PLCItemList
{
get => _PLCItemList;
set
{
if (_PLCItemList == value) return;
_PLCItemList = value;
OnPropertyChanged(nameof(PLCItemList));
}
}
public virtual bool PLCConnect()
{
Connected = true;
return true;
}
public virtual bool PLCDisConnect()
{
Connected = false;
return true;
}
public virtual Int16 ReadInt16(string address) { return 0; }
public virtual Int32 ReadInt32(string address) { return 0; }
public virtual UInt16 ReadUInt16(string address) { return 0; }
public virtual UInt32 ReadUInt32(string address) { return 0; }
public virtual float ReadFloat(string address) { return 0; }
public virtual bool ReadBool(string address) { return false; }
public virtual bool WriteInt16(string address, Int16 value, bool waitForReply = true) { return false; }
public virtual bool WriteInt32(string address, Int32 value, bool waitForReply = true) { return false; }
public virtual bool WriteUInt16(string address, UInt16 value, bool waitForReply = true) { return false; }
public virtual bool WriteUInt32(string address, UInt32 value, bool waitForReply = true) { return false; }
public virtual bool WriteFloat(string address, float value, bool waitForReply = true) { return false; }
public virtual bool WriteBool(string address, bool value, bool waitForReply = true) { return false; }
}
public class PLCItem : NotifyProperty
{
private bool _selected;
private string _name = string.Empty;
private EnumPLCDataType _type;
private string _value = string.Empty;
private bool _startexecute;
private int _startindex;
private string _address;
/// <summary>
/// 是否选中
/// </summary>
public bool Selected
{
get => _selected;
set
{
if (_selected != value)
{
_selected = value;
OnPropertyChanged(nameof(Selected));
}
}
}
/// <summary>
/// 参数名称
/// </summary>
public string Name
{
get => _name;
set
{
if (_name != value)
{
_name = value;
OnPropertyChanged(nameof(Name));
}
}
}
public EnumPLCDataType Type
{
get => _type;
set
{
if (_type != value)
{
_type = value;
OnPropertyChanged(nameof(Type));
}
}
}
/// <summary>
/// 参数类型
/// </summary>
public string Address
{
get => _address;
set
{
if (_address != value)
{
_address = value;
OnPropertyChanged(nameof(Address));
}
}
}
/// <summary>
/// 参数值
/// </summary>
public string Value
{
get => _value;
set
{
if (_value != value)
{
_value = value;
OnPropertyChanged(nameof(Value));
}
}
}
/// <summary>
/// 启用状态
/// </summary>
public bool StartExecute
{
get => _startexecute;
set
{
if (_startexecute != value)
{
_startexecute = value;
OnPropertyChanged(nameof(StartExecute));
}
}
}
/// <summary>
/// 顺序
/// </summary>
public int StartIndex
{
get => _startindex;
set
{
if (_startindex != value)
{
_startindex = value;
OnPropertyChanged(nameof(StartIndex));
}
}
}
private CellLink[] cellLinks;
[JsonIgnore]
public CellLink[] CellLinks
{
get { return cellLinks; }
set
{
if (cellLinks == value) return;
cellLinks = value;
OnPropertyChanged(nameof(CellLinks));
}
}
//private CellTag[] cellTags;
//[JsonIgnore]
//public CellTag[] CellTags
//{
// get { return cellTags; }
// set
// {
// if (cellTags == value) return;
// cellTags = value;
// OnPropertyChanged(nameof(CellTags));
// }
//}
}
}

View File

@ -0,0 +1,78 @@
using System.Collections;
using System.ComponentModel;
using System.Drawing;
using System.Drawing.Imaging;
using DH.Commons.Enums;
using DH.Commons.Helper;
using HalconDotNet;
using OpenCvSharp;
namespace DH.Commons.Base
{
/// <summary>
/// 视觉处理引擎1.传统视觉 2.深度学习
/// CV深度学习 四大领域
/// Image Classification 图像分类:判别图中物体是什么,比如是猫还是狗;
/// Semantic Segmentation 语义分割:对图像进行像素级分类,预测每个像素属于的类别,不区分个体;
/// Object Detection 目标检测:寻找图像中的物体并进行定位;
/// Instance Segmentation 实例分割:定位图中每个物体,并进行像素级标注,区分不同个体;
/// </summary>
public abstract class VisionEngineBase : DeviceBase
{
public List<DetectionConfig> DetectionConfigs = new List<DetectionConfig>();
#region event
public event Action<string, List<double>> OnCropParamsOutput;
public event Action<string, Bitmap, List<IShapeElement>> OnDetectionDone;
public event Action<string> OnDetectionWarningStop;//有无检测 需要报警停机
#endregion
//public VisionEngineInitialConfigBase IConfig
//{
// get => InitialConfig as VisionEngineInitialConfigBase;
//}
// public ImageSaveHelper ImageSaveHelper { get; set; } = new ImageSaveHelper();
public string BatchNO { get; set; }
public HTuple hv_ModelID;
public abstract DetectStationResult RunInference(Mat originImgSet, string detectionId = null);
//public abstract void SaveDetectResultAsync(DetectStationResult detectResult);
public virtual void DetectionDone(string detectionId, Bitmap image, List<IShapeElement> detectionResults)
{
OnDetectionDone?.Invoke(detectionId, image, detectionResults);
}
public virtual void DetectionWarningStop(string detectionDes)
{
OnDetectionWarningStop?.Invoke(detectionDes);
}
public ImageSaveHelper ImageSaveHelper { get; set; } = new ImageSaveHelper();
public virtual void SaveImageAsync(string fullname, Bitmap saveMap, ImageFormat imageFormat)
{
if (saveMap != null)
{
ImageSaveSet imageSaveSet = new ImageSaveSet()
{
FullName = fullname,
SaveImage = saveMap.CopyBitmap(),
ImageFormat = imageFormat.DeepSerializeClone()
};
ImageSaveHelper.ImageSaveAsync(imageSaveSet);
}
}
}
}

View File

@ -16,9 +16,11 @@
<ItemGroup> <ItemGroup>
<PackageReference Include="AntdUI" Version="1.8.9" /> <PackageReference Include="AntdUI" Version="1.8.9" />
<PackageReference Include="Newtonsoft.Json" Version="13.0.3" />
<PackageReference Include="OpenCvSharp4" Version="4.10.0.20241108" /> <PackageReference Include="OpenCvSharp4" Version="4.10.0.20241108" />
<PackageReference Include="OpenCvSharp4.Extensions" Version="4.10.0.20241108" /> <PackageReference Include="OpenCvSharp4.Extensions" Version="4.10.0.20241108" />
<PackageReference Include="OpenCvSharp4.runtime.win" Version="4.10.0.20241108" /> <PackageReference Include="OpenCvSharp4.runtime.win" Version="4.10.0.20241108" />
<PackageReference Include="System.IO.Ports" Version="9.0.3" />
</ItemGroup> </ItemGroup>
<ItemGroup> <ItemGroup>

View File

@ -1,16 +0,0 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace DH.Commons.Enums
{
public class CameraInfo
{
public string CamName { get; set; }
public string Serinum { get; set; }
public string IP { get; set; }
}
}

View File

@ -7,12 +7,61 @@ using System.Threading.Tasks;
namespace DH.Commons.Enums namespace DH.Commons.Enums
{ {
public enum EnumStatus
{
,
,
,
}
public enum ModelType
{
= 1,
= 2,
= 3,
= 4,
GPU = 5
}
public enum SelectPicType
{
[Description("训练图片")]
train = 0,
[Description("测试图片")]
test
}
public enum NetModel
{
[Description("目标检测")]
training = 0,
[Description("语义分割")]
train_seg,
[Description("模型导出")]
emport,
[Description("推理预测")]
infernce
}
public enum EnumCamType
{
[Description("度申相机")]
Do3think = 0,
[Description("海康相机")]
hik ,
}
public enum EnumPLCType public enum EnumPLCType
{ {
XC_串口, [Description("信捷XC串口")]
XC_网口, XC串口 = 0,
XD_串口, [Description("信捷XC网口")]
XD_网口 XC网口 = 1,
[Description("信捷XD串口")]
XD串口 = 2,
[Description("信捷XD网口")]
XD网口 = 3
} }
@ -28,35 +77,70 @@ namespace DH.Commons.Enums
public enum EnumPLCOutputIO public enum EnumPLCOutputIO
{ {
=0, =0,
=1, ,
使=2, 使,
=3, ,
=4, ,
绿=5, 绿,
=6, ,
=7, ,
=8, ,
=9, ,
=10, ,
1=11, 1,
2=12, 2,
3=13, 3,
4=14, 4,
5=15, 5,
OK料盒=16, 6 ,
NG料盒=17, 7 ,
OK吹气时间=18, 8 ,
NG吹气时间=19, 9 ,
=20, 10 ,
=21, ,
=22, ,
=23, ,
=24, ,
=25 ,
,
,
,
,
,
,
,
,
,
OK脉冲,
NG脉冲,
,
,
} }
public enum EnumPLCDataType
{
,
,
,
}
public enum EnumBool
{
,
}
public enum EnumBool1
{
False,
True
}
public enum StreamFormat public enum StreamFormat
{ {
[Description("8位图像")] [Description("8位图像")]
@ -542,5 +626,15 @@ namespace DH.Commons.Enums
//[Description("插补模式")] //[Description("插补模式")]
//Coordinate = 11 //Coordinate = 11
} }
public enum CameraAcquisitionMode
{
=0,
=1
}
public enum CameraTriggerMode
{
= 0,
= 1
}
} }

View File

@ -0,0 +1,64 @@
using System;
using static DH.Commons.Enums.EnumHelper;
namespace DH.Commons.Helper
{
public enum ExceptionLevel
{
Info = 0,
Warning = 1,
Fatal = 2,
}
//public delegate void OnProcessExceptionRaisedDelegate(DateTime dt, ProcessException ex);
//[Serializable]
public class ProcessException : Exception
{
public ExceptionLevel Level { get; set; } = ExceptionLevel.Warning;
public ProcessException()
{
}
public ProcessException(Exception ex, ExceptionLevel lvl = ExceptionLevel.Warning) : base(ex.Message, ex)
{
Level = lvl;
ExceptionNotice();
}
public ProcessException(string error, Exception ex = null, ExceptionLevel lvl = ExceptionLevel.Warning) : base(error, ex)
{
Level = lvl;
ExceptionNotice();
}
public void ExceptionNotice()
{
//OnProcessExceptionRaised?.Invoke(DateTime.Now, this);
}
}
public static class ExceptionHelper
{
public static LogLevel LogLevel = LogLevel.Information;
public static string GetExceptionMessage(this Exception ex)
{
string msg = "异常信息:" + ex.Message;
if (ex.InnerException != null)
{
msg += "\t内部异常信息" + ex.InnerException.GetExceptionMessage();
}
if (LogLevel <= LogLevel.Assist)
{
msg += ("\r\n\t\tStackTrace:" + ex.StackTrace);
}
return msg;
}
}
public class AuthorityException : ProcessException
{
}
}

View File

@ -0,0 +1,162 @@
using DH.Commons.Enums;
using System;
using System.ComponentModel;
using System.Runtime.CompilerServices;
using static DH.Commons.Enums.EnumHelper;
namespace DH.Commons.Enums
{
/// <summary>
/// 设备特性,指示该信息的设备类型,适用于设备信息和配置信息
/// </summary>
public class DeviceAttribute : Attribute
{
/// <summary>
/// 设备类型
/// </summary>
public string TypeCode { get; set; }
public string TypeDescription { get; set; }
/// <summary>
/// 特性修饰类别
/// </summary>
public DeviceAttributeType AttrType { get; set; }
public DeviceAttribute(string typeCode, string typeDesc, EnumHelper.DeviceAttributeType attrType)
{
TypeCode = typeCode;
TypeDescription = typeDesc;
AttrType = attrType;
}
}
/// <summary>
/// 预置状态特性 指定该修饰信息的前置状态允许范围
/// </summary>
public class PreStateAttribute : Attribute
{
public int PreState { get; set; }
public PreStateAttribute(int _preState)
{
PreState = _preState;
}
/// <summary>
/// 检查当前待执行操作的前置状态要求是否合法
/// </summary>
/// <param name="currentState"></param>
/// <returns></returns>
public bool CheckPreStateValid(int currentState)
{
return (currentState & PreState) == currentState;
}
}
public class ColorSelectAttribute : Attribute
{
public string SelectedColor { get; set; }
public ColorSelectAttribute(string selectedColor)
{
SelectedColor = selectedColor;
}
}
public class FontColorSelectAttribute : Attribute
{
public string SelectedColor { get; set; }
public FontColorSelectAttribute(string selectedColor)
{
SelectedColor = selectedColor;
}
}
public enum InvokeType
{
/// <summary>
/// 不公开调用
/// </summary>
[Description("不公开调用")]
NoneInvoke = 0,
/// <summary>
/// 测试调用
/// </summary>
[Description("测试调用")]
TestInvoke = 1,
/// <summary>
/// 标定调用
/// </summary>
[Description("标定调用")]
CalibInvoke = 2,
}
/// <summary>
/// 用来修饰对外开放的调用方法的特性
/// 调用方法参数顺序IOperationConfigInvokeDeviceSourceDevice
/// </summary>
public class ProcessMethodAttribute : Attribute
{
public string MethodCode { get; set; }
public string MethodDesc { get; set; }
/// <summary>
/// 是否提供人工调用测试
/// </summary>
public InvokeType InvokeType { get; set; }
public string DeviceType { get; set; }
public ProcessMethodAttribute(string deviceType, string code, string description, InvokeType invokeType)
{
DeviceType = deviceType;
MethodCode = code;
MethodDesc = description;
InvokeType = invokeType;
}
}
public class SwitchDisplayAttribute : Attribute
{
public string SwitchName { get; set; }
public bool SwithOnStatus { get; set; } = true;
public SwitchDisplayAttribute(string name, bool status)
{
SwitchName = name;
SwithOnStatus = status;
}
}
public class ElementAttribute : Attribute
{
public string Name { get; set; }
public string Desc { get; set; }
public string IconPath { get; set; }
public bool IsShowInToolBar { get; set; }
public ElementAttribute(string desc, string iconPath, bool isShowInToolBar = true, [CallerMemberName] string name = "")
{
Name = name;
Desc = desc;
IconPath = iconPath;
IsShowInToolBar = isShowInToolBar;
}
}
public class ProcessAttribute : Attribute
{
public string ProcessCode { get; set; }
public DeviceAttributeType AttrType { get; set; }
public ProcessAttribute(string stationCode, DeviceAttributeType attrType)
{
ProcessCode = stationCode;
AttrType = attrType;
}
}
}

View File

@ -0,0 +1,272 @@
using System;
using System.Diagnostics;
using System.IO;
using System.Text.Json;
using System.Text.Json.Serialization;
using AntdUI;
using DH.Commons.Base;
using DH.Commons.Models;
namespace DH.Commons.Helper
{
public static class ConfigHelper
{
private static readonly JsonSerializerOptions _jsonOptions = new JsonSerializerOptions
{
WriteIndented = true,
PropertyNamingPolicy = JsonNamingPolicy.CamelCase,
IgnoreNullValues = true
};
/// <summary>
/// 配置存储根目录
/// </summary>
private static string ConfigsRoot => Path.Combine(
AppDomain.CurrentDomain.BaseDirectory,
"configs");
/// <summary>
/// 获取当前方案的主配置文件路径
/// </summary>
private static string CurrentConfigPath
{
get
{
ValidateCurrentScheme();
return Path.Combine(
ConfigsRoot,
$"config_{SystemModel.CurrentScheme}.json");
}
}
/// <summary>
/// 获取当前方案的备份目录路径
/// </summary>
private static string CurrentBackupDir
{
get
{
ValidateCurrentScheme();
return Path.Combine(
ConfigsRoot,
$"bak_{SystemModel.CurrentScheme}");
}
}
/// <summary>
/// 初始化新方案(创建空文件)
/// </summary>
public static void InitializeScheme(string scheme)
{
SystemModel.CurrentScheme = scheme;
// 创建空配置文件
if (!File.Exists(CurrentConfigPath))
{
Directory.CreateDirectory(ConfigsRoot);
File.WriteAllText(CurrentConfigPath, "{}");
}
// 创建备份目录
Directory.CreateDirectory(CurrentBackupDir);
}
/// <summary>
/// 保存当前配置(自动备份)
/// </summary>
public static void SaveConfig()
{
ValidateCurrentScheme();
// 确保配置目录存在
Directory.CreateDirectory(ConfigsRoot);
// 备份现有配置
if (File.Exists(CurrentConfigPath))
{
var backupName = $"config_{SystemModel.CurrentScheme}_{DateTime.Now:yyyyMMddHHmmss}.json";
var backupPath = Path.Combine(CurrentBackupDir, backupName);
Directory.CreateDirectory(CurrentBackupDir);
File.Copy(CurrentConfigPath, backupPath);
}
//重置标签文件路径和内容
ConfigModel.DetectionList.ForEach(config =>
{
GenerateLabelFile(config);
});
// 序列化当前配置
var json = JsonSerializer.Serialize(new
{
ConfigModel.CameraBaseList,
ConfigModel.PLCBaseList,
ConfigModel.DetectionList,
ConfigModel.GlobalList,
}, _jsonOptions);
// 写入新配置
File.WriteAllText(CurrentConfigPath, json);
}
private static void GenerateLabelFile(DetectionConfig config)
{
try
{
if (config.DetectionLableList == null || string.IsNullOrEmpty(config.In_lable_path))
return;
// 确保目录存在
var directory = Path.GetDirectoryName(config.In_lable_path);
if (!string.IsNullOrEmpty(directory) && !Directory.Exists(directory))
{
Directory.CreateDirectory(directory);
}
// 写入文件内容
using (var writer = new StreamWriter(config.In_lable_path, false))
{
foreach (var label in config.DetectionLableList)
{
// 根据实际需求格式化输出
writer.WriteLine(label.LabelName.ToString()); // 假设DetectionLable重写了ToString()
// 或者明确指定格式:
// writer.WriteLine($"{label.Id},{label.Name},{label.Confidence}");
}
}
}
catch (Exception ex)
{
Debug.WriteLine($"生成标签文件失败: {ex.Message}");
// 可以考虑记录更详细的日志
}
}
/// <summary>
/// 加载当前方案配置
/// </summary>
public static void LoadConfig()
{
ValidateCurrentScheme();
if (!File.Exists(CurrentConfigPath))
{
InitializeScheme(SystemModel.CurrentScheme);
return;
}
var json = File.ReadAllText(CurrentConfigPath);
var data = JsonSerializer.Deserialize<ConfigData>(json, _jsonOptions);
ConfigModel.CameraBaseList = data?.Cameras ?? new List<CameraBase>();
ConfigModel.DetectionList = data?.Detections ?? new List<DetectionConfig>();
ConfigModel.PLCBaseList = data?.PLCs ?? new List<PLCBase>();
ConfigModel.GlobalList = data?.GlobalConfigs ?? new List<GlobalConfig>();
}
/// <summary>
/// 验证当前方案有效性
/// </summary>
private static void ValidateCurrentScheme()
{
if (string.IsNullOrWhiteSpace(SystemModel.CurrentScheme))
throw new InvalidOperationException("当前方案未设置");
}
/// <summary>
/// 派生新方案(基于当前方案创建副本)
/// </summary>
/// <param name="newSchemeName">新方案名称</param>
public static void DeriveScheme(string newSchemeName)
{
// 验证输入
if (string.IsNullOrWhiteSpace(newSchemeName))
{
throw new ArgumentException("新方案名称不能为空");
}
// 验证当前方案是否有效
ValidateCurrentScheme();
// 检查新方案是否已存在
var newConfigPath = Path.Combine(ConfigsRoot, $"config_{newSchemeName}.json");
if (File.Exists(newConfigPath))
{
throw new InvalidOperationException($"方案 {newSchemeName} 已存在");
}
// 保存当前配置确保最新
SaveConfig();
try
{
// 复制配置文件
File.Copy(CurrentConfigPath, newConfigPath);
// 创建备份目录
var newBackupDir = Path.Combine(ConfigsRoot, $"bak_{newSchemeName}");
Directory.CreateDirectory(newBackupDir);
// 可选:自动切换新方案
// SystemModel.CurrentScheme = newSchemeName;
}
catch (IOException ex)
{
throw new InvalidOperationException($"方案派生失败: {ex.Message}", ex);
}
}
/// <summary>
/// 删除指定方案的配置文件及备份目录
/// </summary>
/// <param name="schemeName">要删除的方案名称</param>
/// <exception cref="ArgumentException">当方案名称为空时抛出</exception>
/// <exception cref="IOException">文件操作失败时抛出</exception>
public static void DeleteSchemeConfig(string schemeName)
{
if (string.IsNullOrWhiteSpace(schemeName))
throw new ArgumentException("方案名称无效");
// 构造路径
var configPath = Path.Combine(ConfigsRoot, $"config_{schemeName}.json");
var backupDir = Path.Combine(ConfigsRoot, $"bak_{schemeName}");
try
{
// 删除配置文件
if (File.Exists(configPath))
{
File.Delete(configPath);
}
// 删除备份目录(递归删除)
if (Directory.Exists(backupDir))
{
Directory.Delete(backupDir, true);
}
}
catch (Exception ex) when (ex is IOException || ex is UnauthorizedAccessException)
{
throw new IOException($"删除方案 {schemeName} 的配置文件失败: {ex.Message}", ex);
}
}
/// <summary>
/// 配置数据模型(内部类)
/// </summary>
private class ConfigData
{
[JsonPropertyName("cameraBaseList")]
public List<CameraBase> Cameras { get; set; } = new List<CameraBase>();
[JsonPropertyName("plcBaseList")]
public List<PLCBase> PLCs { get; set; } = new List<PLCBase>();
[JsonPropertyName("detectionList")]
public List<DetectionConfig> Detections { get; set; } = new List<DetectionConfig>();
[JsonPropertyName("globalList")]
public List<GlobalConfig> GlobalConfigs { get; set; } = new List<GlobalConfig>();
}
}
}

View File

@ -76,159 +76,83 @@ namespace DH.Commons.Enums
} }
} }
//public static System.Windows.Media.Color GetEnumSelectedMediaColor(this Enum enumObj) // 根据描述获取枚举值(泛型方法)
//{ public static T GetEnumFromDescription<T>(string description) where T : Enum
// Type t = enumObj.GetType(); {
// FieldInfo f = t.GetField(enumObj.ToString()); Type enumType = typeof(T);
foreach (T value in Enum.GetValues(enumType))
// ColorSelectAttribute attr = f.GetCustomAttribute<ColorSelectAttribute>(); {
// if (attr != null) string desc = GetEnumDescription(value);
// { if (desc == description)
// var prop = typeof(System.Windows.Media.Colors).GetProperties().FirstOrDefault(p => p.Name == attr.SelectedColor); {
// if (prop != null) return value;
// { }
// return (System.Windows.Media.Color)prop.GetValue(null); }
// } throw new ArgumentException($"在枚举 {enumType.Name} 中未找到描述为 '{description}' 的值");
// } }
// return System.Windows.Media.Colors.Transparent;
//}
//public static System.Drawing.Color GetEnumSelectedColor(this Enum enumObj)
//{
// Type t = enumObj.GetType();
// FieldInfo f = t.GetField(enumObj.ToString());
// ColorSelectAttribute attr = f.GetCustomAttribute<ColorSelectAttribute>();
// if (attr != null)
// {
// return System.Drawing.Color.FromName(attr.SelectedColor);
// }
// else
// {
// return System.Drawing.Color.Transparent;
// }
//}
//public static System.Drawing.Color GetEnumSelectedFontColor(this Enum enumObj)
//{
// Type t = enumObj.GetType();
// FieldInfo f = t.GetField(enumObj.ToString());
// var attr = f.GetCustomAttribute<FontColorSelectAttribute>();
// if (attr != null)
// {
// return System.Drawing.Color.FromName(attr.SelectedColor);
// }
// else
// {
// return System.Drawing.Color.Transparent;
// }
//}
//public static string GetEnumSelectedColorString(this Enum enumObj)
//{
// Type t = enumObj.GetType();
// FieldInfo f = t.GetField(enumObj.ToString());
// ColorSelectAttribute attr = f.GetCustomAttribute<ColorSelectAttribute>();
// if (attr != null)
// {
// return attr.SelectedColor;
// }
// else
// {
// return "Transparent";
// }
//}
/// <summary> /// <summary>
/// 当枚举牵涉到状态变换,检查现状态是否满足待转换的状态的前置状态要求 /// 获取枚举类型的所有描述文本
/// </summary> /// </summary>
/// <param name="stateToBe"></param> /// <param name="enumType">枚举类型</param>
/// <param name="currentState"></param> /// <returns>描述文本列表</returns>
/// <returns></returns> public static List<string> GetEnumDescriptions(Type enumType)
//public static bool CheckPreStateValid(this Enum stateToBe, int currentState) {
//{ // 验证类型是否为枚举
// Type t = stateToBe.GetType(); if (!enumType.IsEnum)
// FieldInfo f = t.GetField(stateToBe.ToString()); throw new ArgumentException("传入的类型必须是枚举类型", nameof(enumType));
// PreStateAttribute attr = f.GetCustomAttribute<PreStateAttribute>(); var descriptions = new List<string>();
// if (attr == null)
// {
// return true;
// }
// else
// {
// return attr.CheckPreStateValid(currentState);
// }
//}
/// <summary> foreach (var value in Enum.GetValues(enumType))
/// 设备状态定义 {
/// 未初始化和异常状态无前置状态要求 var fieldInfo = enumType.GetField(value.ToString());
/// 初始化操作前置状态必须是未初始化、关闭状态和异常状态 var attribute = fieldInfo.GetCustomAttribute<DescriptionAttribute>();
/// 打开前置必须是初始化和暂停 descriptions.Add(attribute?.Description ?? value.ToString());
/// 关闭前置必须是打开和暂停和异常 }
/// 暂停前置必须是打开
/// </summary>
//public enum DeviceState
//{
// TBD = -1,
// [ColorSelect("Gray")] return descriptions;
// [FontColorSelect("Black")] }
// [Description("未初始化")] public static string GetEnumDescription1(Enum value)
// DSUninit = 1, {
var field = value.GetType().GetField(value.ToString());
var attribute = field.GetCustomAttributes(typeof(DescriptionAttribute), false)
.FirstOrDefault() as DescriptionAttribute;
return attribute?.Description ?? value.ToString();
}
// [ColorSelect("Gold")] public static System.Drawing.Color GetEnumSelectedColor(this Enum enumObj)
// [FontColorSelect("White")] {
// [PreState(1 + 2 + 4 + 8 + 32)] Type t = enumObj.GetType();
// [Description("初始化")] FieldInfo f = t.GetField(enumObj.ToString());
// DSInit = 2,
// [ColorSelect("Lime")] ColorSelectAttribute attr = f.GetCustomAttribute<ColorSelectAttribute>();
// [FontColorSelect("Black")] if (attr != null)
// [PreState(2 + 4 + 16)] {
// [Description("运行中")] return System.Drawing.Color.FromName(attr.SelectedColor);
// DSOpen = 4, }
else
{
return System.Drawing.Color.Transparent;
}
}
// [ColorSelect("Gray")] public static System.Drawing.Color GetEnumSelectedFontColor(this Enum enumObj)
// [FontColorSelect("White")] {
// [PreState(1 + 4 + 8 + 16 + 32)] Type t = enumObj.GetType();
// [Description("关闭")] FieldInfo f = t.GetField(enumObj.ToString());
// DSClose = 8,
// [ColorSelect("Gold")] var attr = f.GetCustomAttribute<FontColorSelectAttribute>();
// [FontColorSelect("White")] if (attr != null)
// [PreState(4 + 16)] {
// [Description("暂停")] return System.Drawing.Color.FromName(attr.SelectedColor);
// DSPause = 16, }
else
{
return System.Drawing.Color.Transparent;
}
}
// [ColorSelect("Red")]
// [FontColorSelect("White")]
// [Description("异常")]
// DSExcept = 32
//}
///// <summary>
///// 工序状态
///// </summary>
//public enum RunState
//{
// [ColorSelect("Gold")]
// [Description("空闲")]
// Idle = 1,
// [ColorSelect("Lime")]
// [Description("运行中")]
// Running = 2,
// [ColorSelect("Gray")]
// [Description("停止")]
// Stop = 3,
// [ColorSelect("Red")]
// [Description("宕机")]
// Down = 99,
//}
[Flags] [Flags]
public enum DeviceAttributeType public enum DeviceAttributeType
@ -362,6 +286,37 @@ namespace DH.Commons.Enums
MeasureResult = 31, MeasureResult = 31,
} }
public enum LogLevel
{
[Description("详细")]
[ColorSelect("White")]
[FontColorSelect("Green")]
Detail = 2,
[Description("信息")]
[ColorSelect("White")]
[FontColorSelect("Dark")]
Information = 3,
[Description("辅助")]
[ColorSelect("White")]
[FontColorSelect("Blue")]
Assist = 4,
[Description("动作")]
[ColorSelect("DarkGreen")]
[FontColorSelect("Yellow")]
Action = 5,
[Description("错误")]
[ColorSelect("Orange")]
[FontColorSelect("White")]
Error = 6,
[Description("警报")]
[ColorSelect("Brown")]
[FontColorSelect("White")]
Warning = 7,
[Description("异常")]
[ColorSelect("Red")]
[FontColorSelect("White")]
Exception = 8,
}
//public enum CameraDriverType //public enum CameraDriverType
//{ //{
// Halcon, // Halcon,
@ -382,6 +337,59 @@ namespace DH.Commons.Enums
// NG = -1, // NG = -1,
// IGNORE = -999, // IGNORE = -999,
//} //}
public enum DeviceState
{
TBD = -1,
[ColorSelect("Gray")]
[FontColorSelect("Black")]
[Description("未初始化")]
DSUninit = 1,
[ColorSelect("Gold")]
[FontColorSelect("White")]
[PreState(1 + 2 + 4 + 8 + 32)]
[Description("初始化")]
DSInit = 2,
[ColorSelect("Lime")]
[FontColorSelect("Black")]
[PreState(2 + 4 + 16)]
[Description("运行中")]
DSOpen = 4,
[ColorSelect("Gray")]
[FontColorSelect("White")]
[PreState(1 + 4 + 8 + 16 + 32)]
[Description("关闭")]
DSClose = 8,
[ColorSelect("Gold")]
[FontColorSelect("White")]
[PreState(4 + 16)]
[Description("暂停")]
DSPause = 16,
[ColorSelect("Red")]
[FontColorSelect("White")]
[Description("异常")]
DSExcept = 32
}
public enum RunState
{
[ColorSelect("Gold")]
[Description("空闲")]
Idle = 1,
[ColorSelect("Lime")]
[Description("运行中")]
Running = 2,
[ColorSelect("Gray")]
[Description("停止")]
Stop = 3,
[ColorSelect("Red")]
[Description("宕机")]
Down = 99,
}
public enum PriorityDirection public enum PriorityDirection
{ {

View File

@ -0,0 +1,107 @@

using System;
using System.Collections.Concurrent;
using System.Collections.Generic;
using System.Drawing;
using System.Drawing.Imaging;
using System.IO;
using System.Linq;
using System.Text;
using System.Threading;
using System.Threading.Tasks;
using DH.Commons.Helper;
namespace DH.Commons.Enums
{
public class ImageSaveHelper
{
public event Action<DateTime, string> OnImageSaveExceptionRaised;
//private string baseDirectory = "";
//public string BaseDirectory
//{
// get => baseDirectory;
// set
// {
// baseDirectory = value;
// if (string.IsNullOrWhiteSpace(baseDirectory) || !Path.IsPathRooted(baseDirectory))
// {
// baseDirectory = Path.Combine(AppDomain.CurrentDomain.BaseDirectory, "Images");
// }
// }
//}
public bool EnableImageSave { get; set; } = true;
public ImageSaveHelper() { }
public ImageSaveHelper(bool enableImageSave = true)
{
EnableImageSave = enableImageSave;
}
object lockObj = new object();
////耗时操作从 _taskFactory分配线程
//public TaskFactory _taskFactory = new TaskFactory(TaskCreationOptions.LongRunning, TaskContinuationOptions.LongRunning);
readonly ConcurrentQueue<ImageSaveSet> _imageQueue = new ConcurrentQueue<ImageSaveSet>();
Task _saveTask = null;
readonly object _saveLock = new object();
public async void ImageSaveAsync(ImageSaveSet set)
{
if (!EnableImageSave)
return;
await Task.Run(() =>
{
_imageQueue.Enqueue(set);
lock (_saveLock)
{
if (_saveTask == null)
{
_saveTask = Task.Run(async () =>
{
try
{
while (true)
{
while (_imageQueue.Count > 0)
{
if (_imageQueue.TryDequeue(out ImageSaveSet saveSet))
{
if (!Directory.Exists(Path.GetDirectoryName(saveSet.FullName)))
{
Directory.CreateDirectory(Path.GetDirectoryName(saveSet.FullName));
}
if (saveSet.SaveImage != null)
{
saveSet.SaveImage.Save(saveSet.FullName, saveSet.ImageFormat);
saveSet.SaveImage.Dispose();
}
saveSet = null;
}
}
await Task.Delay(2000);
}
}
catch (Exception ex)
{
OnImageSaveExceptionRaised?.Invoke(DateTime.Now, $"图片保存异常:{ex.GetExceptionMessage()}");
}
});
}
}
});
}
}
public class ImageSaveSet
{
public string FullName { get; set; }//带后缀 全路径
public Bitmap SaveImage { get; set; }
public ImageFormat ImageFormat { get; set; } = ImageFormat.Jpeg;
}
}

View File

@ -0,0 +1,138 @@
using DH.Commons.Helper;
using System;
using System.Collections.Concurrent;
using System.IO;
using System.Threading;
using System.Threading.Tasks;
using static DH.Commons.Enums.EnumHelper;
namespace DH.Commons.Enums
{
public interface ILogOutput
{
event Action<LogMsg> OnLogMsgOutput;
void LogDisplay(LogMsg msg);
}
public interface ILogger
{
event Action<LogMsg> OnLog;
LoggerHelper LoggerHelper { get; set; }
//void LogAsync(DateTime dt, LogLevel loglevel, string msg);
void LogAsync(LogMsg msg);
}
public class LoggerHelper
{
public event Action<DateTime, string> OnLogExceptionRaised;
public string LogPath { get; set; }
public string LogPrefix { get; set; }
LogLevel LogLevel = LogLevel.Information;
public LoggerHelper() { }
public LoggerHelper(string logPath, string logPrefix, LogLevel logLevel = LogLevel.Information)
{
LogPath = logPath;
LogPrefix = logPrefix;
LogLevel = logLevel;
}
public void SetLogLevel(LogLevel logLevel)
{
if (LogLevel != logLevel)
LogLevel = logLevel;
}
////耗时操作从 _taskFactory分配线程
//public TaskFactory _taskFactory = new TaskFactory(TaskCreationOptions.LongRunning, TaskContinuationOptions.LongRunning);
readonly ConcurrentQueue<LogMsg> _logQueue = new ConcurrentQueue<LogMsg>();
Task _logTask = null;
readonly object _logLock = new object();
public async void LogAsync(LogMsg msg)
{
await Task.Run(() =>
{
_logQueue.Enqueue(msg);
lock (_logLock)
{
if (_logTask == null)
{
_logTask = Task.Run(async () =>
{
string filePath = Path.Combine(LogPath, $"{(string.IsNullOrWhiteSpace(LogPrefix) ? "Log_" : ("Log_" + LogPrefix + "_"))}{DateTime.Now.ToString("yyyyMMdd")}.txt");
try
{
if (!StaticHelper.CheckFilesCanUse(filePath))
{
OnLogExceptionRaised?.Invoke(DateTime.Now, $"日志文件{filePath}被占用,无法写入");
return;
}
using (StreamWriter writer = new StreamWriter(filePath, true, System.Text.Encoding.UTF8))
{
while (true)
{
if (!Directory.Exists(LogPath))
{
Directory.CreateDirectory(LogPath);
}
while (_logQueue.Count > 0)
{
if (_logQueue.TryDequeue(out LogMsg log))
{
if (log.LogLevel >= LogLevel)
{
writer.WriteLine($"{log.LogTime.ToString("yyyy-MM-dd HH:mm:ss.fff")}[{log.ThreadId}]\t{log.LogLevel.GetEnumDescription()}\t{log.Msg}");
}
}
}
writer.Flush();
await Task.Delay(2000);
}
}
}
catch (Exception ex)
{
//OnLogExceptionRaised?.Invoke(DateTime.Now, $"日志文件{filePath}写入异常:/*{ex.GetExceptionMessage()*/}");
OnLogExceptionRaised?.Invoke(DateTime.Now, $"日志文件{filePath}写入异常");
}
});
}
}
});
}
public void LogAsync(DateTime dt, LogLevel logLevel, string msg)
{
LogAsync(new LogMsg(dt, logLevel, msg));
}
}
public class LogMsg
{
public DateTime LogTime { get; set; }
public LogLevel LogLevel { get; set; }
//public string Prefix { get; set; }
public string Msg { get; set; }
public string MsgSource { get; set; }
public int ThreadId { get; set; }
public LogMsg() { }
public LogMsg(DateTime dt, LogLevel logLevel, string msg)
{
LogTime = dt;
LogLevel = logLevel;
Msg = msg;
}
public override string ToString()
{
return $"{LogTime.ToString("HH:mm:ss.fff")}\t{MsgSource}\t{Msg}";
}
}
}

View File

@ -0,0 +1,117 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace DH.Commons.Helper
{
public static class SchemeHelper
{
private const string SchemesKey = "Schemes";
private const string CurrentSchemeKey = "CurrentScheme";
private const char Separator = '|';
/// <summary>
/// 初始化配置(首次运行时调用)
/// </summary>
public static void Initialize()
{
// 如果Schemes不存在创建空键
if (!SystemConfigHelper.KeyExists(SchemesKey))
{
SystemConfigHelper.SetValue(SchemesKey, "");
}
// 如果CurrentScheme不存在创建空键
if (!SystemConfigHelper.KeyExists(CurrentSchemeKey))
{
SystemConfigHelper.SetValue(CurrentSchemeKey, "");
}
}
/// <summary>
/// 获取所有方案(自动处理空值)
/// </summary>
public static List<string> GetAllSchemes()
{
var schemeString = SystemConfigHelper.GetValue(SchemesKey, "");
return string.IsNullOrEmpty(schemeString)
? new List<string>()
: new List<string>(schemeString.Split(Separator));
}
/// <summary>
/// 添加新方案(自动初始化处理)
/// </summary>
public static void AddScheme(string schemeName)
{
if (string.IsNullOrWhiteSpace(schemeName))
throw new ArgumentException("方案名称无效");
var schemes = GetAllSchemes();
if (schemes.Contains(schemeName))
throw new InvalidOperationException($"方案 {schemeName} 已存在");
schemes.Add(schemeName);
SaveSchemes(schemes);
}
/// <summary>
/// 设置当前方案(空值安全处理)
/// </summary>
public static void SetCurrentScheme(string schemeName)
{
var schemes = GetAllSchemes();
if (!schemes.Contains(schemeName))
throw new KeyNotFoundException($"方案 {schemeName} 不存在");
SystemConfigHelper.SetValue(CurrentSchemeKey, schemeName);
}
/// <summary>
/// 获取当前方案(默认值处理)
/// </summary>
public static string GetCurrentScheme()
{
var current = SystemConfigHelper.GetValue(CurrentSchemeKey, "");
return !string.IsNullOrEmpty(current) ? current : "默认方案";
}
private static void SaveSchemes(List<string> schemes)
{
var schemeString = schemes.Count > 0
? string.Join(Separator.ToString(), schemes)
: "";
SystemConfigHelper.SetValue(SchemesKey, schemeString);
}
/// <summary>
/// 删除指定方案(自动同步当前方案状态)
/// </summary>
/// <param name="schemeName">要删除的方案名称</param>
/// <exception cref="ArgumentException">当方案名称为空时抛出</exception>
/// <exception cref="KeyNotFoundException">当方案不存在时抛出</exception>
public static void DeleteScheme(string schemeName)
{
if (string.IsNullOrWhiteSpace(schemeName))
throw new ArgumentException("方案名称无效");
var schemes = GetAllSchemes();
if (!schemes.Contains(schemeName))
throw new KeyNotFoundException($"方案 {schemeName} 不存在");
// 删除前检查是否是当前方案
bool isCurrent = GetCurrentScheme() == schemeName;
// 执行删除操作
schemes.Remove(schemeName);
SaveSchemes(schemes);
}
}
}

View File

@ -0,0 +1,680 @@
using Microsoft.CSharp.RuntimeBinder;
using Newtonsoft.Json;
using System.Collections.ObjectModel;
using System.Drawing.Imaging;
using System.Dynamic;
using System.Linq.Expressions;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.ExceptionServices;
using System.Runtime.InteropServices;
using System.Runtime.Serialization.Formatters.Binary;
namespace DH.Commons.Helper
{
public static class StaticHelper
{
/// <summary>
/// 数值转换为byte数组 高位在前,低位在后
/// </summary>
/// <param name="number"></param>
/// <param name="size"></param>
/// <returns></returns>
public static byte[] IntToBytes(this int number, int size = 2)
{
byte[] result = new byte[size];
int temp = size;
while (temp > 0)
{
result[size - temp] = (byte)(number >> ((temp - 1) * 8) & 0xff);
temp--;
}
return result;
}
public static T DeepSerializeClone<T>(this T t)
{
return JsonConvert.DeserializeObject<T>(JsonConvert.SerializeObject(t));
}
/// <summary>
/// 字节数组转换为整数
/// </summary>
/// <param name="data">字节数组</param>
/// <param name="HtL">true:数组序号低的在高位 false数组序号低的在低位</param>
/// <returns></returns>
public static int BytesToInt(this byte[] data, bool HtL = true)
{
int res = 0;
for (int i = 0; i < data.Length; i++)
{
int index = i;
if (HtL)
{
index = data.Length - 1 - i;
}
res += data[index] << (8 * i);
}
return res;
}
/// <summary>
/// 获取一个类指定的属性值
/// </summary>
/// <param name="info">object对象</param>
/// <param name="field">属性名称</param>
/// <returns></returns>
public static object GetPropertyValue(object info, string field)
{
if (info == null) return null;
Type t = info.GetType();
IEnumerable<System.Reflection.PropertyInfo> property = from pi in t.GetProperties() where pi.Name.ToLower() == field.ToLower() select pi;
return property.First().GetValue(info, null);
}
/// <summary>
/// 将32位整形拆分为无符号16位整形
/// </summary>
/// <param name="num">需要拆分的32位整形</param>
/// <param name="bitNum">拆分为16位整形的位数 1或者2</param>
/// <param name="HtL">true高位在前低位在后false高位在后低位在前</param>
/// <returns></returns>
public static List<ushort> ParseIntToUnsignShortList(this int num, int bitNum = 2, bool HtL = false)
{
if (bitNum == 2)
{
ushort high = (ushort)(num >> 16);
ushort low = (ushort)num;
if (HtL)
{
return new List<ushort>() { high, low };
}
else
{
return new List<ushort>() { low, high };
}
}
else
{
if (num < 0)
{
num = ushort.MaxValue + 1 + num;
}
return new List<ushort>() { (ushort)num };
}
}
/// <summary>
/// 将32位整形数组拆分为无符号16位整形数组
/// </summary>
/// <param name="list">需要拆分的32位整形</param>
/// <param name="bitNum">拆分为16位整形的位数 1或者2</param>
/// <param name="HtL">true高位在前低位在后false高位在后低位在前</param>
/// <returns></returns>
public static List<ushort> ParseIntToUnsignShortList(this List<int> list, int bitNum = 2, bool HtL = false)
{
return list.SelectMany(u => u.ParseIntToUnsignShortList(bitNum, HtL)).ToList();
}
/// <summary>
/// 将ushort的集合转换为16位带符号整形
/// </summary>
/// <param name="numList"></param>
/// <param name="bitNum">合并的位数 1或者2</param>
/// <param name="HtL">true高位在前低位在后false高位在后低位在前</param>
/// <returns></returns>
public static List<int> ParseUnsignShortListToInt(this List<int> numList, int bitNum = 2, bool HtL = false)
{
if (bitNum == 1)
{
return numList.ConvertAll(n =>
{
int num = n;
if (num > short.MaxValue)
{
num = num - ushort.MaxValue - 1;
}
return num;
});
}
else
{
List<int> list = new List<int>();
for (int i = 0; i < numList.Count; i += 2)
{
int high = HtL ? numList[i] : numList[i + 1];
int low = HtL ? numList[i + 1] : numList[i];
list.Add((high << 16) | low);
}
return list;
}
}
//public static T DeepSerializeClone<T>(this T t)
//{
// return JsonConvert.DeserializeObject<T>(JsonConvert.SerializeObject(t));
//}
public static void DataFrom<T1, T2>(this T1 destT, T2 sourceT, List<string> exceptionProps = null) where T1 : class where T2 : class
{
if (sourceT == null)
{
destT = null;
return;
}
PropertyInfo[] propDest = destT.GetType().GetProperties();//.Where(p => !(p.GetMethod.IsVirtual && !p.GetMethod.IsFinal)).ToArray();
PropertyInfo[] propSource = sourceT.GetType().GetProperties();
Array.ForEach(propDest, prop =>
{
if (exceptionProps == null || !exceptionProps.Contains(prop.Name))
{
if (prop.CanWrite)
{
PropertyInfo propS = propSource.FirstOrDefault(p => p.Name == prop.Name);
if (propS != null && propS.CanRead)
{
prop.SetValue(destT, propS.GetValue(sourceT));
}
}
}
});
}
//RtlMoveMemory
[DllImport("kernel32.dll", EntryPoint = "RtlMoveMemory", SetLastError = false)]
public static extern void CopyMemory(IntPtr dest, IntPtr src, uint count);
[HandleProcessCorruptedStateExceptions]
//public static Bitmap CopyBitmap(this Bitmap source)
//{
// Bitmap clone = new Bitmap(source.Width, source.Height, source.PixelFormat);
// try
// {
// int PixelSize = Bitmap.GetPixelFormatSize(source.PixelFormat) / 8;
// if (PixelSize == 1)
// {
// ColorPalette cp = clone.Palette;
// for (int i = 0; i < 256; i++)
// {
// cp.Entries[i] = Color.FromArgb(255, i, i, i);
// }
// clone.Palette = cp;
// }
// Rectangle rect = new Rectangle(0, 0, source.Width, source.Height);
// BitmapData sourceData = source.LockBits(rect, ImageLockMode.ReadWrite, source.PixelFormat);
// BitmapData cloneData = clone.LockBits(rect, ImageLockMode.ReadWrite, source.PixelFormat);
// if (source.Width % 4 == 0)
// {
// unsafe
// {
// CopyMemory(cloneData.Scan0, sourceData.Scan0, (uint)(sourceData.Stride * sourceData.Height));
// }
// }
// else
// {
// Parallel.For(0, source.Height, h =>
// {
// unsafe
// {
// CopyMemory(cloneData.Scan0 + h * sourceData.Stride, sourceData.Scan0 + h * sourceData.Stride, (uint)sourceData.Width);
// }
// });
// }
// clone.UnlockBits(cloneData);
// source.UnlockBits(sourceData);
// }
// catch (Exception ex)
// {
// return clone;
// }
// return clone;
//}
public static Bitmap CopyBitmap(this Bitmap source)
{
Bitmap clone = new Bitmap(source.Width, source.Height, source.PixelFormat);
try
{
int pixelSize = Bitmap.GetPixelFormatSize(source.PixelFormat) / 8;
if (pixelSize == 1)
{
ColorPalette cp = clone.Palette;
for (int i = 0; i < 256; i++)
{
cp.Entries[i] = Color.FromArgb(255, i, i, i);
}
clone.Palette = cp;
}
Rectangle rect = new Rectangle(0, 0, source.Width, source.Height);
BitmapData sourceData = source.LockBits(rect, ImageLockMode.ReadOnly, source.PixelFormat);
BitmapData cloneData = clone.LockBits(rect, ImageLockMode.WriteOnly, source.PixelFormat);
int stride = sourceData.Stride;
int height = sourceData.Height;
if (stride % 4 == 0)
{
unsafe
{
CopyMemory(cloneData.Scan0, sourceData.Scan0, (uint)(stride * height));
}
}
else
{
Parallel.For(0, height, h =>
{
unsafe
{
CopyMemory(cloneData.Scan0 + h * stride, sourceData.Scan0 + h * stride, (uint)stride);
}
});
}
source.UnlockBits(sourceData); clone.UnlockBits(cloneData);
}
catch (Exception ex)
{ // Handle or log exception if needed
} return clone; }
public static Bitmap BitmapDeepClone(Bitmap source)
{
Bitmap clone = new Bitmap(source.Width, source.Height, source.PixelFormat);
try
{
int PixelSize = Bitmap.GetPixelFormatSize(source.PixelFormat) / 8;
if (PixelSize == 1)
{
ColorPalette cp = clone.Palette;
for (int i = 0; i < 256; i++)
{
cp.Entries[i] = Color.FromArgb(255, i, i, i);
}
clone.Palette = cp;
}
Rectangle rect = new Rectangle(0, 0, source.Width, source.Height);
BitmapData source_bitmap = source.LockBits(rect, ImageLockMode.ReadWrite, source.PixelFormat);
BitmapData destination_bitmap = clone.LockBits(rect, ImageLockMode.ReadWrite, clone.PixelFormat);
int depth_width = source_bitmap.Width * PixelSize;
unsafe
{
byte* source_ptr = (byte*)source_bitmap.Scan0;
byte* destination_ptr = (byte*)destination_bitmap.Scan0;
int offset = source_bitmap.Stride - depth_width;
for (int i = 0; i < source_bitmap.Height; i++)
{
for (int j = 0; j < depth_width; j++, source_ptr++, destination_ptr++)
{
*destination_ptr = *source_ptr;
}
source_ptr += offset;
destination_ptr += offset;
}
}
source.UnlockBits(source_bitmap);
clone.UnlockBits(destination_bitmap);
}
catch (Exception ex)
{
}
return clone;
}
public static Bitmap HConnectBitmap(this Bitmap map1, Bitmap map2)
{
Bitmap connectImage = null;
if (map1 == null || map2 == null)
return null;
//横向拼接
int width = map1.Width + map2.Width;
//高度不变
int height = Math.Max(map1.Height, map2.Height);
connectImage = new Bitmap(width, height);
using (Graphics graph = Graphics.FromImage(connectImage))
{
graph.DrawImage(connectImage, width, height);
graph.Clear(System.Drawing.Color.White);
graph.DrawImage(map1, 0, 0);
graph.DrawImage(map2, map1.Width, 0);
}
return connectImage;
}
public static IntPtr FloatToIntptr(float[] bytes)
{
GCHandle hObject = GCHandle.Alloc(bytes, GCHandleType.Pinned);
return hObject.AddrOfPinnedObject();
}
// 将Btimap类转换为byte[]类函数
public static byte[] GetBGRValues(Bitmap bmp, out int stride)
{
var rect = new Rectangle(0, 0, bmp.Width, bmp.Height);
var bmpData = bmp.LockBits(rect, ImageLockMode.ReadOnly, bmp.PixelFormat);
stride = bmpData.Stride;
var rowBytes = bmpData.Width * Image.GetPixelFormatSize(bmp.PixelFormat) / 8;
var imgBytes = bmp.Height * rowBytes;
byte[] rgbValues = new byte[imgBytes];
IntPtr ptr = bmpData.Scan0;
for (var i = 0; i < bmp.Height; i++)
{
Marshal.Copy(ptr, rgbValues, i * rowBytes, rowBytes);
ptr += bmpData.Stride;
}
bmp.UnlockBits(bmpData);
return rgbValues;
}
/// <summary>
/// 缺陷灰度图转彩色图像函数
/// </summary>
/// <param name="src">灰度图</param>
/// <returns>返回构造的伪彩色图像</returns>
public static Bitmap GrayMapToColorMap(this Bitmap src, Dictionary<int, Color> indexColorDict = null)
{
try
{
//Stopwatch sw = new Stopwatch();
//sw.Start();
Bitmap dest = new Bitmap(src.Width, src.Height, PixelFormat.Format32bppArgb);
int destHeight = dest.Height;
int destWidth = dest.Width;
Rectangle rect = new Rectangle(0, 0, destWidth, destHeight);
BitmapData bmpDataDest = dest.LockBits(rect, ImageLockMode.ReadWrite, PixelFormat.Format32bppArgb);
BitmapData bmpDataSrc = src.LockBits(rect, ImageLockMode.ReadWrite, PixelFormat.Format8bppIndexed);
int strideDest = bmpDataDest.Stride;
int strideSrc = bmpDataSrc.Stride;
unsafe
{
byte* pDest = (byte*)bmpDataDest.Scan0.ToPointer();
byte* pSrc = (byte*)bmpDataSrc.Scan0.ToPointer();
Parallel.For(0, destHeight, y =>
{
Parallel.For(0, destWidth, x =>
{
int pixel = pSrc[y * strideSrc + x];
int startIndex = y * strideDest + x * 4;
if (pixel >= 0 && pixel <= 63)
{
Color color = Color.Red;
if (indexColorDict != null && indexColorDict.ContainsKey(pixel))
{
color = indexColorDict[pixel];
}
byte R = color.R;
byte G = color.G;
byte B = color.B;
pDest[startIndex] = B;
pDest[startIndex + 1] = G;
pDest[startIndex + 2] = R;
pDest[startIndex + 3] = 100;
}
else
{
pDest[startIndex] = 255;
pDest[startIndex + 1] = 255;
pDest[startIndex + 2] = 255;
pDest[startIndex + 3] = 0;
}
});
});
}
dest.UnlockBits(bmpDataDest);
src.UnlockBits(bmpDataSrc);
//sw.Stop();
//Console.WriteLine($"转换耗时:{sw.ElapsedMilliseconds}");
return dest;
}
catch (Exception ex)
{
return null;
}
}
public static void Sort<T>(this ObservableCollection<T> collection) where T : IComparable<T>
{
List<T> sortedList = collection.OrderByDescending(x => x).ToList();//这里用降序
for (int i = 0; i < sortedList.Count(); i++)
{
collection.Move(collection.IndexOf(sortedList[i]), i);
}
}
/// <summary>
/// 获得字符串中开始和结束字符串中间的值
/// </summary>
/// <param name="sourse"></param>
/// <param name="startstr"></param>
/// <param name="endstr"></param>
/// <returns></returns>
public static string GetMidString(string sourse, string startstr, string endstr)
{
string result = string.Empty;
int startindex, endindex;
try
{
startindex = sourse.IndexOf(startstr);
if (startindex == -1)
return result;
string tmpstr = sourse.Substring(startindex + startstr.Length);
endindex = tmpstr.IndexOf(endstr);
if (endindex == -1)
return result;
result = tmpstr.Remove(endindex);
}
catch (Exception ex)
{
return "";
}
return result;
}
/// <summary>
/// 获得字符串中开始和结束字符串中间的值
/// </summary>
/// <param name="t">字符串</param>
/// <param name="k">开始</param>
/// <param name="j">结束</param>
/// <returns></returns>
private static string GetMidString2(string sourse, string startstr, string endstr) //截取指定文本,和易语言的取文本中间差不多
{
try //异常捕捉
{
var kn = sourse.IndexOf(startstr, StringComparison.Ordinal) + startstr.Length;
var jn = sourse.IndexOf(endstr, kn, StringComparison.Ordinal);
return sourse.Substring(kn, jn - kn);
}
catch //如果发现未知的错误,比如上面的代码出错了,就执行下面这句代码
{
return ""; //返回空
}
}
// 布尔类型转换为整型
public static int ToInt(this object obj)
{
if (Convert.ToBoolean(obj) == true)
return 1;
else
return 0;
}
// 整型转换为布尔类型
public static bool ToBool(this object obj)
{
if (Convert.ToInt32(obj) == 1)
return true;
else
return false;
}
public static object GetProperty(this object o, string member)
{
if (o == null) throw new ArgumentNullException("o");
if (member == null) throw new ArgumentNullException("member");
Type scope = o.GetType();
IDynamicMetaObjectProvider provider = o as IDynamicMetaObjectProvider;
if (provider != null)
{
ParameterExpression param = Expression.Parameter(typeof(object));
DynamicMetaObject mobj = provider.GetMetaObject(param);
GetMemberBinder binder = (GetMemberBinder)Microsoft.CSharp.RuntimeBinder.Binder.GetMember(0, member, scope, new CSharpArgumentInfo[] { CSharpArgumentInfo.Create(0, null) });
DynamicMetaObject ret = mobj.BindGetMember(binder);
BlockExpression final = Expression.Block(
Expression.Label(CallSiteBinder.UpdateLabel),
ret.Expression
);
LambdaExpression lambda = Expression.Lambda(final, param);
Delegate del = lambda.Compile();
return del.DynamicInvoke(o);
}
else
{
return o.GetType().GetProperty(member, BindingFlags.Public | BindingFlags.Instance).GetValue(o, null);
}
}
#region
[DllImport("kernel32.dll")]
private static extern IntPtr _lopen(string lpPathName, int iReadWrite);
[DllImport("kernel32.dll")]
private static extern bool CloseHandle(IntPtr hObject);
private const int OF_READWRITE = 2;
private const int OF_SHARE_DENY_NONE = 0x40;
private static readonly IntPtr HFILE_ERROR = new IntPtr(-1);
/// <summary>
/// 检测文件是否只读或被使用
/// </summary>
/// <param name="FileNames">要检测的文件</param>
/// <returns>true可用false在用或只读</returns>
public static bool CheckFilesCanUse(string fileName)
{
if (!File.Exists(fileName))
return true;//文件不存在
if ((File.GetAttributes(fileName) & FileAttributes.ReadOnly) == FileAttributes.ReadOnly)
return false; //文件只读
IntPtr vHandle = _lopen(fileName, OF_READWRITE | OF_SHARE_DENY_NONE);
if (vHandle == HFILE_ERROR)
{
CloseHandle(vHandle);
return false; //文件被占用
}
CloseHandle(vHandle); //文件没被占用
return true;
}
#endregion
/// <summary>
/// 获取指定文件夹下所有的文件名称
/// </summary>
/// <param name="folderName">指定文件夹名称,绝对路径</param>
/// <param name="fileFilter">文件类型过滤,根据文件后缀名,如:*,*.txt,*.xls</param>
/// <param name="isContainSubFolder">是否包含子文件夹</param>
/// <returns>ArrayList数组,为所有需要的文件路径名称</returns>
public static List<FileInfo> GetAllFilesByFolder(string folderName, string fileFilter, bool isContainSubFolder = false)
{
List<FileInfo> resList = new List<FileInfo>();
try
{
DirectoryInfo currDir = new DirectoryInfo(folderName);//当前目录
FileInfo[] currFiles = currDir.GetFiles(fileFilter);//当前目录文件
foreach (FileInfo file in currFiles)
{
if (fileFilter.ToLower().IndexOf(file.Extension.ToLower()) >= 0)
{
resList.Add(file);
}
}
if (isContainSubFolder)
{
string[] subFolders = Directory.GetDirectories(folderName);
foreach (string subFolder in subFolders)
{
resList.AddRange(GetAllFilesByFolder(subFolder, fileFilter));//递归
}
}
}
catch (Exception ex)
{
throw ex;
}
return resList;
}
/// <summary>
/// 获取指定文件夹下所有的文件名称,不过滤文件类型
/// </summary>
/// <param name="folderName">指定文件夹名称,绝对路径</param>
/// <param name="isContainSubFolder">是否包含子文件夹</param>
/// <returns>ArrayList数组,为所有需要的文件路径名称</returns>
public static List<FileInfo> GetAllFilesByFolder(string folderName, bool isContainSubFolder)
{
return GetAllFilesByFolder(folderName, "*", isContainSubFolder);
}
}
public class Compare<T, C> : IEqualityComparer<T>
{
private Func<T, C> _getField;
public Compare(Func<T, C> getfield)
{
_getField = getfield;
}
public bool Equals(T x, T y)
{
return EqualityComparer<C>.Default.Equals(_getField(x), _getField(y));
}
public int GetHashCode(T obj)
{
return EqualityComparer<C>.Default.GetHashCode(_getField(obj));
}
}
public static class ObjectExtensions
{
public static IEnumerable<T> DistinctBy<T, C>(this IEnumerable<T> source, Func<T, C> getfield)
{
return source.Distinct(new Compare<T, C>(getfield));
}
public static IQueryable<T> DistinctBy<T, C>(this IQueryable<T> source, Func<T, C> getfield)
{
return source.Distinct(new Compare<T, C>(getfield));
}
}
}

View File

@ -0,0 +1,120 @@
using System;
using System.Collections.Generic;
using System.Configuration;
using System.Linq;
using System.Reflection;
using System.Text;
using System.Threading.Tasks;
namespace DH.Commons.Helper
{
/// <summary>
/// 配置文件操作工具类(自动定位主程序配置)
/// </summary>
public static class SystemConfigHelper
{
private static Configuration _mainConfig;
private static readonly object _lock = new object();
/// <summary>
/// 获取主程序配置对象
/// </summary>
private static Configuration MainConfiguration
{
get
{
if (_mainConfig == null)
{
lock (_lock)
{
if (_mainConfig == null)
{
// 获取主程序路径
string exePath = Assembly.GetEntryAssembly().Location;
var configFile = exePath + ".config";
// 加载主程序配置
var fileMap = new ExeConfigurationFileMap
{
ExeConfigFilename = configFile
};
_mainConfig = ConfigurationManager.OpenMappedExeConfiguration(
fileMap,
ConfigurationUserLevel.None
);
}
}
}
return _mainConfig;
}
}
/// <summary>
/// 检查配置项是否存在
/// </summary>
public static bool KeyExists(string key)
{
return MainConfiguration.AppSettings.Settings[key] != null;
}
/// <summary>
/// 读取配置项(带类型自动转换)
/// </summary>
public static T GetValue<T>(string key, T defaultValue = default)
{
try
{
var setting = MainConfiguration.AppSettings.Settings[key];
if (setting == null) return defaultValue;
return (T)Convert.ChangeType(setting.Value, typeof(T));
}
catch
{
return defaultValue;
}
}
/// <summary>
/// 写入配置项(自动保存)
/// </summary>
public static void SetValue(string key, object value)
{
var settings = MainConfiguration.AppSettings.Settings;
var stringValue = value?.ToString() ?? string.Empty;
if (settings[key] == null)
{
settings.Add(key, stringValue);
}
else
{
settings[key].Value = stringValue;
}
SaveChanges();
}
/// <summary>
/// 删除指定配置项
/// </summary>
public static void RemoveKey(string key)
{
if (KeyExists(key))
{
MainConfiguration.AppSettings.Settings.Remove(key);
SaveChanges();
}
}
/// <summary>
/// 保存配置修改
/// </summary>
private static void SaveChanges()
{
MainConfiguration.Save(ConfigurationSaveMode.Modified);
ConfigurationManager.RefreshSection("appSettings");
}
}
}

View File

@ -0,0 +1,109 @@

using System;
using System.ComponentModel;
using System.Drawing.Design;
namespace DH.Commons.Enums
{
/// <summary>
/// 标准配置
/// </summary>
public class Spec
{
[Category("通用配置")]
[Description("标准代码")]
public virtual string Code { get; set; }
[Category("通用配置")]
[Description("启用状态true启用false禁用")]
[DisplayName("启用状态")]
public bool IsEnabled { get; set; }
[Category("标准配置")]
[Description("标准值")]
[DisplayName("标准值")]
public double StandardValue { get; set; }
[Category("标准配置")]
[Description("正公差")]
[DisplayName("正公差")]
public double Tolrenance_Positive { get; set; }
[Category("标准配置")]
[Description("负公差")]
[DisplayName("负公差")]
public double Tolrenance_Negative { get; set; }
protected double? actualValue = null;
[Browsable(false)]
public virtual double? ActualValue
{
get
{
return actualValue;
}
set
{
//if (actualValue != value && value != null)
if (value != null)
{
if (value.Value >= (StandardValue - Tolrenance_Negative) && value.Value <= (StandardValue + Tolrenance_Positive))
{
MeasureResult = true;
}
else
{
MeasureResult = false;
}
}
actualValue = value;
}
}
[Browsable(false)]
public bool? MeasureResult { get; set; } = null;
public Spec Copy()
{
Spec spec = new Spec();
spec.Code = this.Code;
spec.IsEnabled = this.IsEnabled;
spec.StandardValue = this.StandardValue;
spec.Tolrenance_Positive = this.Tolrenance_Positive;
spec.Tolrenance_Negative = this.Tolrenance_Negative;
return spec;
}
}
public class IndexedSpec : Spec
{
[Category("数据源配置")]
[Description("数据源输出索引")]
[DisplayName("数据源输出索引")]
public int OutputIndex { get; set; }
public new IndexedSpec Copy()
{
IndexedSpec spec = new IndexedSpec();
spec.Code = this.Code;
spec.IsEnabled = this.IsEnabled;
spec.StandardValue = this.StandardValue;
spec.Tolrenance_Positive = this.Tolrenance_Positive;
spec.Tolrenance_Negative = this.Tolrenance_Negative;
spec.OutputIndex = this.OutputIndex;
return spec;
}
}
}

View File

@ -0,0 +1,26 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace DH.Commons.Models
{
public class CameraSummary
{
public string CameraName { get; set; } // 相机名称
public int TiggerCount { get; set; } //触发数
public int OKCount { get; set; } // OK 数
public int NGCount { get; set; } // NG 数
public int TotalCount => OKCount + NGCount; // 总检测数量
public string YieldStr => $"{Yield:f2} %"; // 良率(字符串形式)
public double Yield => OKCount + NGCount > 0 ? (double)OKCount / (OKCount + NGCount) * 100 : 0;
}
public class ProductSummary
{
public int ProductAmount { get; set; }
public string ResultDesc { get; set; }
public string PercentStr { get; set; }
}
}

View File

@ -0,0 +1,34 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using DH.Commons.Base;
using DH.Commons.Enums;
namespace DH.Commons.Models
{
public static class SystemModel
{
/// <summary>
/// 当前方案
/// </summary>
public static string CurrentScheme=string.Empty;
/// <summary>
/// 当前状态
/// </summary>
public static EnumStatus CurrentStatus =EnumStatus.;
}
/// <summary>
/// 配置集合
/// </summary>
public static class ConfigModel
{
public static List<CameraBase> CameraBaseList = new List<CameraBase>();
public static List<PLCBase> PLCBaseList = new List<PLCBase>();
public static List<DetectionConfig> DetectionList = new List<DetectionConfig>();
public static List<GlobalConfig> GlobalList = new List<GlobalConfig>();
}
}

View File

@ -24,7 +24,6 @@
</ItemGroup> </ItemGroup>
<ItemGroup> <ItemGroup>
<ProjectReference Include="..\DH.Commons.Devies\DH.Commons.Devies.csproj" />
<ProjectReference Include="..\DH.Commons\DH.Commons.csproj" /> <ProjectReference Include="..\DH.Commons\DH.Commons.csproj" />
</ItemGroup> </ItemGroup>

View File

@ -1,17 +1,21 @@
using System.Diagnostics; using System.Collections.Concurrent;
using System.Diagnostics;
using System.Reflection.Metadata; using System.Reflection.Metadata;
using System.Xml.Linq; using System.Xml.Linq;
using DH.Devices.Devices; using DH.Commons.Base;
using DH.Commons.Enums;
using DH.Commons.Helper;
using DVPCameraType; using DVPCameraType;
using OpenCvSharp; using OpenCvSharp;
using OpenCvSharp.Extensions;
using static System.Net.Mime.MediaTypeNames; using static System.Net.Mime.MediaTypeNames;
using LogLevel = DH.Commons.Enums.EnumHelper.LogLevel;
namespace DH.Devices.Camera namespace DH.Devices.Camera
{ {
public class Do3ThinkCamera : CameraBase public class Do3ThinkCamera : CameraBase, ILogger
{ {
private dvpCameraInfo stDevInfo = new dvpCameraInfo(); private dvpCameraInfo stDevInfo = new dvpCameraInfo();
@ -24,8 +28,16 @@ namespace DH.Devices.Camera
public dvpStreamFormat dvpStreamFormat = dvpStreamFormat.S_RGB24; public dvpStreamFormat dvpStreamFormat = dvpStreamFormat.S_RGB24;
public int m_CamCount = 0; public int m_CamCount = 0;
public Double m_dfDisplayCount = 0; public Double m_dfDisplayCount = 0;
public LoggerHelper LoggerHelper { get; set; } = new LoggerHelper();
public event Action<LogMsg> OnLog;
public ConcurrentDictionary<string, MatSet> _imageSetList = new ConcurrentDictionary<string, MatSet>();
public Do3ThinkCamera() public Do3ThinkCamera()
{ {
LoggerHelper.LogPath = "D://";
LoggerHelper.LogPrefix = CameraName;
} }
@ -78,92 +90,96 @@ namespace DH.Devices.Camera
//GC.KeepAlive(pCallBackFunc); //GC.KeepAlive(pCallBackFunc);
//// ch:设置采集连续模式 | en:Set Continues Aquisition Mode //// ch:设置采集连续模式 | en:Set Continues Aquisition Mode
//if (IIConfig.IsContinueMode) if (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)
{ {
throw new Exception("Set TriggerMode failed!"); // 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
// 硬触发
//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)
{ {
throw new Exception("Set Line1 Trigger failed!"); // 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 (Exposure != 0)
{
SetExposure(Exposure);
}
//// 增益
if (Gain >= 0)
{
SetGain(Gain);
}
//全画幅
if(!IsAllPicEnabled)
SetPictureRoi((int)ROIX, (int)ROIY, (int)ROIW, (int)ROIH);
//// 设置 触发延迟
if (TriggerDelay > 0)
{
nRet = DVPCamera.dvpSetTriggerDelay(m_handle, TriggerDelay);
if (nRet != dvpStatus.DVP_STATUS_OK)
{
throw new Exception("Set TriggerDelay failed!");
}
}
//// 信号消抖
if (LineDebouncerTime > 0)
{
nRet = DVPCamera.dvpSetTriggerJitterFilter(m_handle, LineDebouncerTime);
if (nRet != dvpStatus.DVP_STATUS_OK)
{
throw new Exception($"LineDebouncerTime set failed:{nRet}");
}
}
//IIConfig.PropertyChanged -= IIConfig_PropertyChanged;
//IIConfig.PropertyChanged += IIConfig_PropertyChanged;
} }
// 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; return true;
} }
catch catch
@ -349,9 +365,17 @@ namespace DH.Devices.Camera
break; break;
} }
Mat smat = cvImage.Clone(); Mat smat = cvImage.Clone();
var imageSet = new MatSet
{
_mat = smat,
};
InitialImageSet(imageSet);
OnHImageOutput?.Invoke(DateTime.Now, this, smat); OnHImageOutput?.Invoke(DateTime.Now, this, smat);
//存图
DisplayAndSaveOriginImage(imageSet.Id,SnapshotCount);
@ -367,14 +391,93 @@ namespace DH.Devices.Camera
} }
return 0; return 0;
} }
public void InitialImageSet(MatSet set)
{
//if (saveOption != null)
//{
// set.ImageSaveOption = saveOption.Copy();
//}
//set.IsOriginSaved = !set.ImageSaveOption.IsSaveOriginImage;
//set.IsFitSaved = !set.ImageSaveOption.IsSaveFitImage;
//set.IsAddtionalSaved = string.IsNullOrWhiteSpace(set.ImageSaveOption.AddtionalSaveType);
set.CameraId = this.CameraName;
set.ImageTime = DateTime.Now;
_imageSetList[set.Id] = set;
}
public virtual async void DisplayAndSaveOriginImage(string imgSetId, int _counter)
{
MatSet set = _imageSetList.Values.FirstOrDefault(u => u.Id == imgSetId);
if (set != null && set._mat != null)
{
await Task.Run(() =>
{
Bitmap showImage = set._mat.ToBitmap();
// showImage.Save("D:/test333.bmp");
// Marshal.Copy(pbyteImageBuffer, 0, (IntPtr)lAddrImage, (int)dwBufferSize);
// Bitmap saveImage = showImage?.CopyBitmap();
// saveImage.Save("d://TEST444.BMP");
// OnShowImageUpdated?.Invoke(this, showImage, imgSetId);
if (IsSavePicEnabled)
{
string fullname = Path.Combine(ImageSaveDirectory, $"{CameraName}_{_counter:D7}_{set.Id}.{set._imageFormat.ToString().ToLower()}");
ImageSaveAsync(fullname, showImage);
}
//释放 himage
ClearImageSet(set);
});
}
}
static object _imageSetLock = new object();
public void ClearImageSet(MatSet set)
{
try
{
bool flag = false;
lock (_imageSetLock)
{
flag = _imageSetList.TryRemove(set.Id, out set);
if (flag)
{
set.Dispose();
}
//LogAsync(DateTime.Now, $"{Name}移除图片信息{(flag ? "成功" : "失败")},当前缓存数量:{_imageSetList.Count}", "");
}
}
catch (Exception ex)
{
LogAsync(DateTime.Now, LogLevel.Exception, $"清理图片缓存异常,当前缓存数量{_imageSetList.Count},{ex.GetExceptionMessage()}");
}
}
public ImageSaveHelper ImageSaveHelper { get; set; } = new ImageSaveHelper();
public virtual void ImageSaveAsync(string fullName, Bitmap map)
{
if (!IsSavePicEnabled)
{
map?.Dispose();
return;
}
ImageSaveSet imageSaveSet = new ImageSaveSet()
{
FullName = fullName,
SaveImage = map,
};
ImageSaveHelper.ImageSaveAsync(imageSaveSet);
}
public override bool CameraDisConnect() public override bool CameraDisConnect()
{ {
try try
{ {
dvpStreamState StreamState = new dvpStreamState(); dvpStreamState StreamState = new dvpStreamState();
nRet = DVPCamera.dvpGetStreamState(m_handle, ref StreamState); nRet = DVPCamera.dvpGetStreamState(m_handle, ref StreamState);
Debug.Assert(nRet == dvpStatus.DVP_STATUS_OK); //Debug.Assert(nRet == dvpStatus.DVP_STATUS_OK);
if (StreamState == dvpStreamState.STATE_STARTED) if (StreamState == dvpStreamState.STATE_STARTED)
{ {
// stop camera // stop camera
@ -409,6 +512,22 @@ namespace DH.Devices.Camera
} }
public void LogAsync(LogMsg msg)
{
msg.MsgSource = CameraName;
msg.ThreadId = Thread.CurrentThread.ManagedThreadId;
//OnLog?.BeginInvoke(msg, null, null);
OnLog?.Invoke(msg);
//if (InitialConfig.IsEnableLog)
{
LoggerHelper.LogAsync(msg);
}
}
public void LogAsync(DateTime dt, LogLevel logLevel, string msg)
{
LogAsync(new LogMsg(dt, logLevel, msg));
}
} }
} }

View File

@ -5,7 +5,7 @@ using System.Runtime.InteropServices;
using System.Xml.Linq; using System.Xml.Linq;
using DH.Commons.Enums; using DH.Commons.Enums;
using static MvCamCtrl.NET.MyCamera; using static MvCamCtrl.NET.MyCamera;
using DH.Devices.Devices; using DH.Commons.Base;

View File

@ -12,10 +12,6 @@
<Platforms>AnyCPU;x64</Platforms> <Platforms>AnyCPU;x64</Platforms>
</PropertyGroup> </PropertyGroup>
<ItemGroup>
<PackageReference Include="System.IO.Ports" Version="9.0.2" />
</ItemGroup>
<ItemGroup> <ItemGroup>
<ProjectReference Include="..\DH.Commons\DH.Commons.csproj" /> <ProjectReference Include="..\DH.Commons\DH.Commons.csproj" />
</ItemGroup> </ItemGroup>

View File

@ -1,81 +0,0 @@
using System.IO.Ports;
using DH.Commons.Enums;
using HslCommunication;
namespace DH.Devices.PLC
{
public class PLCBase
{
/// <summary>
/// 连接状态
/// </summary>
public bool connected = false;
/// <summary>
/// 类型
/// </summary>
public EnumPLCType PLCType=EnumPLCType.XD_网口;
/// <summary>
/// 串口号
/// </summary>
public string portName="COM1";
/// <summary>
/// 波特率
/// </summary>
public int baudRate = 9600;
/// <summary>
/// 数据位
/// </summary>
public int dataBit = 8;
/// <summary>
/// 停止位
/// </summary>
public StopBits stopBit = (StopBits)Enum.Parse(typeof(StopBits), "One");
/// <summary>
/// 奇偶效验位
/// </summary>
public Parity parity = (Parity)Enum.Parse(typeof(Parity), "None");
/// <summary>
/// IP地址
/// </summary>
public string IP = "192.168.6.6";
/// <summary>
/// 端口号
/// </summary>
public int Port = 502;
/// <summary>
/// 初始化
/// </summary>
/// <returns></returns>
public virtual bool PLCConnect() { return false; }
public virtual bool PLCDisConnect() { return false; }
public virtual ushort ReadShort(string address) { return 0; }
public virtual int ReadInt(string address) { return 0; }
public virtual float ReadFloat(string address) { return 0; }
public virtual bool ReadBool(string address) { return false; }
public virtual bool WriteShort(string address, short value, bool waitForReply = true) { return false; }
public virtual bool WriteInt(string address, int value, bool waitForReply = true) { return false; }
public virtual bool WriteDInt(string address, int value, bool waitForReply = true) { return false; }
public virtual bool WriteFloat(string address, float value, bool waitForReply = true) { return false; }
public virtual bool WriteBool(string address, bool value, bool waitForReply = true) { return false; }
}
}

File diff suppressed because it is too large Load Diff

View File

@ -11,6 +11,14 @@
<Platforms>AnyCPU;x64</Platforms> <Platforms>AnyCPU;x64</Platforms>
</PropertyGroup> </PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|AnyCPU'">
<Optimize>False</Optimize>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
<Optimize>False</Optimize>
</PropertyGroup>
@ -28,7 +36,6 @@
<ItemGroup> <ItemGroup>
<ProjectReference Include="..\DH.Commons.Devies\DH.Commons.Devies.csproj" />
<ProjectReference Include="..\DH.Commons\DH.Commons.csproj" /> <ProjectReference Include="..\DH.Commons\DH.Commons.csproj" />
<ProjectReference Include="..\DH.UI.Model.Winform\DH.UI.Model.Winform.csproj" /> <ProjectReference Include="..\DH.UI.Model.Winform\DH.UI.Model.Winform.csproj" />
</ItemGroup> </ItemGroup>

View File

@ -13,7 +13,7 @@ using System.Threading.Tasks;
using System.Security.Cryptography.Xml; using System.Security.Cryptography.Xml;
using System.Runtime.InteropServices; using System.Runtime.InteropServices;
using Newtonsoft.Json; using Newtonsoft.Json;
using DH.Commons.Enums; using DH.Commons.Base;
@ -104,18 +104,18 @@ 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]}]}"; // 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); Console.WriteLine("检测结果JSON" + json);
#pragma warning disable CS8600 // 将 null 字面量或可能为 null 的值转换为非 null 类型。
HYoloResult detResult = JsonConvert.DeserializeObject<HYoloResult>(json); HYoloResult detResult = JsonConvert.DeserializeObject<HYoloResult>(json);
#pragma warning restore CS8600 // 将 null 字面量或可能为 null 的值转换为非 null 类型。
if (detResult == null) if (detResult == null)
{ {
return; return;
} }
int iNum = detResult.HYolo.Count; int iNum = detResult.HYolo.Count;
#pragma warning disable CS0219 // 变量已被赋值,但从未使用过它的值
int IokNum = 0; int IokNum = 0;
#pragma warning restore CS0219 // 变量已被赋值,但从未使用过它的值
for (int ix = 0; ix < iNum; ix++) for (int ix = 0; ix < iNum; ix++)
{ {
var det = detResult.HYolo[ix]; var det = detResult.HYolo[ix];
@ -145,7 +145,6 @@ namespace DH.Devices.Vision
Mat originMat = new Mat(); Mat originMat = new Mat();
Mat detectMat = new Mat(); Mat detectMat = new Mat();
#pragma warning disable CS0168 // 声明了变量,但从未使用过
try try
{ {
if (req.mImage == null) if (req.mImage == null)

View File

@ -12,7 +12,7 @@ using System.Threading;
using System.Threading.Tasks; using System.Threading.Tasks;
using System.Runtime.InteropServices; using System.Runtime.InteropServices;
using Newtonsoft.Json; using Newtonsoft.Json;
using DH.Commons.Enums; using DH.Commons.Base;
namespace DH.Devices.Vision namespace DH.Devices.Vision

View File

@ -13,7 +13,7 @@ using System.Threading.Tasks;
using System.Runtime.InteropServices; using System.Runtime.InteropServices;
using Newtonsoft.Json; using Newtonsoft.Json;
using System.Xml; using System.Xml;
using DH.Commons.Enums; using DH.Commons.Base;
namespace DH.Devices.Vision namespace DH.Devices.Vision
@ -136,9 +136,8 @@ 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]}]}"; // 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); Console.WriteLine("检测结果JSON" + json);
#pragma warning disable CS8600 // 将 null 字面量或可能为 null 的值转换为非 null 类型。
SegResult detResult = JsonConvert.DeserializeObject<SegResult>(json); SegResult detResult = JsonConvert.DeserializeObject<SegResult>(json);
#pragma warning restore CS8600 // 将 null 字面量或可能为 null 的值转换为非 null 类型。
if (detResult == null) if (detResult == null)
{ {
return; return;
@ -176,7 +175,6 @@ namespace DH.Devices.Vision
MLResult mlResult = new MLResult(); MLResult mlResult = new MLResult();
Mat originMat=new Mat() ; Mat originMat=new Mat() ;
Mat detectMat= new Mat(); Mat detectMat= new Mat();
#pragma warning disable CS0168 // 声明了变量,但从未使用过
try try
{ {
if (req.mImage == null) if (req.mImage == null)
@ -266,25 +264,24 @@ namespace DH.Devices.Vision
// 释放 Mat 资源 // 释放 Mat 资源
if (detectMat != null) if (detectMat != null)
{ {
detectMat.Dispose();
#pragma warning disable CS8600 // 将 null 字面量或可能为 null 的值转换为非 null 类型。
detectMat = null; detectMat = null;
#pragma warning restore CS8600 // 将 null 字面量或可能为 null 的值转换为非 null 类型。
} }
if (originMat != null) if (originMat != null)
{ {
originMat.Dispose(); originMat.Dispose();
#pragma warning disable CS8600 // 将 null 字面量或可能为 null 的值转换为非 null 类型。
originMat = null; originMat = null;
#pragma warning restore CS8600 // 将 null 字面量或可能为 null 的值转换为非 null 类型。
} }
// GC.Collect(); // GC.Collect();
} }
#pragma warning restore CS0168 // 声明了变量,但从未使用过
} }

File diff suppressed because it is too large Load Diff

View File

@ -1,5 +1,5 @@
using AntdUI; using AntdUI;
using DH.Commons.Base;
using DH.Commons.Enums; using DH.Commons.Enums;
using OpenCvSharp; using OpenCvSharp;
using System; using System;
@ -17,7 +17,7 @@ namespace DH.Devices.Vision
public Mat ColorLut { get; set; } public Mat ColorLut { get; set; }
public byte[] ColorMap { get; set; } public byte[] ColorMap { get; set; }
public MLModelType ModelType { get; set; } public ModelType ModelType { get; set; }
public IntPtr Model { get; set; } public IntPtr Model { get; set; }

View File

@ -10,6 +10,14 @@
<Platforms>AnyCPU;x64</Platforms> <Platforms>AnyCPU;x64</Platforms>
</PropertyGroup> </PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|AnyCPU'">
<Optimize>False</Optimize>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
<Optimize>False</Optimize>
</PropertyGroup>
<ItemGroup> <ItemGroup>
<ProjectReference Include="..\DH.Commons\DH.Commons.csproj" /> <ProjectReference Include="..\DH.Commons\DH.Commons.csproj" />
</ItemGroup> </ItemGroup>

View File

@ -580,7 +580,7 @@ namespace DH.UI.Model.Winform
/// </summary> /// </summary>
[Browsable(false)] [Browsable(false)]
public Rectangle BaseRectangle { get; set; } public Rectangle BaseRectangle { get; set; }
EnumHelper.ElementState IShapeElement.State { get => throw new NotImplementedException(); set => throw new NotImplementedException(); }
public abstract bool IsMouseHover(PointF p); public abstract bool IsMouseHover(PointF p);

View File

@ -1,5 +1,5 @@
 
using DH.Commons.Enums; using DH.Commons.Base;
using System; using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.Drawing; using System.Drawing;

View File

@ -25,8 +25,6 @@ Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Motion", "Motion", "{5C8472
EndProject EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "DH.Devices.Motion", "DH.Devices.Motion\DH.Devices.Motion.csproj", "{144E3775-0BD7-4528-9FB0-A0F4ADC74313}" Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "DH.Devices.Motion", "DH.Devices.Motion\DH.Devices.Motion.csproj", "{144E3775-0BD7-4528-9FB0-A0F4ADC74313}"
EndProject EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "DH.Commons.Devies", "DH.Commons.Devies\DH.Commons.Devies.csproj", "{A33108B6-2740-4D28-AD22-B280372980BE}"
EndProject
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "UI", "UI", "{3EAF3D9C-D3F9-4B6E-89DE-58F129CD1F4C}" Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "UI", "UI", "{3EAF3D9C-D3F9-4B6E-89DE-58F129CD1F4C}"
EndProject EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "DH.UI.Model.Winform", "DH.UI.Model.Winform\DH.UI.Model.Winform.csproj", "{12CB9041-B1B1-41AE-B308-AABDACAA580E}" Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "DH.UI.Model.Winform", "DH.UI.Model.Winform\DH.UI.Model.Winform.csproj", "{12CB9041-B1B1-41AE-B308-AABDACAA580E}"
@ -87,14 +85,6 @@ Global
{144E3775-0BD7-4528-9FB0-A0F4ADC74313}.Release|Any CPU.Build.0 = Release|Any CPU {144E3775-0BD7-4528-9FB0-A0F4ADC74313}.Release|Any CPU.Build.0 = Release|Any CPU
{144E3775-0BD7-4528-9FB0-A0F4ADC74313}.Release|x64.ActiveCfg = Release|x64 {144E3775-0BD7-4528-9FB0-A0F4ADC74313}.Release|x64.ActiveCfg = Release|x64
{144E3775-0BD7-4528-9FB0-A0F4ADC74313}.Release|x64.Build.0 = Release|x64 {144E3775-0BD7-4528-9FB0-A0F4ADC74313}.Release|x64.Build.0 = Release|x64
{A33108B6-2740-4D28-AD22-B280372980BE}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{A33108B6-2740-4D28-AD22-B280372980BE}.Debug|Any CPU.Build.0 = Debug|Any CPU
{A33108B6-2740-4D28-AD22-B280372980BE}.Debug|x64.ActiveCfg = Debug|X64
{A33108B6-2740-4D28-AD22-B280372980BE}.Debug|x64.Build.0 = Debug|X64
{A33108B6-2740-4D28-AD22-B280372980BE}.Release|Any CPU.ActiveCfg = Release|Any CPU
{A33108B6-2740-4D28-AD22-B280372980BE}.Release|Any CPU.Build.0 = Release|Any CPU
{A33108B6-2740-4D28-AD22-B280372980BE}.Release|x64.ActiveCfg = Release|X64
{A33108B6-2740-4D28-AD22-B280372980BE}.Release|x64.Build.0 = Release|X64
{12CB9041-B1B1-41AE-B308-AABDACAA580E}.Debug|Any CPU.ActiveCfg = Debug|Any CPU {12CB9041-B1B1-41AE-B308-AABDACAA580E}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{12CB9041-B1B1-41AE-B308-AABDACAA580E}.Debug|Any CPU.Build.0 = Debug|Any CPU {12CB9041-B1B1-41AE-B308-AABDACAA580E}.Debug|Any CPU.Build.0 = Debug|Any CPU
{12CB9041-B1B1-41AE-B308-AABDACAA580E}.Debug|x64.ActiveCfg = Debug|Any CPU {12CB9041-B1B1-41AE-B308-AABDACAA580E}.Debug|x64.ActiveCfg = Debug|Any CPU
@ -140,7 +130,6 @@ Global
{458B2CF6-6F1B-4B8B-BB85-C6FD7F453A5D} = {2560C5A5-0CA2-48AD-B606-6C55BEFD8109} {458B2CF6-6F1B-4B8B-BB85-C6FD7F453A5D} = {2560C5A5-0CA2-48AD-B606-6C55BEFD8109}
{5C8472C6-EB6A-4D89-B519-7073BBF6A5D2} = {8EC33C16-65CE-4C12-9C8D-DB2425F9F7C0} {5C8472C6-EB6A-4D89-B519-7073BBF6A5D2} = {8EC33C16-65CE-4C12-9C8D-DB2425F9F7C0}
{144E3775-0BD7-4528-9FB0-A0F4ADC74313} = {5C8472C6-EB6A-4D89-B519-7073BBF6A5D2} {144E3775-0BD7-4528-9FB0-A0F4ADC74313} = {5C8472C6-EB6A-4D89-B519-7073BBF6A5D2}
{A33108B6-2740-4D28-AD22-B280372980BE} = {0AB4BB9A-A861-4F80-B549-CD331490942B}
{12CB9041-B1B1-41AE-B308-AABDACAA580E} = {3EAF3D9C-D3F9-4B6E-89DE-58F129CD1F4C} {12CB9041-B1B1-41AE-B308-AABDACAA580E} = {3EAF3D9C-D3F9-4B6E-89DE-58F129CD1F4C}
{5AD3A29E-149A-4C37-9548-7638A36C8175} = {F77AF94C-280D-44C5-B7C0-FC86AA9EC504} {5AD3A29E-149A-4C37-9548-7638A36C8175} = {F77AF94C-280D-44C5-B7C0-FC86AA9EC504}
{1FB768DB-843E-4C67-96B9-7684CF890D89} = {048B30B5-D075-4CE0-BF9F-CB6152E6D376} {1FB768DB-843E-4C67-96B9-7684CF890D89} = {048B30B5-D075-4CE0-BF9F-CB6152E6D376}

9
DHSoftware/App.config Normal file
View File

@ -0,0 +1,9 @@
<?xml version="1.0" encoding="utf-8" ?>
<configuration>
<appSettings>
<!-- 方案存储键(初始值为空) -->
<add key="Schemes" value=""/>
<!-- 当前方案键(初始值为空) -->
<add key="CurrentScheme" value=""/>
</appSettings>
</configuration>

View File

@ -13,30 +13,10 @@
</PropertyGroup> </PropertyGroup>
<ItemGroup> <ItemGroup>
<PackageReference Include="AntdUI" Version="1.8.9" /> <PackageReference Include="AntdUI" Version="1.8.9" />
<PackageReference Include="System.IO.Ports" Version="9.0.2" /> <PackageReference Include="SqlSugarCore" Version="5.1.4.185" />
<PackageReference Include="System.Data.SQLite.Core" Version="1.0.119" />
</ItemGroup> </ItemGroup>
<ItemGroup> <ItemGroup>

View File

@ -1,68 +0,0 @@
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Linq;
using System.Reflection;
using System.Text;
using System.Threading.Tasks;
namespace DHSoftware
{
public static class EnumHelper
{
public enum SelectPicType
{
[Description("训练图片")]
train =0,
[Description("测试图片")]
test
}
public enum NetModel
{
[Description("目标检测")]
training = 0,
[Description("语义分割")]
train_seg,
[Description("模型导出")]
emport,
[Description("推理预测")]
infernce
}
public static string GetEnumDescription(this Enum enumObj)
{
Type t = enumObj.GetType();
FieldInfo f = t.GetField(enumObj.ToString());
if (f == null)
{
return enumObj.ToString();
}
DescriptionAttribute attr = f.GetCustomAttribute<DescriptionAttribute>();
if (attr != null)
{
return attr.Description;
}
else
{
return enumObj.ToString();
}
}
// 根据描述获取枚举值(泛型方法)
public static T GetEnumFromDescription<T>(string description) where T : Enum
{
Type enumType = typeof(T);
foreach (T value in Enum.GetValues(enumType))
{
string desc = GetEnumDescription(value);
if (desc == description)
{
return value;
}
}
throw new ArgumentException($"在枚举 {enumType.Name} 中未找到描述为 '{description}' 的值");
}
}
}

View File

@ -1,10 +1,4 @@
using System; namespace DHSoftware.Languages
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace DHSoftware.Languages
{ {
public class Localizer_enus : AntdUI.ILocalization public class Localizer_enus : AntdUI.ILocalization
{ {
@ -14,125 +8,182 @@ namespace DHSoftware.Languages
{ {
case "search": case "search":
return "Search"; return "Search";
case "welcome": case "welcome":
return "Welcome to the AntdUI Demo"; return "Welcome to the AntdUI Demo";
case "home": case "home":
return "Home"; return "Home";
case "closeall": case "closeall":
return "Close all tabs"; return "Close all tabs";
#region systemset #region systemset
case "systemset": case "systemset":
return "System Settings"; return "System Settings";
case "baseset": case "baseset":
return "Basic Settings"; return "Basic Settings";
case "messageconfig": case "messageconfig":
return "Message configuration"; return "Message configuration";
case "animationon": case "animationon":
return "Turn on animation"; return "Turn on animation";
case "shadowon": case "shadowon":
return "Enable shadow"; return "Enable shadow";
case "scrollbarhide": case "scrollbarhide":
return "Hide scrollbar"; return "Hide scrollbar";
case "showinwindow": case "showinwindow":
return "Show in window"; return "Show in window";
case "windowOffsetXY": case "windowOffsetXY":
return "WindowOffsetXY"; return "WindowOffsetXY";
case "tip": case "tip":
return "Tip"; return "Tip";
case "switchsuccess": case "switchsuccess":
return "Switch successful."; return "Switch successful.";
#endregion
#endregion systemset
#region Button #region Button
case "Button.Text": case "Button.Text":
return "Button"; return "Button";
case "Button.Description": case "Button.Description":
return "To trigger an operation."; return "To trigger an operation.";
case "type": case "type":
return "Type"; return "Type";
case "wave": case "wave":
return "Wave"; return "Wave";
case "loading": case "loading":
return "Loading"; return "Loading";
case "ghost": case "ghost":
return "Ghost"; return "Ghost";
case "border": case "border":
return "Border"; return "Border";
case "icon": case "icon":
return "Icon"; return "Icon";
case "arrow": case "arrow":
return "Arrow"; return "Arrow";
case "join": case "join":
return "Join"; return "Join";
case "gradient": case "gradient":
return "Gradient"; return "Gradient";
case "toggle": case "toggle":
return "Toggle"; return "Toggle";
#endregion
#endregion Button
#region FloatButton #region FloatButton
case "FloatButton.Text": case "FloatButton.Text":
return "FloatButton"; return "FloatButton";
case "FloatButton.Description": case "FloatButton.Description":
return "A button that floats at the top of the page."; return "A button that floats at the top of the page.";
case "FloatButton.Tip": case "FloatButton.Tip":
return "FloatButton does not have a toolbox control and is called code."; return "FloatButton does not have a toolbox control and is called code.";
case "control_option": case "control_option":
return "Control Options"; return "Control Options";
case "button_option": case "button_option":
return "Button Options"; return "Button Options";
case "open": case "open":
return "Open"; return "Open";
case "close": case "close":
return "Close"; return "Close";
case "reset": case "reset":
return "Reset"; return "Reset";
#endregion
#endregion FloatButton
#region Icon #region Icon
case "Icon.Text": case "Icon.Text":
return "Icon"; return "Icon";
case "Icon.Description": case "Icon.Description":
return "Semantic vector graphics."; return "Semantic vector graphics.";
case "Icon.Tip": case "Icon.Tip":
return "Icon does not have a toolbox control and is used for Svg property assignments."; return "Icon does not have a toolbox control and is used for Svg property assignments.";
case "outlined": case "outlined":
return "Outlined"; return "Outlined";
case "filled": case "filled":
return "Filled"; return "Filled";
case "directionalicon": case "directionalicon":
return "Directional icons"; return "Directional icons";
case "suggestionicon": case "suggestionicon":
return "Suggestion Icon"; return "Suggestion Icon";
case "editingicon": case "editingicon":
return "Editing Icons"; return "Editing Icons";
case "dataicon": case "dataicon":
return "Data icons"; return "Data icons";
case "brand": case "brand":
return "Brand and logo"; return "Brand and logo";
case "universal": case "universal":
return "Universal Icons for Websites"; return "Universal Icons for Websites";
case "copysuccess": case "copysuccess":
return "Copy successful!"; return "Copy successful!";
case "copyfail": case "copyfail":
return "Copy failed!"; return "Copy failed!";
#endregion
#endregion Icon
#region Divider #region Divider
case "Divider.Text": case "Divider.Text":
return "Divider"; return "Divider";
case "Divider.Description": case "Divider.Description":
return "A divider line separates different content."; return "A divider line separates different content.";
case "basicusage": case "basicusage":
return "Basic Usage"; return "Basic Usage";
case "vertical": case "vertical":
return "Vertical"; return "Vertical";
case "horizontal": case "horizontal":
return "Horizontal"; return "Horizontal";
#endregion
#endregion Divider
default: default:
return null; return null;
} }
} }
} }

117
DHSoftware/LoginWindow.Designer.cs generated Normal file
View File

@ -0,0 +1,117 @@
namespace DHSoftware
{
partial class LoginWindow
{
/// <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()
{
System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(LoginWindow));
label1 = new AntdUI.Label();
iptName = new AntdUI.Input();
iptPwd = new AntdUI.Input();
button_cancel = new AntdUI.Button();
button_ok = new AntdUI.Button();
SuspendLayout();
//
// label1
//
label1.BackColor = SystemColors.Window;
label1.Font = new Font("Microsoft YaHei UI", 14.25F, FontStyle.Bold, GraphicsUnit.Point, 134);
label1.Location = new Point(351, 44);
label1.Name = "label1";
label1.Size = new Size(212, 23);
label1.TabIndex = 0;
label1.Text = "登录CCD光学筛选系统";
//
// iptName
//
iptName.Location = new Point(351, 95);
iptName.Name = "iptName";
iptName.PlaceholderText = "请输入用户名";
iptName.Size = new Size(227, 37);
iptName.TabIndex = 1;
//
// iptPwd
//
iptPwd.Location = new Point(351, 156);
iptPwd.Name = "iptPwd";
iptPwd.PasswordPaste = false;
iptPwd.PlaceholderText = "请输入密码";
iptPwd.Size = new Size(227, 37);
iptPwd.TabIndex = 2;
iptPwd.UseSystemPasswordChar = true;
//
// button_cancel
//
button_cancel.BorderWidth = 1F;
button_cancel.Font = new Font("Microsoft YaHei UI", 9F);
button_cancel.Ghost = true;
button_cancel.Location = new Point(468, 231);
button_cancel.Name = "button_cancel";
button_cancel.Size = new Size(95, 38);
button_cancel.TabIndex = 4;
button_cancel.Text = "取消";
//
// button_ok
//
button_ok.Font = new Font("Microsoft YaHei UI", 9F, FontStyle.Regular, GraphicsUnit.Point, 134);
button_ok.Location = new Point(364, 231);
button_ok.Name = "button_ok";
button_ok.Size = new Size(95, 38);
button_ok.TabIndex = 3;
button_ok.Text = "登录";
button_ok.Type = AntdUI.TTypeMini.Primary;
//
// LoginWindow
//
BackgroundImage = (Image)resources.GetObject("$this.BackgroundImage");
BackgroundImageLayout = ImageLayout.Stretch;
ClientSize = new Size(590, 340);
ControlBox = false;
Controls.Add(button_cancel);
Controls.Add(button_ok);
Controls.Add(iptPwd);
Controls.Add(iptName);
Controls.Add(label1);
Font = new Font("Microsoft YaHei UI", 9F, FontStyle.Regular, GraphicsUnit.Point, 134);
Icon = (Icon)resources.GetObject("$this.Icon");
Name = "LoginWindow";
StartPosition = FormStartPosition.CenterScreen;
Text = "登录界面";
Load += LoginWindow_Load;
ResumeLayout(false);
}
#endregion
private AntdUI.Label label1;
private AntdUI.Input iptName;
private AntdUI.Input iptPwd;
private AntdUI.Button button_cancel;
private AntdUI.Button button_ok;
}
}

123
DHSoftware/LoginWindow.cs Normal file
View File

@ -0,0 +1,123 @@
using AntdUI;
using DHSoftware.Models;
using DHSoftware.Services;
namespace DHSoftware
{
public partial class LoginWindow : AntdUI.Window
{
public LoginWindow()
{
InitializeComponent();
// 关键设置:允许窗体优先接收按键事件
this.KeyPreview = true;
// 绑定按键事件
this.KeyDown += Login_KeyDown;
button_ok.Click += Button_ok_Click;
button_cancel.Click += Button_cancel_Click;
}
private void Login_KeyDown(object? sender, KeyEventArgs e)
{
// 监听回车键
if (e.KeyCode == Keys.Enter)
{
button_ok.PerformClick(); // 触发确定按钮的点击事件
e.Handled = true; // 阻止其他控件处理该按键
}
// 监听 ESC 键
if (e.KeyCode == Keys.Escape)
{
button_cancel.PerformClick(); // 触发取消按钮的点击事件
e.Handled = true;
}
}
/// <summary>
/// 窗体对象实例
/// </summary>
private static LoginWindow _instance;
internal static LoginWindow Instance
{
get
{
if (_instance == null || _instance.IsDisposed)
_instance = new LoginWindow();
return _instance;
}
}
private void Button_cancel_Click(object? sender, EventArgs e)
{
this.Dispose();
}
private void Button_ok_Click(object? sender, EventArgs e)
{
if (string.IsNullOrWhiteSpace(iptName.Text))
{
AntdUI.Message.warn(this, "用户名不能为空!", autoClose: 3);
return;
}
if (string.IsNullOrWhiteSpace(iptPwd.Text))
{
AntdUI.Message.warn(this, "密码不能为空!", autoClose: 3);
return;
}
if (AuthService.Login(iptName.Text, iptPwd.Text))
{
if (this.Owner is MainWindow parent)
{
List<string> UserPermissions = AuthService.GetUserPermissions();
// 检查当前用户是否有权限
if (AuthService.HasPermission("system:config"))
{
parent.ShowConfig = true;
}
else
{
parent.ShowConfig = false;
}
if (AuthService.HasPermission("system:loadscheme"))
{
parent.Loadscheme = true;
}
else
{
parent.Loadscheme = false;
}
if (AuthService.HasPermission("system:addscheme"))
{
parent.Addscheme = true;
}
else
{
parent.Addscheme = false;
}
if (AuthService.HasPermission("system:deletescheme"))
{
parent.Deleteschememe = true;
}
else
{
parent.Deleteschememe = false;
}
parent.LoginName = iptName.Text;
}
this.Dispose();
}
else
{
AntdUI.Message.warn(this, "用户名或密码错误,登录失败!", autoClose: 3);
}
}
private void LoginWindow_Load(object sender, EventArgs e)
{
}
}
}

7609
DHSoftware/LoginWindow.resx Normal file

File diff suppressed because it is too large Load Diff

View File

@ -28,62 +28,75 @@
/// </summary> /// </summary>
private void InitializeComponent() private void InitializeComponent()
{ {
System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(MainWindow)); AntdUI.Tabs.StyleLine styleLine2 = new AntdUI.Tabs.StyleLine();
AntdUI.Tabs.StyleCard styleCard1 = new AntdUI.Tabs.StyleCard();
AntdUI.Tabs.StyleCard styleCard2 = new AntdUI.Tabs.StyleCard(); AntdUI.Tabs.StyleCard styleCard2 = new AntdUI.Tabs.StyleCard();
AntdUI.Tabs.StyleCard styleCard3 = new AntdUI.Tabs.StyleCard(); AntdUI.SegmentedItem segmentedItem6 = new AntdUI.SegmentedItem();
AntdUI.SegmentedItem segmentedItem1 = new AntdUI.SegmentedItem(); AntdUI.SegmentedItem segmentedItem7 = new AntdUI.SegmentedItem();
AntdUI.SegmentedItem segmentedItem2 = new AntdUI.SegmentedItem(); AntdUI.SegmentedItem segmentedItem8 = new AntdUI.SegmentedItem();
AntdUI.SegmentedItem segmentedItem3 = new AntdUI.SegmentedItem(); AntdUI.SegmentedItem segmentedItem9 = new AntdUI.SegmentedItem();
AntdUI.SegmentedItem segmentedItem4 = new AntdUI.SegmentedItem(); AntdUI.SegmentedItem segmentedItem10 = new AntdUI.SegmentedItem();
AntdUI.SegmentedItem segmentedItem5 = new AntdUI.SegmentedItem(); System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(MainWindow));
titlebar = new AntdUI.PageHeader(); titlebar = new AntdUI.PageHeader();
button_color = new AntdUI.Button(); lbName = new AntdUI.Label();
buttonSZ = new AntdUI.Button();
pageHeader1 = new AntdUI.PageHeader();
label1 = new Label();
divider2 = new AntdUI.Divider();
panelmain = new AntdUI.Panel();
panel2 = new AntdUI.Panel();
panel4 = new AntdUI.Panel();
panel6 = new AntdUI.Panel();
splitContainer1 = new SplitContainer();
splitContainer2 = new SplitContainer();
tabImgDisplay = new AntdUI.Tabs();
tabMain = new AntdUI.TabPage();
tabsStas = new AntdUI.Tabs(); tabsStas = new AntdUI.Tabs();
tabPage3 = new AntdUI.TabPage(); tabPage3 = new AntdUI.TabPage();
richTextBox1 = new RichTextBox(); panel7 = new Panel();
tabsConfig = new AntdUI.Tabs(); tabMain = new AntdUI.TabPage();
tabPage2 = new AntdUI.TabPage(); panelmain = new AntdUI.Panel();
splitter2 = new AntdUI.Splitter();
tabImgDisplay = new AntdUI.Tabs();
splitter1 = new AntdUI.Splitter();
pnlLog = new AntdUI.Panel();
panel6 = new AntdUI.Panel();
tableLayoutstatistics = new TableLayoutPanel();
dgvCamreaNums = new DataGridView();
panelNums = new AntdUI.Panel();
tableLayoutNums = new TableLayoutPanel();
dgvProductNums = new DataGridView();
tableLayoutPanel3 = new TableLayoutPanel();
lblTotalTime = new Label();
label1 = new Label();
label12 = new Label();
lblUPH = new Label();
lblStartTime = new Label();
lblOEE_Total = new Label();
label10 = new Label();
label7 = new Label();
panel2 = new AntdUI.Panel();
panel1 = new AntdUI.Panel(); panel1 = new AntdUI.Panel();
panel3 = new AntdUI.Panel();
btnDeleteProject = new AntdUI.Button();
btnAddProject = new AntdUI.Button();
btnLoadProject = new AntdUI.Button();
sltProjects = new AntdUI.Select();
segmented1 = new AntdUI.Segmented(); segmented1 = new AntdUI.Segmented();
titlebar.SuspendLayout(); titlebar.SuspendLayout();
pageHeader1.SuspendLayout();
panelmain.SuspendLayout();
panel2.SuspendLayout();
panel4.SuspendLayout();
panel6.SuspendLayout();
((System.ComponentModel.ISupportInitialize)splitContainer1).BeginInit();
splitContainer1.Panel1.SuspendLayout();
splitContainer1.Panel2.SuspendLayout();
splitContainer1.SuspendLayout();
((System.ComponentModel.ISupportInitialize)splitContainer2).BeginInit();
splitContainer2.Panel1.SuspendLayout();
splitContainer2.Panel2.SuspendLayout();
splitContainer2.SuspendLayout();
tabImgDisplay.SuspendLayout();
tabsStas.SuspendLayout(); tabsStas.SuspendLayout();
tabPage3.SuspendLayout(); tabPage3.SuspendLayout();
tabsConfig.SuspendLayout(); panelmain.SuspendLayout();
((System.ComponentModel.ISupportInitialize)splitter2).BeginInit();
splitter2.Panel1.SuspendLayout();
splitter2.Panel2.SuspendLayout();
splitter2.SuspendLayout();
((System.ComponentModel.ISupportInitialize)splitter1).BeginInit();
splitter1.Panel1.SuspendLayout();
splitter1.Panel2.SuspendLayout();
splitter1.SuspendLayout();
panel6.SuspendLayout();
tableLayoutstatistics.SuspendLayout();
((System.ComponentModel.ISupportInitialize)dgvCamreaNums).BeginInit();
panelNums.SuspendLayout();
tableLayoutNums.SuspendLayout();
((System.ComponentModel.ISupportInitialize)dgvProductNums).BeginInit();
tableLayoutPanel3.SuspendLayout();
panel1.SuspendLayout(); panel1.SuspendLayout();
panel3.SuspendLayout();
SuspendLayout(); SuspendLayout();
// //
// titlebar // titlebar
// //
titlebar.BackColor = SystemColors.MenuHighlight; titlebar.BackColor = Color.FromArgb(46, 108, 227);
titlebar.Controls.Add(button_color); titlebar.Controls.Add(lbName);
titlebar.Controls.Add(buttonSZ);
titlebar.DividerShow = true; titlebar.DividerShow = true;
titlebar.DividerThickness = 0F; titlebar.DividerThickness = 0F;
titlebar.Dock = DockStyle.Top; titlebar.Dock = DockStyle.Top;
@ -99,157 +112,44 @@
titlebar.TabIndex = 0; titlebar.TabIndex = 0;
titlebar.Text = "山东迭慧智能科技有限公司"; titlebar.Text = "山东迭慧智能科技有限公司";
// //
// button_color // lbName
// //
button_color.Dock = DockStyle.Right; lbName.Dock = DockStyle.Right;
button_color.Ghost = true; lbName.ForeColor = SystemColors.Window;
button_color.IconRatio = 0.6F; lbName.Location = new Point(746, 0);
button_color.IconSvg = "SunOutlined"; lbName.Name = "lbName";
button_color.Location = new Point(780, 0); lbName.Size = new Size(134, 40);
button_color.Name = "button_color"; lbName.TabIndex = 0;
button_color.Radius = 0; lbName.Text = "";
button_color.Size = new Size(50, 40); lbName.TextAlign = ContentAlignment.MiddleRight;
button_color.TabIndex = 1;
button_color.ToggleIconSvg = "MoonOutlined";
button_color.Visible = false;
button_color.WaveSize = 0;
// //
// buttonSZ // tabsStas
// //
buttonSZ.Dock = DockStyle.Right; tabsStas.Dock = DockStyle.Fill;
buttonSZ.Ghost = true; tabsStas.Location = new Point(0, 0);
buttonSZ.IconSvg = resources.GetString("buttonSZ.IconSvg"); tabsStas.Name = "tabsStas";
buttonSZ.Location = new Point(830, 0); tabsStas.Pages.Add(tabPage3);
buttonSZ.Name = "buttonSZ"; tabsStas.Size = new Size(580, 176);
buttonSZ.Radius = 0; tabsStas.Style = styleLine2;
buttonSZ.Size = new Size(50, 40); tabsStas.TabIndex = 3;
buttonSZ.TabIndex = 0; tabsStas.Text = "tabs3";
buttonSZ.Visible = false;
buttonSZ.WaveSize = 0;
// //
// pageHeader1 // tabPage3
// //
pageHeader1.Controls.Add(label1); tabPage3.Controls.Add(panel7);
pageHeader1.Controls.Add(divider2); tabPage3.Location = new Point(3, 3);
pageHeader1.DividerShow = true; tabPage3.Name = "tabPage3";
pageHeader1.Dock = DockStyle.Bottom; tabPage3.Size = new Size(574, 170);
pageHeader1.Font = new Font("Microsoft YaHei UI", 12F, FontStyle.Regular, GraphicsUnit.Point, 134); tabPage3.TabIndex = 0;
pageHeader1.Location = new Point(0, 608); tabPage3.Text = "日志";
pageHeader1.Name = "pageHeader1";
pageHeader1.Size = new Size(1024, 40);
pageHeader1.TabIndex = 7;
pageHeader1.Text = "UPH";
// //
// label1 // panel7
// //
label1.AutoSize = true; panel7.Dock = DockStyle.Fill;
label1.Location = new Point(979, 10); panel7.Location = new Point(0, 0);
label1.Name = "label1"; panel7.Name = "panel7";
label1.Size = new Size(64, 21); panel7.Size = new Size(574, 170);
label1.TabIndex = 1; panel7.TabIndex = 2;
label1.Text = "100000";
//
// divider2
//
divider2.Dock = DockStyle.Top;
divider2.Location = new Point(54, 0);
divider2.Name = "divider2";
divider2.OrientationMargin = 0F;
divider2.Size = new Size(970, 10);
divider2.TabIndex = 0;
divider2.Text = "";
//
// panelmain
//
panelmain.Controls.Add(panel2);
panelmain.Controls.Add(panel1);
panelmain.Dock = DockStyle.Fill;
panelmain.Location = new Point(0, 40);
panelmain.Margin = new Padding(0);
panelmain.Name = "panelmain";
panelmain.Size = new Size(1024, 568);
panelmain.TabIndex = 8;
//
// panel2
//
panel2.Controls.Add(panel4);
panel2.Dock = DockStyle.Fill;
panel2.Location = new Point(0, 68);
panel2.Name = "panel2";
panel2.Size = new Size(1024, 500);
panel2.TabIndex = 1;
panel2.Text = "panel2";
//
// panel4
//
panel4.Controls.Add(panel6);
panel4.Dock = DockStyle.Fill;
panel4.Location = new Point(0, 0);
panel4.Name = "panel4";
panel4.Size = new Size(1024, 500);
panel4.TabIndex = 1;
panel4.Text = "panel4";
//
// panel6
//
panel6.Controls.Add(splitContainer1);
panel6.Dock = DockStyle.Fill;
panel6.Location = new Point(0, 0);
panel6.Name = "panel6";
panel6.Size = new Size(1024, 500);
panel6.TabIndex = 1;
panel6.Text = "panel6";
//
// splitContainer1
//
splitContainer1.BackColor = SystemColors.Control;
splitContainer1.Dock = DockStyle.Fill;
splitContainer1.Location = new Point(0, 0);
splitContainer1.Name = "splitContainer1";
//
// splitContainer1.Panel1
//
splitContainer1.Panel1.Controls.Add(splitContainer2);
//
// splitContainer1.Panel2
//
splitContainer1.Panel2.BackColor = SystemColors.ButtonFace;
splitContainer1.Panel2.Controls.Add(tabsConfig);
splitContainer1.Size = new Size(1024, 500);
splitContainer1.SplitterDistance = 580;
splitContainer1.SplitterIncrement = 2;
splitContainer1.SplitterWidth = 10;
splitContainer1.TabIndex = 0;
//
// splitContainer2
//
splitContainer2.Dock = DockStyle.Fill;
splitContainer2.Location = new Point(0, 0);
splitContainer2.Name = "splitContainer2";
splitContainer2.Orientation = Orientation.Horizontal;
//
// splitContainer2.Panel1
//
splitContainer2.Panel1.Controls.Add(tabImgDisplay);
//
// splitContainer2.Panel2
//
splitContainer2.Panel2.Controls.Add(tabsStas);
splitContainer2.Size = new Size(580, 500);
splitContainer2.SplitterDistance = 320;
splitContainer2.TabIndex = 0;
//
// tabImgDisplay
//
tabImgDisplay.Controls.Add(tabMain);
tabImgDisplay.Dock = DockStyle.Fill;
tabImgDisplay.Location = new Point(0, 0);
tabImgDisplay.Name = "tabImgDisplay";
tabImgDisplay.Pages.Add(tabMain);
tabImgDisplay.Size = new Size(580, 320);
tabImgDisplay.Style = styleCard1;
tabImgDisplay.TabIndex = 1;
tabImgDisplay.Text = "tabs1";
// //
// tabMain // tabMain
// //
@ -259,59 +159,294 @@
tabMain.TabIndex = 0; tabMain.TabIndex = 0;
tabMain.Text = "检测"; tabMain.Text = "检测";
// //
// tabsStas // panelmain
// //
tabsStas.Controls.Add(tabPage3); panelmain.Controls.Add(splitter2);
tabsStas.Dock = DockStyle.Fill; panelmain.Controls.Add(panel2);
tabsStas.Location = new Point(0, 0); panelmain.Controls.Add(panel1);
tabsStas.Name = "tabsStas"; panelmain.Dock = DockStyle.Fill;
tabsStas.Pages.Add(tabPage3); panelmain.Location = new Point(0, 40);
tabsStas.Size = new Size(580, 176); panelmain.Margin = new Padding(0);
tabsStas.Style = styleCard2; panelmain.Name = "panelmain";
tabsStas.TabIndex = 3; panelmain.Size = new Size(1024, 631);
tabsStas.Text = "tabs3"; panelmain.TabIndex = 8;
// //
// tabPage3 // splitter2
// //
tabPage3.Controls.Add(richTextBox1); splitter2.Dock = DockStyle.Fill;
tabPage3.Location = new Point(3, 28); splitter2.Location = new Point(0, 68);
tabPage3.Name = "tabPage3"; splitter2.Name = "splitter2";
tabPage3.Size = new Size(574, 145); splitter2.Orientation = Orientation.Horizontal;
tabPage3.TabIndex = 0;
tabPage3.Text = "日志";
// //
// richTextBox1 // splitter2.Panel1
// //
richTextBox1.Dock = DockStyle.Fill; splitter2.Panel1.Controls.Add(tabImgDisplay);
richTextBox1.Location = new Point(0, 0);
richTextBox1.Name = "richTextBox1";
richTextBox1.Size = new Size(574, 145);
richTextBox1.TabIndex = 0;
richTextBox1.Text = "";
// //
// tabsConfig // splitter2.Panel2
// //
tabsConfig.Controls.Add(tabPage2); splitter2.Panel2.Controls.Add(splitter1);
tabsConfig.Dock = DockStyle.Fill; splitter2.Size = new Size(1024, 563);
tabsConfig.Location = new Point(0, 0); splitter2.SplitterDistance = 442;
tabsConfig.Name = "tabsConfig"; splitter2.TabIndex = 4;
tabsConfig.Pages.Add(tabPage2);
tabsConfig.Size = new Size(434, 500);
tabsConfig.Style = styleCard3;
tabsConfig.TabIndex = 2;
tabsConfig.Text = "tabs2";
// //
// tabPage2 // tabImgDisplay
// //
tabPage2.Location = new Point(3, 28); tabImgDisplay.Dock = DockStyle.Fill;
tabPage2.Name = "tabPage2"; tabImgDisplay.Location = new Point(0, 0);
tabPage2.Size = new Size(428, 469); tabImgDisplay.Name = "tabImgDisplay";
tabPage2.TabIndex = 0; tabImgDisplay.Size = new Size(1024, 442);
tabPage2.Text = "配置"; tabImgDisplay.Style = styleCard2;
tabImgDisplay.TabIndex = 3;
tabImgDisplay.Text = "tabs1";
//
// splitter1
//
splitter1.Dock = DockStyle.Fill;
splitter1.Location = new Point(0, 0);
splitter1.Name = "splitter1";
//
// splitter1.Panel1
//
splitter1.Panel1.Controls.Add(pnlLog);
//
// splitter1.Panel2
//
splitter1.Panel2.Controls.Add(panel6);
splitter1.Size = new Size(1024, 117);
splitter1.SplitterDistance = 332;
splitter1.TabIndex = 3;
//
// pnlLog
//
pnlLog.Dock = DockStyle.Fill;
pnlLog.Location = new Point(0, 0);
pnlLog.Name = "pnlLog";
pnlLog.Size = new Size(332, 117);
pnlLog.TabIndex = 2;
pnlLog.Text = "panel8";
//
// panel6
//
panel6.Controls.Add(tableLayoutstatistics);
panel6.Dock = DockStyle.Fill;
panel6.Location = new Point(0, 0);
panel6.Name = "panel6";
panel6.Size = new Size(688, 117);
panel6.TabIndex = 0;
panel6.Text = "panel6";
//
// tableLayoutstatistics
//
tableLayoutstatistics.ColumnCount = 2;
tableLayoutstatistics.ColumnStyles.Add(new ColumnStyle(SizeType.Percent, 50F));
tableLayoutstatistics.ColumnStyles.Add(new ColumnStyle(SizeType.Percent, 50F));
tableLayoutstatistics.Controls.Add(dgvCamreaNums, 0, 0);
tableLayoutstatistics.Controls.Add(panelNums, 1, 0);
tableLayoutstatistics.Dock = DockStyle.Fill;
tableLayoutstatistics.Location = new Point(0, 0);
tableLayoutstatistics.Name = "tableLayoutstatistics";
tableLayoutstatistics.RowCount = 1;
tableLayoutstatistics.RowStyles.Add(new RowStyle(SizeType.Percent, 50F));
tableLayoutstatistics.Size = new Size(688, 117);
tableLayoutstatistics.TabIndex = 9;
//
// dgvCamreaNums
//
dgvCamreaNums.AllowUserToAddRows = false;
dgvCamreaNums.AllowUserToDeleteRows = false;
dgvCamreaNums.AllowUserToResizeColumns = false;
dgvCamreaNums.AllowUserToResizeRows = false;
dgvCamreaNums.AutoSizeColumnsMode = DataGridViewAutoSizeColumnsMode.Fill;
dgvCamreaNums.AutoSizeRowsMode = DataGridViewAutoSizeRowsMode.AllCells;
dgvCamreaNums.BackgroundColor = SystemColors.Control;
dgvCamreaNums.BorderStyle = BorderStyle.None;
dgvCamreaNums.CellBorderStyle = DataGridViewCellBorderStyle.SunkenHorizontal;
dgvCamreaNums.ColumnHeadersHeight = 4;
dgvCamreaNums.ColumnHeadersHeightSizeMode = DataGridViewColumnHeadersHeightSizeMode.DisableResizing;
dgvCamreaNums.ColumnHeadersVisible = false;
dgvCamreaNums.Dock = DockStyle.Fill;
dgvCamreaNums.Location = new Point(3, 3);
dgvCamreaNums.MultiSelect = false;
dgvCamreaNums.Name = "dgvCamreaNums";
dgvCamreaNums.ReadOnly = true;
dgvCamreaNums.RowHeadersVisible = false;
dgvCamreaNums.SelectionMode = DataGridViewSelectionMode.FullRowSelect;
dgvCamreaNums.Size = new Size(338, 111);
dgvCamreaNums.TabIndex = 9;
//
// panelNums
//
panelNums.Controls.Add(tableLayoutNums);
panelNums.Dock = DockStyle.Fill;
panelNums.Location = new Point(347, 3);
panelNums.Name = "panelNums";
panelNums.Size = new Size(338, 111);
panelNums.TabIndex = 8;
panelNums.Text = "panel4";
//
// tableLayoutNums
//
tableLayoutNums.ColumnCount = 1;
tableLayoutNums.ColumnStyles.Add(new ColumnStyle(SizeType.Percent, 100F));
tableLayoutNums.Controls.Add(dgvProductNums, 0, 0);
tableLayoutNums.Controls.Add(tableLayoutPanel3, 0, 1);
tableLayoutNums.Dock = DockStyle.Fill;
tableLayoutNums.Location = new Point(0, 0);
tableLayoutNums.Name = "tableLayoutNums";
tableLayoutNums.RowCount = 2;
tableLayoutNums.RowStyles.Add(new RowStyle(SizeType.Percent, 50F));
tableLayoutNums.RowStyles.Add(new RowStyle(SizeType.Percent, 50F));
tableLayoutNums.Size = new Size(338, 111);
tableLayoutNums.TabIndex = 8;
//
// dgvProductNums
//
dgvProductNums.AllowUserToAddRows = false;
dgvProductNums.AllowUserToDeleteRows = false;
dgvProductNums.AllowUserToResizeColumns = false;
dgvProductNums.AllowUserToResizeRows = false;
dgvProductNums.AutoSizeColumnsMode = DataGridViewAutoSizeColumnsMode.Fill;
dgvProductNums.AutoSizeRowsMode = DataGridViewAutoSizeRowsMode.AllCells;
dgvProductNums.BackgroundColor = SystemColors.Control;
dgvProductNums.BorderStyle = BorderStyle.None;
dgvProductNums.CellBorderStyle = DataGridViewCellBorderStyle.SunkenHorizontal;
dgvProductNums.ColumnHeadersHeight = 4;
dgvProductNums.ColumnHeadersHeightSizeMode = DataGridViewColumnHeadersHeightSizeMode.DisableResizing;
dgvProductNums.ColumnHeadersVisible = false;
dgvProductNums.Dock = DockStyle.Fill;
dgvProductNums.Location = new Point(3, 3);
dgvProductNums.MultiSelect = false;
dgvProductNums.Name = "dgvProductNums";
dgvProductNums.ReadOnly = true;
dgvProductNums.RowHeadersVisible = false;
dgvProductNums.SelectionMode = DataGridViewSelectionMode.FullRowSelect;
dgvProductNums.Size = new Size(332, 49);
dgvProductNums.TabIndex = 10;
//
// tableLayoutPanel3
//
tableLayoutPanel3.ColumnCount = 4;
tableLayoutPanel3.ColumnStyles.Add(new ColumnStyle(SizeType.Percent, 50F));
tableLayoutPanel3.ColumnStyles.Add(new ColumnStyle(SizeType.Percent, 50F));
tableLayoutPanel3.ColumnStyles.Add(new ColumnStyle(SizeType.Absolute, 81F));
tableLayoutPanel3.ColumnStyles.Add(new ColumnStyle(SizeType.Absolute, 75F));
tableLayoutPanel3.Controls.Add(lblTotalTime, 1, 1);
tableLayoutPanel3.Controls.Add(label1, 2, 1);
tableLayoutPanel3.Controls.Add(label12, 0, 1);
tableLayoutPanel3.Controls.Add(lblUPH, 3, 1);
tableLayoutPanel3.Controls.Add(lblStartTime, 1, 0);
tableLayoutPanel3.Controls.Add(lblOEE_Total, 3, 0);
tableLayoutPanel3.Controls.Add(label10, 0, 0);
tableLayoutPanel3.Controls.Add(label7, 2, 0);
tableLayoutPanel3.Dock = DockStyle.Fill;
tableLayoutPanel3.Location = new Point(3, 58);
tableLayoutPanel3.Name = "tableLayoutPanel3";
tableLayoutPanel3.RowCount = 2;
tableLayoutPanel3.RowStyles.Add(new RowStyle(SizeType.Percent, 50F));
tableLayoutPanel3.RowStyles.Add(new RowStyle(SizeType.Percent, 50F));
tableLayoutPanel3.Size = new Size(332, 50);
tableLayoutPanel3.TabIndex = 11;
//
// lblTotalTime
//
lblTotalTime.AutoSize = true;
lblTotalTime.Dock = DockStyle.Fill;
lblTotalTime.Location = new Point(91, 25);
lblTotalTime.Name = "lblTotalTime";
lblTotalTime.Size = new Size(82, 25);
lblTotalTime.TabIndex = 15;
lblTotalTime.Text = "0";
lblTotalTime.TextAlign = ContentAlignment.MiddleCenter;
//
// label1
//
label1.AutoSize = true;
label1.Dock = DockStyle.Fill;
label1.Location = new Point(179, 25);
label1.Name = "label1";
label1.Size = new Size(75, 25);
label1.TabIndex = 8;
label1.Text = "UPH";
label1.TextAlign = ContentAlignment.MiddleCenter;
//
// label12
//
label12.AutoSize = true;
label12.Dock = DockStyle.Fill;
label12.Location = new Point(3, 25);
label12.Name = "label12";
label12.Size = new Size(82, 25);
label12.TabIndex = 14;
label12.Text = "运行时间";
label12.TextAlign = ContentAlignment.MiddleCenter;
//
// lblUPH
//
lblUPH.AutoSize = true;
lblUPH.Dock = DockStyle.Fill;
lblUPH.Location = new Point(260, 25);
lblUPH.Name = "lblUPH";
lblUPH.Size = new Size(69, 25);
lblUPH.TabIndex = 9;
lblUPH.Text = "0";
lblUPH.TextAlign = ContentAlignment.MiddleCenter;
//
// lblStartTime
//
lblStartTime.AutoSize = true;
lblStartTime.Dock = DockStyle.Fill;
lblStartTime.Location = new Point(91, 0);
lblStartTime.Name = "lblStartTime";
lblStartTime.Size = new Size(82, 25);
lblStartTime.TabIndex = 11;
lblStartTime.Text = "0";
lblStartTime.TextAlign = ContentAlignment.MiddleCenter;
//
// lblOEE_Total
//
lblOEE_Total.AutoSize = true;
lblOEE_Total.Dock = DockStyle.Fill;
lblOEE_Total.Location = new Point(260, 0);
lblOEE_Total.Name = "lblOEE_Total";
lblOEE_Total.Size = new Size(69, 25);
lblOEE_Total.TabIndex = 13;
lblOEE_Total.Text = "0";
lblOEE_Total.TextAlign = ContentAlignment.MiddleCenter;
//
// label10
//
label10.AutoSize = true;
label10.Dock = DockStyle.Fill;
label10.Location = new Point(3, 0);
label10.Name = "label10";
label10.Size = new Size(82, 25);
label10.TabIndex = 12;
label10.Text = "开始时间";
label10.TextAlign = ContentAlignment.MiddleCenter;
//
// label7
//
label7.AutoSize = true;
label7.Dock = DockStyle.Fill;
label7.Location = new Point(179, 0);
label7.Name = "label7";
label7.Size = new Size(75, 25);
label7.TabIndex = 10;
label7.Text = "总计数";
label7.TextAlign = ContentAlignment.MiddleCenter;
//
// panel2
//
panel2.Location = new Point(511, 86);
panel2.Name = "panel2";
panel2.Size = new Size(814, 364);
panel2.TabIndex = 3;
panel2.Text = "panel2";
// //
// panel1 // panel1
// //
panel1.Back = SystemColors.MenuHighlight; panel1.Back = Color.FromArgb(46, 108, 227);
panel1.Controls.Add(panel3);
panel1.Controls.Add(segmented1); panel1.Controls.Add(segmented1);
panel1.Dock = DockStyle.Top; panel1.Dock = DockStyle.Top;
panel1.Location = new Point(0, 0); panel1.Location = new Point(0, 0);
@ -322,6 +457,61 @@
panel1.TabIndex = 0; panel1.TabIndex = 0;
panel1.Text = "panel1"; panel1.Text = "panel1";
// //
// panel3
//
panel3.Back = Color.FromArgb(46, 108, 227);
panel3.Controls.Add(btnDeleteProject);
panel3.Controls.Add(btnAddProject);
panel3.Controls.Add(btnLoadProject);
panel3.Controls.Add(sltProjects);
panel3.Dock = DockStyle.Right;
panel3.Location = new Point(553, 0);
panel3.Name = "panel3";
panel3.Padding = new Padding(30);
panel3.Radius = 0;
panel3.ShadowOpacity = 0F;
panel3.ShadowOpacityHover = 0F;
panel3.Size = new Size(471, 68);
panel3.TabIndex = 16;
panel3.Text = "panel3";
//
// btnDeleteProject
//
btnDeleteProject.Location = new Point(400, 18);
btnDeleteProject.Name = "btnDeleteProject";
btnDeleteProject.Size = new Size(68, 40);
btnDeleteProject.TabIndex = 19;
btnDeleteProject.Text = "删除";
btnDeleteProject.Visible = false;
//
// btnAddProject
//
btnAddProject.Location = new Point(326, 18);
btnAddProject.Name = "btnAddProject";
btnAddProject.Size = new Size(68, 40);
btnAddProject.TabIndex = 18;
btnAddProject.Text = "新增";
btnAddProject.Visible = false;
//
// btnLoadProject
//
btnLoadProject.Location = new Point(252, 18);
btnLoadProject.Name = "btnLoadProject";
btnLoadProject.Size = new Size(68, 40);
btnLoadProject.TabIndex = 17;
btnLoadProject.Text = "载入";
btnLoadProject.Visible = false;
//
// sltProjects
//
sltProjects.List = true;
sltProjects.Location = new Point(25, 18);
sltProjects.Margin = new Padding(10);
sltProjects.MaxCount = 10;
sltProjects.Name = "sltProjects";
sltProjects.Size = new Size(214, 40);
sltProjects.TabIndex = 16;
//
// segmented1 // segmented1
// //
segmented1.BackActive = Color.FromArgb(100, 255, 87, 34); segmented1.BackActive = Color.FromArgb(100, 255, 87, 34);
@ -330,66 +520,56 @@
segmented1.Font = new Font("Microsoft YaHei UI", 9F); segmented1.Font = new Font("Microsoft YaHei UI", 9F);
segmented1.ForeColor = Color.White; segmented1.ForeColor = Color.White;
segmented1.Full = true; segmented1.Full = true;
segmentedItem1.Badge = null; segmentedItem6.Badge = null;
segmentedItem1.BadgeAlign = AntdUI.TAlignFrom.TR; segmentedItem6.BadgeAlign = AntdUI.TAlignFrom.TR;
segmentedItem1.BadgeBack = null; segmentedItem6.BadgeBack = null;
segmentedItem1.BadgeMode = false; segmentedItem6.BadgeMode = false;
segmentedItem1.BadgeOffsetX = 0; segmentedItem6.BadgeOffsetX = 0;
segmentedItem1.BadgeOffsetY = 0; segmentedItem6.BadgeOffsetY = 0;
segmentedItem1.BadgeSize = 0.6F; segmentedItem6.BadgeSize = 0.6F;
segmentedItem1.BadgeSvg = null; segmentedItem6.BadgeSvg = null;
segmentedItem1.IconActiveSvg = resources.GetString("segmentedItem1.IconActiveSvg"); segmentedItem6.Text = "启动";
segmentedItem1.IconSvg = resources.GetString("segmentedItem1.IconSvg"); segmentedItem7.Badge = null;
segmentedItem1.Text = "启动"; segmentedItem7.BadgeAlign = AntdUI.TAlignFrom.TR;
segmentedItem2.Badge = null; segmentedItem7.BadgeBack = null;
segmentedItem2.BadgeAlign = AntdUI.TAlignFrom.TR; segmentedItem7.BadgeMode = false;
segmentedItem2.BadgeBack = null; segmentedItem7.BadgeOffsetX = 0;
segmentedItem2.BadgeMode = false; segmentedItem7.BadgeOffsetY = 0;
segmentedItem2.BadgeOffsetX = 0; segmentedItem7.BadgeSize = 0.6F;
segmentedItem2.BadgeOffsetY = 0; segmentedItem7.BadgeSvg = null;
segmentedItem2.BadgeSize = 0.6F; segmentedItem7.Text = "停止";
segmentedItem2.BadgeSvg = null; segmentedItem8.Badge = null;
segmentedItem2.IconActiveSvg = resources.GetString("segmentedItem2.IconActiveSvg"); segmentedItem8.BadgeAlign = AntdUI.TAlignFrom.TR;
segmentedItem2.IconSvg = resources.GetString("segmentedItem2.IconSvg"); segmentedItem8.BadgeBack = null;
segmentedItem2.Text = "停止"; segmentedItem8.BadgeMode = false;
segmentedItem3.Badge = null; segmentedItem8.BadgeOffsetX = 0;
segmentedItem3.BadgeAlign = AntdUI.TAlignFrom.TR; segmentedItem8.BadgeOffsetY = 0;
segmentedItem3.BadgeBack = null; segmentedItem8.BadgeSize = 0.6F;
segmentedItem3.BadgeMode = false; segmentedItem8.BadgeSvg = null;
segmentedItem3.BadgeOffsetX = 0; segmentedItem8.Text = "复位";
segmentedItem3.BadgeOffsetY = 0; segmentedItem9.Badge = null;
segmentedItem3.BadgeSize = 0.6F; segmentedItem9.BadgeAlign = AntdUI.TAlignFrom.TR;
segmentedItem3.BadgeSvg = null; segmentedItem9.BadgeBack = null;
segmentedItem3.IconActiveSvg = resources.GetString("segmentedItem3.IconActiveSvg"); segmentedItem9.BadgeMode = false;
segmentedItem3.IconSvg = resources.GetString("segmentedItem3.IconSvg"); segmentedItem9.BadgeOffsetX = 0;
segmentedItem3.Text = "复位"; segmentedItem9.BadgeOffsetY = 0;
segmentedItem4.Badge = null; segmentedItem9.BadgeSize = 0.6F;
segmentedItem4.BadgeAlign = AntdUI.TAlignFrom.TR; segmentedItem9.BadgeSvg = null;
segmentedItem4.BadgeBack = null; segmentedItem9.Text = "登录";
segmentedItem4.BadgeMode = false; segmentedItem10.Badge = null;
segmentedItem4.BadgeOffsetX = 0; segmentedItem10.BadgeAlign = AntdUI.TAlignFrom.TR;
segmentedItem4.BadgeOffsetY = 0; segmentedItem10.BadgeBack = null;
segmentedItem4.BadgeSize = 0.6F; segmentedItem10.BadgeMode = false;
segmentedItem4.BadgeSvg = null; segmentedItem10.BadgeOffsetX = 0;
segmentedItem4.IconActiveSvg = resources.GetString("segmentedItem4.IconActiveSvg"); segmentedItem10.BadgeOffsetY = 0;
segmentedItem4.IconSvg = resources.GetString("segmentedItem4.IconSvg"); segmentedItem10.BadgeSize = 0.6F;
segmentedItem4.Text = "设置"; segmentedItem10.BadgeSvg = null;
segmentedItem5.Badge = null; segmentedItem10.Text = "设置";
segmentedItem5.BadgeAlign = AntdUI.TAlignFrom.TR; segmented1.Items.Add(segmentedItem6);
segmentedItem5.BadgeBack = null; segmented1.Items.Add(segmentedItem7);
segmentedItem5.BadgeMode = false; segmented1.Items.Add(segmentedItem8);
segmentedItem5.BadgeOffsetX = 0; segmented1.Items.Add(segmentedItem9);
segmentedItem5.BadgeOffsetY = 0; segmented1.Items.Add(segmentedItem10);
segmentedItem5.BadgeSize = 0.6F;
segmentedItem5.BadgeSvg = null;
segmentedItem5.IconActiveSvg = resources.GetString("segmentedItem5.IconActiveSvg");
segmentedItem5.IconSvg = resources.GetString("segmentedItem5.IconSvg");
segmentedItem5.Text = "登录";
segmented1.Items.Add(segmentedItem1);
segmented1.Items.Add(segmentedItem2);
segmented1.Items.Add(segmentedItem3);
segmented1.Items.Add(segmentedItem4);
segmented1.Items.Add(segmentedItem5);
segmented1.Location = new Point(0, 0); segmented1.Location = new Point(0, 0);
segmented1.Name = "segmented1"; segmented1.Name = "segmented1";
segmented1.Size = new Size(491, 68); segmented1.Size = new Size(491, 68);
@ -399,65 +579,88 @@
// //
// MainWindow // MainWindow
// //
ClientSize = new Size(1024, 648); ClientSize = new Size(1024, 671);
ControlBox = false; ControlBox = false;
Controls.Add(panelmain); Controls.Add(panelmain);
Controls.Add(pageHeader1);
Controls.Add(titlebar); Controls.Add(titlebar);
Font = new Font("Microsoft YaHei UI", 9F, FontStyle.Regular, GraphicsUnit.Point, 134); Font = new Font("Microsoft YaHei UI", 9F, FontStyle.Regular, GraphicsUnit.Point, 134);
Icon = (Icon)resources.GetObject("$this.Icon"); Icon = (Icon)resources.GetObject("$this.Icon");
Name = "MainWindow"; Name = "MainWindow";
StartPosition = FormStartPosition.CenterScreen; StartPosition = FormStartPosition.CenterScreen;
Text = "AntdUI Demo"; Text = "CCD光学筛选系统";
WindowState = FormWindowState.Maximized; WindowState = FormWindowState.Maximized;
FormClosed += MainWindow_FormClosed; FormClosing += MainWindow_FormClosing;
Load += MainWindow_Load; Load += MainWindow_Load;
titlebar.ResumeLayout(false); titlebar.ResumeLayout(false);
pageHeader1.ResumeLayout(false);
pageHeader1.PerformLayout();
panelmain.ResumeLayout(false);
panel2.ResumeLayout(false);
panel4.ResumeLayout(false);
panel6.ResumeLayout(false);
splitContainer1.Panel1.ResumeLayout(false);
splitContainer1.Panel2.ResumeLayout(false);
((System.ComponentModel.ISupportInitialize)splitContainer1).EndInit();
splitContainer1.ResumeLayout(false);
splitContainer2.Panel1.ResumeLayout(false);
splitContainer2.Panel2.ResumeLayout(false);
((System.ComponentModel.ISupportInitialize)splitContainer2).EndInit();
splitContainer2.ResumeLayout(false);
tabImgDisplay.ResumeLayout(false);
tabsStas.ResumeLayout(false); tabsStas.ResumeLayout(false);
tabPage3.ResumeLayout(false); tabPage3.ResumeLayout(false);
tabsConfig.ResumeLayout(false); panelmain.ResumeLayout(false);
splitter2.Panel1.ResumeLayout(false);
splitter2.Panel2.ResumeLayout(false);
((System.ComponentModel.ISupportInitialize)splitter2).EndInit();
splitter2.ResumeLayout(false);
splitter1.Panel1.ResumeLayout(false);
splitter1.Panel2.ResumeLayout(false);
((System.ComponentModel.ISupportInitialize)splitter1).EndInit();
splitter1.ResumeLayout(false);
panel6.ResumeLayout(false);
tableLayoutstatistics.ResumeLayout(false);
((System.ComponentModel.ISupportInitialize)dgvCamreaNums).EndInit();
panelNums.ResumeLayout(false);
tableLayoutNums.ResumeLayout(false);
((System.ComponentModel.ISupportInitialize)dgvProductNums).EndInit();
tableLayoutPanel3.ResumeLayout(false);
tableLayoutPanel3.PerformLayout();
panel1.ResumeLayout(false); panel1.ResumeLayout(false);
panel3.ResumeLayout(false);
ResumeLayout(false); ResumeLayout(false);
} }
#endregion #endregion
private AntdUI.PageHeader titlebar; private AntdUI.PageHeader titlebar;
private AntdUI.Button buttonSZ;
private AntdUI.Button button_color;
private AntdUI.PageHeader pageHeader1;
private AntdUI.Divider divider2;
private AntdUI.Panel panelmain; private AntdUI.Panel panelmain;
private AntdUI.Panel panel1; private AntdUI.Panel panel1;
private AntdUI.Segmented segmented1; private AntdUI.Segmented segmented1;
private AntdUI.Panel panel2;
private AntdUI.Panel panel4;
private AntdUI.Panel panel6;
private Label label1;
private AntdUI.Splitter splitter1; private AntdUI.Splitter splitter1;
private SplitContainer splitContainer1;
private SplitContainer splitContainer2; private AntdUI.Label lbName;
private AntdUI.Tabs tabImgDisplay; private AntdUI.Panel panel3;
private AntdUI.Button btnDeleteProject;
private AntdUI.Button btnAddProject;
private AntdUI.Button btnLoadProject;
public AntdUI.Select sltProjects;
private Panel panel7;
// private Panel panel5;
// private Label lblNum;
// private Label label2;
// private Label lblNowtime;
// private Label label8;
// private Label lblstarttime;
// private Label label6;
// private Label lblUPH;
private Label label4;
private AntdUI.TabPage tabPage3;
private AntdUI.TabPage tabMain; private AntdUI.TabPage tabMain;
private AntdUI.Tabs tabsStas; private AntdUI.Tabs tabsStas;
private AntdUI.TabPage tabPage3; private AntdUI.Panel panel2;
private RichTextBox richTextBox1; private AntdUI.Tabs tabImgDisplay;
private AntdUI.Tabs tabsConfig; private AntdUI.Panel panel6;
private AntdUI.TabPage tabPage2; private AntdUI.Panel pnlLog;
private AntdUI.Splitter splitter2;
private TableLayoutPanel tableLayoutstatistics;
private AntdUI.Panel panelNums;
private DataGridView dgvCamreaNums;
private TableLayoutPanel tableLayoutNums;
private Label label1;
private Label lblTotalTime;
private Label lblUPH;
private Label label12;
private Label label7;
private Label lblOEE_Total;
private Label lblStartTime;
private Label label10;
private DataGridView dgvProductNums;
private TableLayoutPanel tableLayoutPanel3;
} }
} }

File diff suppressed because it is too large Load Diff

View File

@ -117,39 +117,6 @@
<resheader name="writer"> <resheader name="writer">
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value> <value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader> </resheader>
<data name="buttonSZ.IconSvg" xml:space="preserve">
<value>&lt;svg t="1724122928419" class="icon" viewBox="0 0 1024 1024" version="1.1" xmlns="http://www.w3.org/2000/svg" p-id="2893" width="200" height="200"&gt;&lt;path d="M920.5 435.9c-7.6-40.3-36.1-66.8-69.8-66.2h-3.4c-36.6 0-66.3-29.7-66.3-66.3 0-7.8 3.6-19.1 6-24.9 15.4-35.1 3.3-78.1-28.9-100.6l-102-56.9-4.2-2c-31.7-13.7-72.7-5.4-96.4 19.2-15.1 15.6-42.2 33.7-54.6 33.7-12.5 0-39.8-18.5-54.9-34.3-23.6-24.9-62.2-34.4-97.4-19.5l-105.4 57.7-4.2 2.7c-31.7 22-43.8 65.3-28.3 100.1 1.9 4.6 6 16.7 6 24.9 0 36.6-29.7 66.3-66.3 66.3h-2.6c-34.9-0.6-63.1 25.8-70.7 66.2-0.9 4.8-8.9 48.2-8.9 84s8 79.2 8.9 84c7.5 39.6 35.3 66.2 69.2 66.2h4.1c36.6 0 66.3 29.7 66.3 66.3 0 8.2-4 20.3-5.8 24.5-15.6 35.2-3.6 78.4 28.9 101.2l99.8 56 4.1 2c10.5 4.6 21.8 6.9 33.6 6.9 24.5 0 47.8-9.9 63.7-27.3 14.8-16.1 43.5-35.8 55.8-35.8 12.8 0 40.8 19.7 56.1 36.5 15.8 17.4 39.8 27.8 64.2 27.8 11.6 0 22.6-2.2 34.3-7.3l103.2-56.9 4.2-2.7c31.6-22 43.7-65.2 28.1-100.4-1.9-4.6-5.9-16.5-5.9-24.6 0-36.6 29.7-66.3 66.3-66.3h4c34 0 61.7-26.4 69.2-65.9 0.1-0.5 9-46.3 9-84.4-0.1-35.9-8.1-79.1-9-83.9z m-71.3 154.6c-0.6 3.3-1.5 5.6-2.2 7.1-76.4 0.1-138.6 62.4-138.6 138.8 0 23 8.4 45.7 12.1 53.9 1.6 3.5 0.4 8.4-3.3 11.5l-96.4 53.3c-4.7 1.6-11.9-0.9-14.3-3.5-5.6-6.2-56.5-60.3-109.8-60.3-54 0-106.9 56.8-109.1 59.2-2.2 2.4-7.4 5.7-14.6 3.1l-93.1-52.1c-3.1-2.5-4.5-7.7-2.8-11.6 1.2-2.8 12-28.1 12-53.7 0-76.5-62.1-138.7-138.6-138.8-0.7-1.5-1.6-3.8-2.3-7.1-0.3-1.6-7.6-40.9-7.6-70.6 0-29.7 7.3-69 7.6-70.6 0.6-3.3 1.5-5.7 2.3-7.1 76.4-0.1 138.6-62.3 138.6-138.8 0-25-9.9-49.1-12.1-54-1.5-3.5-0.4-8.3 3.2-11.4l98.2-53.9c4.8-1.7 12.5 0.8 15 3.4 5.5 5.8 55.7 56.8 107.4 56.8 51.2 0 101.2-50 106.7-55.8 2.4-2.4 8.3-5.6 15.1-3.1l94.9 52.7c3.2 2.5 4.5 7.7 2.9 11.3l-0.7 1.8c-3.1 7.6-11.3 29.8-11.3 52.2 0 76.5 62.1 138.7 138.6 138.8 0.7 1.5 1.6 3.8 2.3 7.1 0.1 0.4 7.6 40.6 7.6 70.6-0.1 25.6-5.7 60.4-7.7 70.8z" p-id="2894"&gt;&lt;/path&gt;&lt;path d="M498.7 355.9c-90.3 0-163.8 73.5-163.8 163.8 0 90.3 73.5 163.8 163.8 163.8 90.3 0 163.8-73.5 163.8-163.8 0-90.4-73.5-163.8-163.8-163.8z m0 273.1c-60.3 0-109.4-49.1-109.4-109.4 0-60.3 49.1-109.4 109.4-109.4 60.3 0 109.4 49.1 109.4 109.4 0 60.3-49.1 109.4-109.4 109.4z" p-id="2895"&gt;&lt;/path&gt;&lt;/svg&gt;</value>
</data>
<data name="segmentedItem1.IconActiveSvg" xml:space="preserve">
<value>&lt;svg viewBox="0 0 1024 1024" xmlns="http://www.w3.org/2000/svg" width="200" height="200"&gt;&lt;path d="M731.818667 500.280889L386.844444 239.729778a14.677333 14.677333 0 0 0-23.495111 11.719111v521.159111a14.677333 14.677333 0 0 0 23.495111 11.662222l344.860445-260.608a14.677333 14.677333 0 0 0 0.113778-23.381333z" fill="#FFFFFF"/&gt;&lt;path d="M512 1024a512 512 0 1 1 512-512 512.568889 512.568889 0 0 1-512 512z m0-946.915556A434.915556 434.915556 0 1 0 946.915556 512 435.427556 435.427556 0 0 0 512 77.084444z" fill="#FFFFFF"/&gt;&lt;/svg&gt;</value>
</data>
<data name="segmentedItem1.IconSvg" xml:space="preserve">
<value>&lt;svg viewBox="0 0 1024 1024" xmlns="http://www.w3.org/2000/svg" width="200" height="200"&gt;&lt;path d="M731.818667 500.280889L386.844444 239.729778a14.677333 14.677333 0 0 0-23.495111 11.719111v521.159111a14.677333 14.677333 0 0 0 23.495111 11.662222l344.860445-260.608a14.677333 14.677333 0 0 0 0.113778-23.381333z" fill="#FFFFFF"/&gt;&lt;path d="M512 1024a512 512 0 1 1 512-512 512.568889 512.568889 0 0 1-512 512z m0-946.915556A434.915556 434.915556 0 1 0 946.915556 512 435.427556 435.427556 0 0 0 512 77.084444z" fill="#FFFFFF"/&gt;&lt;/svg&gt;</value>
</data>
<data name="segmentedItem2.IconActiveSvg" xml:space="preserve">
<value>&lt;svg viewBox="0 0 1024 1024" xmlns="http://www.w3.org/2000/svg" width="200" height="200"&gt;&lt;path d="M365.014704 657.815846H657.084939V365.74561H365.014704V657.815846zm584.140471-146.035118c0-240.906781-197.125482-438.105353-438.105353-438.105353-240.979872 0-438.105353 197.198572-438.105354 438.105353 0 240.979872 197.125482 438.178444 438.105354 438.178444 240.979872 0 438.105353-197.198572 438.105353-438.178444zM511.634547 0.730906c281.399001 0 511.634547 230.235546 511.634547 511.634547s-230.235546 511.634547-511.634547 511.634547-511.634547-230.235546-511.634547-511.634547 230.235546-511.634547 511.634547-511.634547z" fill="#FFFFFF"/&gt;&lt;/svg&gt;</value>
</data>
<data name="segmentedItem2.IconSvg" xml:space="preserve">
<value>&lt;svg viewBox="0 0 1024 1024" xmlns="http://www.w3.org/2000/svg" width="200" height="200"&gt;&lt;path d="M365.014704 657.815846H657.084939V365.74561H365.014704V657.815846zm584.140471-146.035118c0-240.906781-197.125482-438.105353-438.105353-438.105353-240.979872 0-438.105353 197.198572-438.105354 438.105353 0 240.979872 197.125482 438.178444 438.105354 438.178444 240.979872 0 438.105353-197.198572 438.105353-438.178444zM511.634547 0.730906c281.399001 0 511.634547 230.235546 511.634547 511.634547s-230.235546 511.634547-511.634547 511.634547-511.634547-230.235546-511.634547-511.634547 230.235546-511.634547 511.634547-511.634547z" fill="#FFFFFF"/&gt;&lt;/svg&gt;</value>
</data>
<data name="segmentedItem3.IconActiveSvg" xml:space="preserve">
<value>&lt;svg viewBox="0 0 1027 1024" xmlns="http://www.w3.org/2000/svg" width="200" height="200"&gt;&lt;path d="M512 0C229.376 0 0 229.376 0 512s229.376 512 512 512 512-229.376 512-512S794.624 0 512 0zm0 963.584c-249.344 0-451.584-202.24-451.584-451.584S262.656 60.416 512 60.416s451.584 202.24 451.584 451.584-202.24 451.584-451.584 451.584z" fill="#FFFFFF"/&gt;&lt;path d="M527.36 351.744V292.864L410.624 380.416 527.36 468.48V410.624c72.192 8.192 124.416 73.216 116.224 145.408-8.192 72.192-73.216 124.416-145.408 116.224-66.56-7.168-117.248-64-117.248-131.072-0.512-5.12-0.512-9.728 0-14.848H323.584c-0.512 5.12-0.512 9.728 0 14.848 0 104.96 85.504 189.952 190.464 189.952s189.952-85.504 189.952-190.464c-0.512-99.328-77.312-181.76-176.64-188.928z" fill="#FFFFFF"/&gt;&lt;/svg&gt;</value>
</data>
<data name="segmentedItem3.IconSvg" xml:space="preserve">
<value>&lt;svg viewBox="0 0 1027 1024" xmlns="http://www.w3.org/2000/svg" width="200" height="200"&gt;&lt;path d="M512 0C229.376 0 0 229.376 0 512s229.376 512 512 512 512-229.376 512-512S794.624 0 512 0zm0 963.584c-249.344 0-451.584-202.24-451.584-451.584S262.656 60.416 512 60.416s451.584 202.24 451.584 451.584-202.24 451.584-451.584 451.584z" fill="#FFFFFF"/&gt;&lt;path d="M527.36 351.744V292.864L410.624 380.416 527.36 468.48V410.624c72.192 8.192 124.416 73.216 116.224 145.408-8.192 72.192-73.216 124.416-145.408 116.224-66.56-7.168-117.248-64-117.248-131.072-0.512-5.12-0.512-9.728 0-14.848H323.584c-0.512 5.12-0.512 9.728 0 14.848 0 104.96 85.504 189.952 190.464 189.952s189.952-85.504 189.952-190.464c-0.512-99.328-77.312-181.76-176.64-188.928z" fill="#FFFFFF"/&gt;&lt;/svg&gt;</value>
</data>
<data name="segmentedItem4.IconActiveSvg" xml:space="preserve">
<value>&lt;svg viewBox="0 0 1027 1024" xmlns="http://www.w3.org/2000/svg" width="200" height="200"&gt;&lt;path d="M512 0C229.376 0 0 229.376 0 512s229.376 512 512 512 512-229.376 512-512S794.624 0 512 0zm0 963.584c-249.344 0-451.584-202.24-451.584-451.584S262.656 60.416 512 60.416s451.584 202.24 451.584 451.584-202.24 451.584-451.584 451.584z" fill="#FFFFFF"/&gt;&lt;path d="M437.314 840.84l-18.967-5.795c-43.935-13.425-84.182-35.551-119.623-65.767l-15.203-12.962 11.199-16.544c17.376-25.668 17.938-59.158 1.433-85.319-14.356-22.787-39.028-36.385-66.006-36.385-4.102 0-8.229 0.328-12.267 0.974l-19.752 3.158-5.301-19.288c-8.196-29.823-12.353-59.896-12.353-89.381 0-19.675 1.863-39.491 5.694-60.582l3.652-20.105 20.349 1.862c2.343 0.214 4.726 0.323 7.081 0.323 29.007 0 55.436-15.908 68.974-41.516 14.941-28.2 11.264-62.223-9.356-86.694l-13.166-15.625L278.1 276.7c38.694-38.954 86.677-68.095 138.76-84.273l19.741-6.132 7.631 19.211c11.88 29.908 40.312 49.234 72.432 49.234 32.097 0 60.521-19.328 72.413-49.241l7.632-19.197 19.73 6.122c43.968 13.642 84.295 36.164 119.862 66.938l15.414 13.337-11.883 16.561c-18.636 25.975-19.684 60.166-2.671 87.105 14.369 22.78 39.055 36.373 66.04 36.372 4.344 0 8.71-0.366 12.978-1.087l20.143-3.403 5.176 19.762c7.539 28.792 11.362 57.566 11.362 85.522 0 21.328-2.143 43.048-6.365 64.554l-3.859 19.65-19.952-1.709a77.999 77.999 0 0 0-6.612-0.281c-28.998 0-55.44 15.917-69.009 41.542-14.47 27.405-11.311 60.816 8.063 85.095l12.496 15.661-14.222 14.111c-38.674 38.378-86.551 67.041-138.455 82.892l-18.968 5.792-7.988-18.152c-12.462-28.318-40.459-46.617-71.325-46.617-30.883 0-58.893 18.299-71.36 46.619l-7.99 18.152zm-95.455-94.18c22.324 16.82 46.59 30.174 72.469 39.881 22.445-34.023 60.731-55.125 102.336-55.125 41.59 0 79.862 21.1 102.303 55.12 32.745-12.298 63.249-30.557 89.663-53.667-19.709-35.774-20.525-79.555-1.04-116.455 19.699-37.203 56.634-61.386 98.053-64.883 1.705-12.731 2.565-25.453 2.565-38 0-18.339-1.923-37.155-5.729-56.144-42.123-0.241-80.616-21.581-103.077-57.189-22.944-36.331-25.024-81.029-6.697-118.768-22.165-16.932-46.203-30.4-71.788-40.221-8.847 14.328-20.577 26.719-34.618 36.447-20.522 14.219-44.602 21.735-69.635 21.735-25.044 0-49.131-7.516-69.657-21.734-14.042-9.727-25.773-22.116-34.618-36.441-32.551 12.503-62.856 30.935-89.106 54.196 21.198 36.233 22.547 80.974 2.407 118.987-19.71 37.285-56.808 61.499-98.402 64.875-1.45 11.713-2.161 23.035-2.161 34.255 0 19.715 2.166 39.792 6.449 59.894 41.851 0.474 80.029 21.785 102.35 57.214 22.218 35.217 24.782 78.871 7.933 116.023z" fill="#FFFFFF"/&gt;&lt;path d="M516.664 633.864c-66.246 0-120.141-53.897-120.141-120.147 0-66.249 53.895-120.146 120.141-120.146 66.237 0 120.127 53.897 120.127 120.146 0 66.25-53.89 120.147-120.127 120.147zm0-195.641c-41.625 0-75.488 33.866-75.488 75.494s33.863 75.495 75.488 75.495c41.617 0 75.475-33.867 75.475-75.495s-33.858-75.494-75.475-75.494z" fill="#FFFFFF"/&gt;&lt;/svg&gt;</value>
</data>
<data name="segmentedItem4.IconSvg" xml:space="preserve">
<value>&lt;svg viewBox="0 0 1027 1024" xmlns="http://www.w3.org/2000/svg" width="200" height="200"&gt;&lt;path d="M512 0C229.376 0 0 229.376 0 512s229.376 512 512 512 512-229.376 512-512S794.624 0 512 0zm0 963.584c-249.344 0-451.584-202.24-451.584-451.584S262.656 60.416 512 60.416s451.584 202.24 451.584 451.584-202.24 451.584-451.584 451.584z" fill="#FFFFFF"/&gt;&lt;path d="M437.314 840.84l-18.967-5.795c-43.935-13.425-84.182-35.551-119.623-65.767l-15.203-12.962 11.199-16.544c17.376-25.668 17.938-59.158 1.433-85.319-14.356-22.787-39.028-36.385-66.006-36.385-4.102 0-8.229 0.328-12.267 0.974l-19.752 3.158-5.301-19.288c-8.196-29.823-12.353-59.896-12.353-89.381 0-19.675 1.863-39.491 5.694-60.582l3.652-20.105 20.349 1.862c2.343 0.214 4.726 0.323 7.081 0.323 29.007 0 55.436-15.908 68.974-41.516 14.941-28.2 11.264-62.223-9.356-86.694l-13.166-15.625L278.1 276.7c38.694-38.954 86.677-68.095 138.76-84.273l19.741-6.132 7.631 19.211c11.88 29.908 40.312 49.234 72.432 49.234 32.097 0 60.521-19.328 72.413-49.241l7.632-19.197 19.73 6.122c43.968 13.642 84.295 36.164 119.862 66.938l15.414 13.337-11.883 16.561c-18.636 25.975-19.684 60.166-2.671 87.105 14.369 22.78 39.055 36.373 66.04 36.372 4.344 0 8.71-0.366 12.978-1.087l20.143-3.403 5.176 19.762c7.539 28.792 11.362 57.566 11.362 85.522 0 21.328-2.143 43.048-6.365 64.554l-3.859 19.65-19.952-1.709a77.999 77.999 0 0 0-6.612-0.281c-28.998 0-55.44 15.917-69.009 41.542-14.47 27.405-11.311 60.816 8.063 85.095l12.496 15.661-14.222 14.111c-38.674 38.378-86.551 67.041-138.455 82.892l-18.968 5.792-7.988-18.152c-12.462-28.318-40.459-46.617-71.325-46.617-30.883 0-58.893 18.299-71.36 46.619l-7.99 18.152zm-95.455-94.18c22.324 16.82 46.59 30.174 72.469 39.881 22.445-34.023 60.731-55.125 102.336-55.125 41.59 0 79.862 21.1 102.303 55.12 32.745-12.298 63.249-30.557 89.663-53.667-19.709-35.774-20.525-79.555-1.04-116.455 19.699-37.203 56.634-61.386 98.053-64.883 1.705-12.731 2.565-25.453 2.565-38 0-18.339-1.923-37.155-5.729-56.144-42.123-0.241-80.616-21.581-103.077-57.189-22.944-36.331-25.024-81.029-6.697-118.768-22.165-16.932-46.203-30.4-71.788-40.221-8.847 14.328-20.577 26.719-34.618 36.447-20.522 14.219-44.602 21.735-69.635 21.735-25.044 0-49.131-7.516-69.657-21.734-14.042-9.727-25.773-22.116-34.618-36.441-32.551 12.503-62.856 30.935-89.106 54.196 21.198 36.233 22.547 80.974 2.407 118.987-19.71 37.285-56.808 61.499-98.402 64.875-1.45 11.713-2.161 23.035-2.161 34.255 0 19.715 2.166 39.792 6.449 59.894 41.851 0.474 80.029 21.785 102.35 57.214 22.218 35.217 24.782 78.871 7.933 116.023z" fill="#FFFFFF"/&gt;&lt;path d="M516.664 633.864c-66.246 0-120.141-53.897-120.141-120.147 0-66.249 53.895-120.146 120.141-120.146 66.237 0 120.127 53.897 120.127 120.146 0 66.25-53.89 120.147-120.127 120.147zm0-195.641c-41.625 0-75.488 33.866-75.488 75.494s33.863 75.495 75.488 75.495c41.617 0 75.475-33.867 75.475-75.495s-33.858-75.494-75.475-75.494z" fill="#FFFFFF"/&gt;&lt;/svg&gt;</value>
</data>
<data name="segmentedItem5.IconActiveSvg" xml:space="preserve">
<value>&lt;svg viewBox="0 0 1024 1024" xmlns="http://www.w3.org/2000/svg" width="200" height="200"&gt;&lt;path d="M512 0C229.376 0 0 229.376 0 512s229.376 512 512 512 512-229.376 512-512S794.624 0 512 0zm0 963.584c-249.344 0-451.584-202.24-451.584-451.584S262.656 60.416 512 60.416s451.584 202.24 451.584 451.584-202.24 451.584-451.584 451.584z" fill="#FFFFFF"/&gt;&lt;path transform="scale(0.8) translate(128,128)" d="M960.853333 903.816533a463.633067 463.633067 0 0 0-11.264-39.185066c-1.536-4.539733-3.413333-8.942933-5.051733-13.448534a484.078933 484.078933 0 0 0-9.557333-24.4736c-2.2528-5.188267-4.881067-10.274133-7.338667-15.394133-3.413333-7.099733-6.8608-14.165333-10.6496-21.0944-2.901333-5.3248-6.075733-10.513067-9.181867-15.701333-2.423467-4.061867-4.573867-8.226133-7.133866-12.219734-1.604267-2.4576-3.413333-4.778667-5.0176-7.202133-1.501867-2.218667-2.730667-4.608-4.266667-6.792533-0.4096-0.6144-1.058133-0.887467-1.501867-1.4336a461.482667 461.482667 0 0 0-90.385066-96.768c-13.5168-10.786133-27.7504-20.48-42.257067-29.5936-0.477867-0.341333-0.7168-0.8192-1.194667-1.1264-3.6864-2.286933-7.509333-4.3008-11.264-6.485334-4.266667-2.491733-8.4992-5.051733-12.868266-7.441066-6.826667-3.6864-13.789867-7.099733-20.753067-10.478934-3.618133-1.7408-7.202133-3.618133-10.8544-5.290666a449.194667 449.194667 0 0 0-31.607467-12.731734c-0.7168-0.273067-1.365333-0.6144-2.082133-0.8192-3.140267-1.1264-6.417067-1.911467-9.557333-2.935466-4.164267-1.399467-8.328533-2.833067-12.561067-4.096a259.9936 259.9936 0 0 0 129.194667-225.450667 260.061867 260.061867 0 0 0-76.629334-185.002667 259.9936 259.9936 0 0 0-185.002666-76.629333H512h-0.034133a259.857067 259.857067 0 0 0-185.002667 76.629333 259.925333 259.925333 0 0 0-76.629333 185.002667 259.584 259.584 0 0 0 76.629333 185.002667c15.906133 15.940267 33.655467 29.2864 52.565333 40.448-4.266667 1.262933-8.430933 2.730667-12.663466 4.096-3.140267 1.058133-6.3488 1.8432-9.489067 2.935466-0.7168 0.238933-1.365333 0.580267-2.048 0.8192-10.683733 3.822933-21.265067 8.0896-31.675733 12.765867-3.584 1.604267-7.0656 3.4816-10.615467 5.154133-7.099733 3.413333-14.165333 6.826667-21.0944 10.615467-4.266667 2.321067-8.3968 4.8128-12.561067 7.2704-3.822933 2.218667-7.748267 4.266667-11.502933 6.621867-0.512 0.3072-0.750933 0.8192-1.2288 1.160533-14.506667 9.147733-28.706133 18.807467-42.222933 29.559467a459.6736 459.6736 0 0 0-90.385067 96.768c-0.443733 0.546133-1.092267 0.8192-1.501867 1.4336-1.536 2.184533-2.7648 4.573867-4.266666 6.792533-1.604267 2.423467-3.447467 4.744533-5.0176 7.202133-2.56 3.9936-4.7104 8.157867-7.133867 12.219734-3.106133 5.188267-6.280533 10.376533-9.181867 15.701333-3.7888 6.929067-7.202133 13.994667-10.6496 21.0944-2.4576 5.12-5.051733 10.205867-7.338666 15.394133-3.515733 8.021333-6.519467 16.247467-9.557334 24.4736-1.672533 4.5056-3.549867 8.9088-5.051733 13.448534-4.3008 12.868267-8.0896 25.941333-11.264 39.185066-3.072 12.970667 2.594133 25.770667 13.073067 32.802134a31.3344 31.3344 0 0 0 9.966933 4.608 30.9248 30.9248 0 0 0 34.030933-15.2576 30.446933 30.446933 0 0 0 3.345067-7.7824c2.833067-11.844267 6.178133-23.483733 10.0352-34.9184 0.6144-1.8432 1.399467-3.549867 2.013867-5.358934 3.447467-9.762133 7.133867-19.456 11.332266-28.945066 0.512-1.160533 1.1264-2.2528 1.6384-3.447467 4.7104-10.308267 9.728-20.48 15.291734-30.344533l0.068266-0.1024a402.773333 402.773333 0 0 1 19.694934-31.4368l0.136533-0.375467a397.4144 397.4144 0 0 1 116.599467-111.2064c0.136533-0.1024 0.3072-0.068267 0.443733-0.170667a397.824 397.824 0 0 1 94.993067-42.973866c2.7648-0.8192 5.495467-1.7408 8.2944-2.491734 5.7344-1.604267 11.5712-3.003733 17.373866-4.334933a367.8208 367.8208 0 0 1 47.342934-7.953067c3.8912-0.443733 7.7824-0.9216 11.6736-1.2288 10.410667-0.785067 20.8896-1.3312 31.505066-1.3312s21.060267 0.546133 31.505067 1.3312c3.8912 0.3072 7.816533 0.785067 11.707733 1.2288a361.3696 361.3696 0 0 1 47.240534 7.953067c5.870933 1.3312 11.707733 2.730667 17.5104 4.334933 2.696533 0.750933 5.358933 1.6384 8.021333 2.4576 33.348267 10.103467 65.365333 24.405333 95.197867 43.008 0.136533 0.1024 0.3072 0.068267 0.443733 0.170667a396.151467 396.151467 0 0 1 116.599467 111.2064c0.1024 0.136533 0.1024 0.273067 0.170666 0.375467 13.687467 19.7632 25.3952 40.5504 35.191467 62.1568l1.467733 3.037866c4.3008 9.659733 8.055467 19.592533 11.605334 29.5936 0.546133 1.604267 1.2288 3.106133 1.774933 4.7104 3.822933 11.4688 7.236267 23.176533 10.0352 35.0208a31.061333 31.061333 0 0 0 60.450133-14.336zm-249.275733-560.2304A199.850667 199.850667 0 0 1 512 543.197867a199.850667 199.850667 0 0 1-199.5776-199.611734A199.816533 199.816533 0 0 1 512 144.008533a199.816533 199.816533 0 0 1 199.5776 199.5776z" fill="#FFFFFF"/&gt;&lt;/svg&gt;</value>
</data>
<data name="segmentedItem5.IconSvg" xml:space="preserve">
<value>&lt;svg viewBox="0 0 1024 1024" xmlns="http://www.w3.org/2000/svg" width="200" height="200"&gt;&lt;path d="M512 0C229.376 0 0 229.376 0 512s229.376 512 512 512 512-229.376 512-512S794.624 0 512 0zm0 963.584c-249.344 0-451.584-202.24-451.584-451.584S262.656 60.416 512 60.416s451.584 202.24 451.584 451.584-202.24 451.584-451.584 451.584z" fill="#FFFFFF"/&gt;&lt;path transform="scale(0.8) translate(128,128)" d="M960.853333 903.816533a463.633067 463.633067 0 0 0-11.264-39.185066c-1.536-4.539733-3.413333-8.942933-5.051733-13.448534a484.078933 484.078933 0 0 0-9.557333-24.4736c-2.2528-5.188267-4.881067-10.274133-7.338667-15.394133-3.413333-7.099733-6.8608-14.165333-10.6496-21.0944-2.901333-5.3248-6.075733-10.513067-9.181867-15.701333-2.423467-4.061867-4.573867-8.226133-7.133866-12.219734-1.604267-2.4576-3.413333-4.778667-5.0176-7.202133-1.501867-2.218667-2.730667-4.608-4.266667-6.792533-0.4096-0.6144-1.058133-0.887467-1.501867-1.4336a461.482667 461.482667 0 0 0-90.385066-96.768c-13.5168-10.786133-27.7504-20.48-42.257067-29.5936-0.477867-0.341333-0.7168-0.8192-1.194667-1.1264-3.6864-2.286933-7.509333-4.3008-11.264-6.485334-4.266667-2.491733-8.4992-5.051733-12.868266-7.441066-6.826667-3.6864-13.789867-7.099733-20.753067-10.478934-3.618133-1.7408-7.202133-3.618133-10.8544-5.290666a449.194667 449.194667 0 0 0-31.607467-12.731734c-0.7168-0.273067-1.365333-0.6144-2.082133-0.8192-3.140267-1.1264-6.417067-1.911467-9.557333-2.935466-4.164267-1.399467-8.328533-2.833067-12.561067-4.096a259.9936 259.9936 0 0 0 129.194667-225.450667 260.061867 260.061867 0 0 0-76.629334-185.002667 259.9936 259.9936 0 0 0-185.002666-76.629333H512h-0.034133a259.857067 259.857067 0 0 0-185.002667 76.629333 259.925333 259.925333 0 0 0-76.629333 185.002667 259.584 259.584 0 0 0 76.629333 185.002667c15.906133 15.940267 33.655467 29.2864 52.565333 40.448-4.266667 1.262933-8.430933 2.730667-12.663466 4.096-3.140267 1.058133-6.3488 1.8432-9.489067 2.935466-0.7168 0.238933-1.365333 0.580267-2.048 0.8192-10.683733 3.822933-21.265067 8.0896-31.675733 12.765867-3.584 1.604267-7.0656 3.4816-10.615467 5.154133-7.099733 3.413333-14.165333 6.826667-21.0944 10.615467-4.266667 2.321067-8.3968 4.8128-12.561067 7.2704-3.822933 2.218667-7.748267 4.266667-11.502933 6.621867-0.512 0.3072-0.750933 0.8192-1.2288 1.160533-14.506667 9.147733-28.706133 18.807467-42.222933 29.559467a459.6736 459.6736 0 0 0-90.385067 96.768c-0.443733 0.546133-1.092267 0.8192-1.501867 1.4336-1.536 2.184533-2.7648 4.573867-4.266666 6.792533-1.604267 2.423467-3.447467 4.744533-5.0176 7.202133-2.56 3.9936-4.7104 8.157867-7.133867 12.219734-3.106133 5.188267-6.280533 10.376533-9.181867 15.701333-3.7888 6.929067-7.202133 13.994667-10.6496 21.0944-2.4576 5.12-5.051733 10.205867-7.338666 15.394133-3.515733 8.021333-6.519467 16.247467-9.557334 24.4736-1.672533 4.5056-3.549867 8.9088-5.051733 13.448534-4.3008 12.868267-8.0896 25.941333-11.264 39.185066-3.072 12.970667 2.594133 25.770667 13.073067 32.802134a31.3344 31.3344 0 0 0 9.966933 4.608 30.9248 30.9248 0 0 0 34.030933-15.2576 30.446933 30.446933 0 0 0 3.345067-7.7824c2.833067-11.844267 6.178133-23.483733 10.0352-34.9184 0.6144-1.8432 1.399467-3.549867 2.013867-5.358934 3.447467-9.762133 7.133867-19.456 11.332266-28.945066 0.512-1.160533 1.1264-2.2528 1.6384-3.447467 4.7104-10.308267 9.728-20.48 15.291734-30.344533l0.068266-0.1024a402.773333 402.773333 0 0 1 19.694934-31.4368l0.136533-0.375467a397.4144 397.4144 0 0 1 116.599467-111.2064c0.136533-0.1024 0.3072-0.068267 0.443733-0.170667a397.824 397.824 0 0 1 94.993067-42.973866c2.7648-0.8192 5.495467-1.7408 8.2944-2.491734 5.7344-1.604267 11.5712-3.003733 17.373866-4.334933a367.8208 367.8208 0 0 1 47.342934-7.953067c3.8912-0.443733 7.7824-0.9216 11.6736-1.2288 10.410667-0.785067 20.8896-1.3312 31.505066-1.3312s21.060267 0.546133 31.505067 1.3312c3.8912 0.3072 7.816533 0.785067 11.707733 1.2288a361.3696 361.3696 0 0 1 47.240534 7.953067c5.870933 1.3312 11.707733 2.730667 17.5104 4.334933 2.696533 0.750933 5.358933 1.6384 8.021333 2.4576 33.348267 10.103467 65.365333 24.405333 95.197867 43.008 0.136533 0.1024 0.3072 0.068267 0.443733 0.170667a396.151467 396.151467 0 0 1 116.599467 111.2064c0.1024 0.136533 0.1024 0.273067 0.170666 0.375467 13.687467 19.7632 25.3952 40.5504 35.191467 62.1568l1.467733 3.037866c4.3008 9.659733 8.055467 19.592533 11.605334 29.5936 0.546133 1.604267 1.2288 3.106133 1.774933 4.7104 3.822933 11.4688 7.236267 23.176533 10.0352 35.0208a31.061333 31.061333 0 0 0 60.450133-14.336zm-249.275733-560.2304A199.850667 199.850667 0 0 1 512 543.197867a199.850667 199.850667 0 0 1-199.5776-199.611734A199.816533 199.816533 0 0 1 512 144.008533a199.816533 199.816533 0 0 1 199.5776 199.5776z" fill="#FFFFFF"/&gt;&lt;/svg&gt;</value>
</data>
<assembly alias="System.Drawing" name="System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" /> <assembly alias="System.Drawing" name="System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" />
<data name="$this.Icon" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64"> <data name="$this.Icon" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
<value> <value>

View File

@ -1,16 +1,12 @@
using AntdUI; using AntdUI;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace DHSoftware.Models namespace DHSoftware.Models
{ {
public class DataModel public class DataModel
{ {
} }
public class DefectRow:NotifyProperty
public class DefectRow : NotifyProperty
{ {
private bool selected = false; private bool selected = false;
public string LabelId { get; set; } public string LabelId { get; set; }

View File

@ -1,6 +1,4 @@
using System.Collections.Generic; namespace AntdUIDemo.Models
namespace AntdUIDemo.Models
{ {
public class DataUtil public class DataUtil
{ {
@ -220,9 +218,5 @@ namespace AntdUIDemo.Models
{ "Chat", "MessageOutlined" }, { "Chat", "MessageOutlined" },
{ "Other", "SettingOutlined" } { "Other", "SettingOutlined" }
}; };
} }
} }

View File

@ -0,0 +1,63 @@
using SqlSugar;
namespace DHSoftware.Models
{
[SugarTable("User")]
public class User
{
[SugarColumn(IsPrimaryKey = true, IsIdentity = true)]
public int Id { get; set; }
[SugarColumn(Length = 50, IsNullable = false)]
public string UserName { get; set; }
[SugarColumn(Length = 100, IsNullable = false)]
public string Password { get; set; }
[SugarColumn(IsNullable = true)]
public DateTime? LastLoginTime { get; set; }
}
[SugarTable("Role")]
public class Role
{
[SugarColumn(IsPrimaryKey = true, IsIdentity = true)]
public int Id { get; set; }
[SugarColumn(Length = 50, IsNullable = false)]
public string RoleName { get; set; }
[SugarColumn(Length = 200)]
public string Description { get; set; }
}
[SugarTable("Permission")]
public class Permission
{
[SugarColumn(IsPrimaryKey = true, Length = 50)]
public string Code { get; set; }
[SugarColumn(Length = 100, IsNullable = false)]
public string Name { get; set; }
}
[SugarTable("UserRole")]
public class UserRole
{
[SugarColumn(IsPrimaryKey = true)]
public int UserId { get; set; }
[SugarColumn(IsPrimaryKey = true)]
public int RoleId { get; set; }
}
[SugarTable("RolePermission")]
public class RolePermission
{
[SugarColumn(IsPrimaryKey = true)]
public int RoleId { get; set; }
[SugarColumn(IsPrimaryKey = true)]
public string PermissionCode { get; set; }
}
}

View File

@ -1,12 +1,4 @@
using System; namespace DHSoftware.Models
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace DHSoftware.Models
{ {
public class Camera public class Camera
{ {
@ -14,7 +6,4 @@ namespace DHSoftware.Models
public string Alias { get; set; } public string Alias { get; set; }
public string ImagePath { get; set; } public string ImagePath { get; set; }
} }
}
}

View File

@ -1,166 +0,0 @@
using AntdUI;
namespace AntdUIDemo.Models
{
public class User : NotifyProperty
{
private bool selected = false;
private string name;
private int age = 0;
private string address;
private bool enabled = false;
private CellImage[] cellImages;
private CellTag[] cellTags;
private CellBadge cellBadge;
private CellText cellText;
private CellLink[] cellLinks;
private CellProgress cellProgress;
private CellDivider cellDivider;
//用于设置树形表格,加入自身数组
private User[] users;
public bool Selected
{
get { return selected; }
set
{
if (selected == value) return;
selected = value;
OnPropertyChanged(nameof(Selected));
}
}
public string Name
{
get { return name; }
set
{
if (name == value) return;
name = value;
OnPropertyChanged(nameof(Name));
}
}
public int Age
{
get { return age; }
set
{
if (age == value) return;
age = value;
OnPropertyChanged(nameof(Age));
}
}
public string Address
{
get { return address; }
set
{
if (address == value) return;
address = value;
OnPropertyChanged(nameof(Address));
}
}
public bool Enabled
{
get { return enabled; }
set
{
if (enabled == value) return;
enabled = value;
OnPropertyChanged(nameof(Enabled));
}
}
public CellImage[] CellImages
{
get { return cellImages; }
set
{
if (cellImages == value) return;
cellImages = value;
OnPropertyChanged(nameof(CellImages));
}
}
public CellTag[] CellTags
{
get { return cellTags; }
set
{
if (cellTags == value) return;
cellTags = value;
OnPropertyChanged(nameof(CellTags));
}
}
public CellBadge CellBadge
{
get { return cellBadge; }
set
{
if (cellBadge == value) return;
cellBadge = value;
OnPropertyChanged(nameof(CellBadge));
}
}
public CellText CellText
{
get { return cellText; }
set
{
if (cellText == value) return;
cellText = value;
OnPropertyChanged(nameof(CellText));
}
}
public CellLink[] CellLinks
{
get { return cellLinks; }
set
{
if (cellLinks == value) return;
cellLinks = value;
OnPropertyChanged(nameof(CellLinks));
}
}
public CellProgress CellProgress
{
get { return cellProgress; }
set
{
if (cellProgress == value) return;
cellProgress = value;
OnPropertyChanged(nameof(CellProgress));
}
}
public CellDivider CellDivider
{
get { return cellDivider; }
set
{
if (cellDivider == value) return;
cellDivider = value;
OnPropertyChanged(nameof(CellDivider));
}
}
public User[] Users
{
get { return users; }
set
{
if (users == value) return;
users = value;
OnPropertyChanged(nameof(Users));
}
}
}
}

View File

@ -1,7 +1,13 @@
using System; using System;
using System.Drawing; using System.Drawing;
using System.Windows.Forms; using System.Windows.Forms;
using AntdUI;
using DH.Commons.Enums;
using DH.Commons.Helper;
using DH.Commons.Models;
using DHSoftware.Utils;
using DHSoftware.Views; using DHSoftware.Views;
using Microsoft.VisualBasic.Logging;
namespace DHSoftware namespace DHSoftware
{ {
@ -14,18 +20,79 @@ namespace DHSoftware
[STAThread] [STAThread]
static void Main() static void Main()
{ {
// 必须在第一个窗口创建前调用以下两行
Application.EnableVisualStyles();
Application.SetCompatibleTextRenderingDefault(false);
// 注册全局异常处理
Application.ThreadException += new System.Threading.ThreadExceptionEventHandler(Application_ThreadException); Application.ThreadException += new System.Threading.ThreadExceptionEventHandler(Application_ThreadException);
AppDomain.CurrentDomain.UnhandledException += new UnhandledExceptionEventHandler(CurrentDomain_UnhandledException); AppDomain.CurrentDomain.UnhandledException += new UnhandledExceptionEventHandler(CurrentDomain_UnhandledException);
// 初始化AntdUI配置
AntdUI.Localization.DefaultLanguage = "zh-CN"; AntdUI.Localization.DefaultLanguage = "zh-CN";
//若文字不清晰,切换其他渲染方式
AntdUI.Config.TextRenderingHint = System.Drawing.Text.TextRenderingHint.AntiAliasGridFit; AntdUI.Config.TextRenderingHint = System.Drawing.Text.TextRenderingHint.AntiAliasGridFit;
AntdUI.Config.SetCorrectionTextRendering("Microsoft YaHei UI"); AntdUI.Config.SetCorrectionTextRendering("Microsoft YaHei UI");
AntdUI.Style.Set(AntdUI.Colour.Primary, Color.FromArgb(46, 108, 227));
Application.EnableVisualStyles(); // 现在再创建窗口
Application.SetCompatibleTextRenderingDefault(false); WelcomeWindow.Instance.Show();
mainWindow = new MainWindow(); UpdateStep(0, "正在初始化", true);
Application.Run(mainWindow); UpdateStep(10, "正在加载数据库", true);
try
{
DatabaseUtil.InitializeDatabase();
}
catch (Exception ex)
{
SystemModel.CurrentStatus = EnumStatus.;
Modal.open(WelcomeWindow.Instance, "错误!", ex.ToString(), TType.Error);
}
UpdateStep(30, "正在加载解决方案", true);
try
{
MainWindow.Instance.LoadScheme();
}
catch (Exception ex)
{
SystemModel.CurrentStatus = EnumStatus.;
Modal.open(WelcomeWindow.Instance, "错误!", ex.ToString(), TType.Error);
}
UpdateStep(50, "正在连接相机", true);
try
{
MainWindow.Instance.ConnectCamera();
}
catch(Exception ex)
{
SystemModel.CurrentStatus = EnumStatus.;
Modal.open(WelcomeWindow.Instance, "错误!", ex.ToString(), TType.Error);
}
UpdateStep(70, "正在连接PLC", true);
try
{
MainWindow.Instance.ConnectPLC();
}
catch (Exception ex)
{
SystemModel.CurrentStatus = EnumStatus.;
Modal.open(WelcomeWindow.Instance, "错误!", ex.ToString(), TType.Error);
}
UpdateStep(80, "正在加载算法模型", true);
try
{
MainWindow.Instance.InitModel();
}
catch (Exception ex)
{
SystemModel.CurrentStatus = EnumStatus.;
Modal.open(WelcomeWindow.Instance, "错误!", ex.ToString(), TType.Error);
}
UpdateStep(100, "程序初始化完成", true);
Thread.Sleep(100);
WelcomeWindow.Instance.Close();
// 启动主窗口
Application.Run(MainWindow.Instance);
} }
// 捕获UI线程中的未处理异常 // 捕获UI线程中的未处理异常
@ -39,5 +106,22 @@ namespace DHSoftware
{ {
AntdUI.Notification.error(mainWindow, "未处理的非UI线程异常", e.ToString(), autoClose: 3, align: AntdUI.TAlignFrom.TR); AntdUI.Notification.error(mainWindow, "未处理的非UI线程异常", e.ToString(), autoClose: 3, align: AntdUI.TAlignFrom.TR);
} }
//更新进度
internal static void UpdateStep(int percentValue, string stepMsg, bool succeed)
{
try
{
WelcomeWindow.Instance.bar_step.Value = percentValue;
WelcomeWindow.Instance.lbl_step.Text = stepMsg + "......";
Thread.Sleep(200);
Application.DoEvents();
}
catch (Exception ex)
{
}
}
} }
} }

View File

@ -117,26 +117,4 @@
<resheader name="writer"> <resheader name="writer">
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value> <value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader> </resheader>
<assembly alias="System.Windows.Forms" name="System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" />
<data name="bg1" type="System.Resources.ResXFileRef, System.Windows.Forms">
<value>..\Resources\bg1.jpg;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
</data>
<data name="bg2" type="System.Resources.ResXFileRef, System.Windows.Forms">
<value>..\Resources\bg2.jpg;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
</data>
<data name="bg3" type="System.Resources.ResXFileRef, System.Windows.Forms">
<value>..\Resources\bg3.jpg;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
</data>
<data name="head" type="System.Resources.ResXFileRef, System.Windows.Forms">
<value>..\Resources\head.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
</data>
<data name="head2" type="System.Resources.ResXFileRef, System.Windows.Forms">
<value>..\Resources\head2.jpg;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
</data>
<data name="logo" type="System.Resources.ResXFileRef, System.Windows.Forms">
<value>..\assets\logo.jpg;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
</data>
<data name="关闭" type="System.Resources.ResXFileRef, System.Windows.Forms">
<value>..\Resources\关闭.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
</data>
</root> </root>

View File

@ -0,0 +1,64 @@
using DHSoftware.Models;
using DHSoftware.Utils;
using SqlSugar;
namespace DHSoftware.Services
{
public static class AuthService
{
public static User CurrentUser { get; private set; }
public static bool Login(string username, string password)
{
using (var db = DatabaseUtil.GetDatabase())
{
var user = db.Queryable<User>()
.First(u => u.UserName == username);
if (user != null && HashHelper.MD5Encrypt(password).Equals(user.Password))
{
CurrentUser = user;
UpdateLastLoginTime(db, user.Id);
return true;
}
return false;
}
}
public static bool HasPermission(string permissionCode)
{
if (CurrentUser == null) return false;
using (var db = DatabaseUtil.GetDatabase())
{
return db.Queryable<UserRole>()
.InnerJoin<RolePermission>((ur, rp) => ur.RoleId == rp.RoleId)
.Where((ur, rp) => ur.UserId == CurrentUser.Id)
.Where((ur, rp) => rp.PermissionCode == permissionCode)
.Any();
}
}
public static List<string> GetUserPermissions()
{
if (CurrentUser == null) return new List<string>();
using (var db = DatabaseUtil.GetDatabase())
{
return db.Queryable<UserRole>()
.InnerJoin<RolePermission>((ur, rp) => ur.RoleId == rp.RoleId)
.Where((ur, rp) => ur.UserId == CurrentUser.Id)
.Select((ur, rp) => rp.PermissionCode)
.ToList();
}
}
private static void UpdateLastLoginTime(SqlSugarClient db, int userId)
{
db.Updateable<User>()
.SetColumns(u => u.LastLoginTime == DateTime.Now)
.Where(u => u.Id == userId)
.ExecuteCommand();
}
}
}

View File

@ -0,0 +1,38 @@
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

@ -0,0 +1,151 @@
using DHSoftware.Models;
using SqlSugar;
namespace DHSoftware.Utils
{
public static class DatabaseUtil
{
private static readonly string DatabasePath = Path.Combine(
Application.StartupPath,
"db",
"RBACSystem.sqlite"
);
public static void InitializeDatabase()
{
EnsureDirectoryExists();
using (var db = GetDatabase())
{
// 检查初始化状态(通过检查是否存在系统表)
bool isInitialized = db.DbMaintenance.IsAnyTable("RolePermission");
if (!isInitialized)
{
// 创建所有表
db.CodeFirst.InitTables(
typeof(User),
typeof(Role),
typeof(Permission),
typeof(UserRole),
typeof(RolePermission)
);
// 初始化基础数据
InitializeSeedData(db);
}
}
}
public static SqlSugarClient GetDatabase()
{
return new SqlSugarClient(new ConnectionConfig()
{
ConnectionString = $"Data Source={DatabasePath};",
DbType = DbType.Sqlite,
IsAutoCloseConnection = true,
InitKeyType = InitKeyType.Attribute
});
}
private static void EnsureDirectoryExists()
{
var directory = Path.GetDirectoryName(DatabasePath);
if (!Directory.Exists(directory))
{
Directory.CreateDirectory(directory);
}
}
private static void InitializeSeedData(SqlSugarClient db)
{
// 初始化角色
var adminRole = GetOrCreateRole(db, "admin", "系统管理员");
var userRole = GetOrCreateRole(db, "user", "普通用户");
// 初始化权限
var permissions = new List<Permission>
{
new Permission { Code = "system:access", Name = "访问系统" },
new Permission { Code = "user:view", Name = "查看用户" },
new Permission { Code = "user:edit", Name = "管理用户" },
new Permission { Code = "role:manage", Name = "角色管理" },
new Permission { Code = "system:config", Name = "配置权限" },
new Permission { Code = "system:loadscheme", Name = "加载方案" },
new Permission { Code = "system:addscheme", Name = "新增方案" },
new Permission { Code = "system:deletescheme", Name = "删除方案" }
};
InitializePermissions(db, permissions);
// 分配权限给管理员角色
AssignPermissionsToRole(db, adminRole.Id, permissions.Select(p => p.Code).ToList());
// 创建默认管理员
CreateAdminUser(db);
}
private static Role GetOrCreateRole(SqlSugarClient db, string roleName, string description)
{
var role = db.Queryable<Role>()
.First(r => r.RoleName == roleName);
if (role == null)
{
role = new Role
{
RoleName = roleName,
Description = description
};
role.Id = db.Insertable(role).ExecuteReturnIdentity();
}
return role;
}
private static void InitializePermissions(SqlSugarClient db, List<Permission> permissions)
{
foreach (var p in permissions)
{
if (!db.Queryable<Permission>().Any(x => x.Code == p.Code))
{
db.Insertable(p).ExecuteCommand();
}
}
}
private static void AssignPermissionsToRole(SqlSugarClient db, int roleId, List<string> permissionCodes)
{
var existing = db.Queryable<RolePermission>()
.Where(rp => rp.RoleId == roleId)
.Select(rp => rp.PermissionCode)
.ToList();
foreach (var code in permissionCodes.Except(existing))
{
db.Insertable(new RolePermission
{
RoleId = roleId,
PermissionCode = code
}).ExecuteCommand();
}
}
private static void CreateAdminUser(SqlSugarClient db)
{
if (!db.Queryable<User>().Any(u => u.UserName == "admin"))
{
var admin = new User
{
UserName = "admin",
Password = HashHelper.MD5Encrypt("admin123"),
LastLoginTime = null
};
admin.Id = db.Insertable(admin).ExecuteReturnIdentity();
db.Insertable(new UserRole
{
UserId = admin.Id,
RoleId = db.Queryable<Role>().First(r => r.RoleName == "admin").Id
}).ExecuteCommand();
}
}
}
}

View File

@ -0,0 +1,19 @@
using System.Security.Cryptography;
using System.Text;
namespace DHSoftware.Utils
{
// 密码加密辅助类
public static class HashHelper
{
public static string MD5Encrypt(string input)
{
using (var md5 = MD5.Create())
{
byte[] inputBytes = Encoding.UTF8.GetBytes(input);
byte[] hashBytes = md5.ComputeHash(inputBytes);
return BitConverter.ToString(hashBytes).Replace("-", "");
}
}
}
}

View File

@ -1,5 +1,4 @@
using Microsoft.Win32; using Microsoft.Win32;
using System.Drawing;
namespace DHSoftware.Utils namespace DHSoftware.Utils
{ {

View File

@ -0,0 +1,163 @@
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();
lbTitleName = new AntdUI.Label();
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();
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(lbTitleName);
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";
//
// lbTitleName
//
lbTitleName.Dock = DockStyle.Top;
lbTitleName.Font = new Font("Microsoft YaHei UI", 12F, FontStyle.Regular, GraphicsUnit.Point, 134);
lbTitleName.Location = new Point(18, 18);
lbTitleName.Name = "lbTitleName";
lbTitleName.Size = new Size(464, 24);
lbTitleName.TabIndex = 23;
lbTitleName.Text = "新增相机操作";
//
// 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 = 28;
//
// 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 = 27;
label3.Text = "相机名称";
//
// divider1
//
divider1.Dock = DockStyle.Top;
divider1.Location = new Point(18, 98);
divider1.Name = "divider1";
divider1.Size = new Size(464, 12);
divider1.TabIndex = 26;
//
// 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 = 25;
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 = 24;
//
// 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.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.Label lbTitleName;
}
}

View File

@ -0,0 +1,49 @@

namespace DHSoftware.Views
{
public partial class AddCameraControl : UserControl
{
private AntdUI.Window window;
public bool submit;
public string CubicleName;
public AddCameraControl(AntdUI.Window _window, string TitleName)
{
this.window = _window;
InitializeComponent();
lbTitleName.Text = TitleName;
// 绑定事件
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

@ -1,81 +0,0 @@
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

@ -1,61 +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 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

@ -0,0 +1,162 @@
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();
lbTitleName = 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(lbTitleName);
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;
//
// lbTitleName
//
lbTitleName.Dock = DockStyle.Top;
lbTitleName.Font = new Font("Microsoft YaHei UI", 12F, FontStyle.Regular, GraphicsUnit.Point, 134);
lbTitleName.Location = new Point(18, 18);
lbTitleName.Name = "lbTitleName";
lbTitleName.Size = new Size(464, 24);
lbTitleName.TabIndex = 17;
lbTitleName.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 lbTitleName;
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

@ -0,0 +1,48 @@

namespace DHSoftware.Views
{
public partial class AddCubicleControl : UserControl
{
private AntdUI.Window window;
public bool submit;
public string CubicleName;
public AddCubicleControl(AntdUI.Window _window,string TitleName)
{
this.window = _window;
InitializeComponent();
lbTitleName.Text = TitleName;
// 绑定事件
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

@ -1,82 +0,0 @@
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

@ -1,55 +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 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

@ -0,0 +1,162 @@
namespace DHSoftware.Views
{
partial class AddGlobalControl
{
/// <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();
lbTitleName = 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(lbTitleName);
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, 192);
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;
//
// lbTitleName
//
lbTitleName.Dock = DockStyle.Top;
lbTitleName.Font = new Font("Microsoft YaHei UI", 12F, FontStyle.Regular, GraphicsUnit.Point, 134);
lbTitleName.Location = new Point(18, 18);
lbTitleName.Name = "lbTitleName";
lbTitleName.Size = new Size(464, 24);
lbTitleName.TabIndex = 17;
lbTitleName.Text = "新增全局配置操作";
//
// AddGlobalControl
//
Controls.Add(panel1);
Name = "AddGlobalControl";
Size = new Size(500, 192);
panel1.ResumeLayout(false);
stackPanel1.ResumeLayout(false);
ResumeLayout(false);
}
#endregion
private AntdUI.Panel panel1;
private AntdUI.Label lbTitleName;
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

@ -0,0 +1,48 @@

namespace DHSoftware.Views
{
public partial class AddGlobalControl : UserControl
{
private AntdUI.Window window;
public bool submit;
public string GlobalName;
public AddGlobalControl(AntdUI.Window _window,string TitleName)
{
this.window = _window;
InitializeComponent();
lbTitleName.Text = TitleName;
// 绑定事件
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;
}
GlobalName = input_name.Text;
submit = true;
this.Dispose();
}
}
}

View File

@ -0,0 +1,163 @@
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();
lbTitleName = 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(lbTitleName);
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, 192);
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;
//
// lbTitleName
//
lbTitleName.Dock = DockStyle.Top;
lbTitleName.Font = new Font("Microsoft YaHei UI", 12F, FontStyle.Regular, GraphicsUnit.Point, 134);
lbTitleName.Location = new Point(18, 18);
lbTitleName.Name = "lbTitleName";
lbTitleName.Size = new Size(464, 24);
lbTitleName.TabIndex = 17;
lbTitleName.Text = "新增运动控制操作";
//
// AddMotionControl
//
Controls.Add(panel1);
Name = "AddMotionControl";
Size = new Size(500, 192);
panel1.ResumeLayout(false);
stackPanel1.ResumeLayout(false);
ResumeLayout(false);
}
#endregion
private AntdUI.Panel panel1;
private AntdUI.Label lbTitleName;
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

@ -0,0 +1,49 @@

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,string TitleName)
{
this.window = _window;
InitializeComponent();
lbTitleName.Text = TitleName;
// 绑定事件
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;
submit = true;
this.Dispose();
}
}
}

View File

@ -0,0 +1,201 @@
namespace DHSoftware.Views
{
partial class AddSchemeControl
{
/// <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();
stackPanel2 = new AntdUI.StackPanel();
label1 = new AntdUI.Label();
ckNullScheme = new AntdUI.Checkbox();
divider1 = new AntdUI.Divider();
stackPanel1 = new AntdUI.StackPanel();
button_cancel = new AntdUI.Button();
button_ok = new AntdUI.Button();
divider2 = new AntdUI.Divider();
lbTitleName = new AntdUI.Label();
panel1.SuspendLayout();
stackPanel2.SuspendLayout();
stackPanel1.SuspendLayout();
SuspendLayout();
//
// panel1
//
panel1.Controls.Add(input_name);
panel1.Controls.Add(label3);
panel1.Controls.Add(stackPanel2);
panel1.Controls.Add(divider1);
panel1.Controls.Add(stackPanel1);
panel1.Controls.Add(divider2);
panel1.Controls.Add(lbTitleName);
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, 234);
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, 164);
input_name.Name = "input_name";
input_name.Radius = 3;
input_name.Size = new Size(464, 38);
input_name.TabIndex = 25;
//
// label3
//
label3.Dock = DockStyle.Top;
label3.Font = new Font("Microsoft YaHei UI", 12F, FontStyle.Regular, GraphicsUnit.Point, 134);
label3.Location = new Point(18, 140);
label3.Name = "label3";
label3.Size = new Size(464, 24);
label3.TabIndex = 24;
label3.Text = "方案名称";
//
// stackPanel2
//
stackPanel2.Controls.Add(label1);
stackPanel2.Controls.Add(ckNullScheme);
stackPanel2.Dock = DockStyle.Top;
stackPanel2.Location = new Point(18, 110);
stackPanel2.Name = "stackPanel2";
stackPanel2.RightToLeft = RightToLeft.No;
stackPanel2.Size = new Size(464, 30);
stackPanel2.TabIndex = 23;
stackPanel2.Text = "stackPanel2";
//
// label1
//
label1.Dock = DockStyle.Fill;
label1.Location = new Point(84, 3);
label1.Name = "label1";
label1.Size = new Size(333, 24);
label1.TabIndex = 1;
label1.Text = "默认从当前方案派生,若想创建新方案选中此项";
//
// ckNullScheme
//
ckNullScheme.Dock = DockStyle.Left;
ckNullScheme.Location = new Point(3, 3);
ckNullScheme.Name = "ckNullScheme";
ckNullScheme.Size = new Size(75, 24);
ckNullScheme.TabIndex = 0;
ckNullScheme.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;
//
// lbTitleName
//
lbTitleName.Dock = DockStyle.Top;
lbTitleName.Font = new Font("Microsoft YaHei UI", 12F, FontStyle.Regular, GraphicsUnit.Point, 134);
lbTitleName.Location = new Point(18, 18);
lbTitleName.Name = "lbTitleName";
lbTitleName.Size = new Size(464, 24);
lbTitleName.TabIndex = 17;
lbTitleName.Text = "新增方案操作";
//
// AddSchemeControl
//
Controls.Add(panel1);
Name = "AddSchemeControl";
Size = new Size(500, 234);
panel1.ResumeLayout(false);
stackPanel2.ResumeLayout(false);
stackPanel1.ResumeLayout(false);
ResumeLayout(false);
}
#endregion
private AntdUI.Panel panel1;
private AntdUI.Label lbTitleName;
private AntdUI.Divider divider1;
private AntdUI.StackPanel stackPanel1;
private AntdUI.Button button_cancel;
private AntdUI.Button button_ok;
private AntdUI.Divider divider2;
private AntdUI.Input input_name;
private AntdUI.Label label3;
private AntdUI.StackPanel stackPanel2;
private AntdUI.Checkbox ckNullScheme;
private AntdUI.Label label1;
}
}

View File

@ -0,0 +1,52 @@

namespace DHSoftware.Views
{
public partial class AddSchemeControl : UserControl
{
private AntdUI.Window window;
public bool submit;
public string SchemeName;
public bool NullScheme;
public AddSchemeControl(AntdUI.Window _window,string TitleName)
{
this.window = _window;
InitializeComponent();
lbTitleName.Text = TitleName;
// 绑定事件
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;
}
SchemeName = input_name.Text;
NullScheme = ckNullScheme.Checked;
submit = true;
this.Dispose();
}
}
}

View File

@ -0,0 +1,120 @@
<?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

@ -1,5 +1,5 @@
using DH.Commons.Enums; using DH.Commons.Base;
using DH.Devices.Devices; using DH.Commons.Enums;
using DVPCameraType; using DVPCameraType;
using System; using System;
using System.Collections.Generic; using System.Collections.Generic;

View File

@ -1,5 +1,5 @@
using AntdUI; using AntdUI;
using DH.Devices.Devices; using DH.Commons.Base;
using System; using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.ComponentModel; using System.ComponentModel;

425
DHSoftware/Views/CameraControl.Designer.cs generated Normal file
View File

@ -0,0 +1,425 @@
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();
sthPic = new AntdUI.Switch();
label6 = new AntdUI.Label();
label8 = new AntdUI.Label();
label9 = new AntdUI.Label();
label10 = new AntdUI.Label();
label11 = new AntdUI.Label();
sthAllPic = new AntdUI.Switch();
label12 = new AntdUI.Label();
sltCamType = new AntdUI.Select();
label13 = new AntdUI.Label();
((System.ComponentModel.ISupportInitialize)pictureBox1).BeginInit();
SuspendLayout();
//
// swhEnable
//
swhEnable.CheckedText = "启用";
swhEnable.Location = new Point(93, 13);
swhEnable.Name = "swhEnable";
swhEnable.Size = new Size(94, 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, 140);
label1.Name = "label1";
label1.Size = new Size(59, 36);
label1.TabIndex = 14;
label1.Text = "曝 光";
//
// label2
//
label2.Location = new Point(28, 183);
label2.Name = "label2";
label2.Size = new Size(59, 36);
label2.TabIndex = 15;
label2.Text = "增 益";
//
// label3
//
label3.Location = new Point(28, 226);
label3.Name = "label3";
label3.Size = new Size(59, 36);
label3.TabIndex = 16;
label3.Text = "旋转角度";
//
// iptExposure
//
iptExposure.Location = new Point(93, 140);
iptExposure.Name = "iptExposure";
iptExposure.Size = new Size(94, 36);
iptExposure.TabIndex = 17;
iptExposure.Tag = "";
iptExposure.Text = "0";
//
// iptGain
//
iptGain.Location = new Point(93, 183);
iptGain.Name = "iptGain";
iptGain.Size = new Size(94, 36);
iptGain.TabIndex = 18;
iptGain.Text = "0";
//
// iptRevolve
//
iptRevolve.Location = new Point(93, 226);
iptRevolve.Name = "iptRevolve";
iptRevolve.Size = new Size(94, 36);
iptRevolve.TabIndex = 19;
iptRevolve.Text = "0";
//
// label4
//
label4.Location = new Point(28, 269);
label4.Name = "label4";
label4.Size = new Size(59, 36);
label4.TabIndex = 20;
label4.Text = "采图模式";
//
// sltAcquisitionMode
//
sltAcquisitionMode.List = true;
sltAcquisitionMode.Location = new Point(93, 269);
sltAcquisitionMode.Name = "sltAcquisitionMode";
sltAcquisitionMode.Size = new Size(94, 36);
sltAcquisitionMode.TabIndex = 21;
//
// label5
//
label5.Location = new Point(28, 314);
label5.Name = "label5";
label5.Size = new Size(59, 36);
label5.TabIndex = 22;
label5.Text = "触发模式";
//
// sltTriggerMode
//
sltTriggerMode.List = true;
sltTriggerMode.Location = new Point(93, 314);
sltTriggerMode.Name = "sltTriggerMode";
sltTriggerMode.Size = new Size(94, 36);
sltTriggerMode.TabIndex = 26;
//
// label7
//
label7.Location = new Point(19, 476);
label7.Name = "label7";
label7.Size = new Size(29, 23);
label7.TabIndex = 28;
label7.Text = "ROI";
//
// iptROIW
//
iptROIW.Location = new Point(93, 494);
iptROIW.Name = "iptROIW";
iptROIW.Size = new Size(94, 37);
iptROIW.TabIndex = 31;
iptROIW.Text = "0";
//
// iptROIY
//
iptROIY.Location = new Point(93, 451);
iptROIY.Name = "iptROIY";
iptROIY.Size = new Size(94, 37);
iptROIY.TabIndex = 30;
iptROIY.Text = "0";
//
// iptROIX
//
iptROIX.Location = new Point(93, 408);
iptROIX.Name = "iptROIX";
iptROIX.Size = new Size(94, 37);
iptROIX.TabIndex = 29;
iptROIX.Tag = "";
iptROIX.Text = "0";
//
// iptROIH
//
iptROIH.Location = new Point(93, 537);
iptROIH.Name = "iptROIH";
iptROIH.Size = new Size(94, 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, 489);
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(282, 532);
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(440, 532);
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(595, 532);
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(743, 532);
button3.Name = "button3";
button3.Size = new Size(80, 38);
button3.TabIndex = 37;
button3.Text = "连续触发";
//
// sthPic
//
sthPic.CheckedText = "启用";
sthPic.Location = new Point(93, 60);
sthPic.Name = "sthPic";
sthPic.Size = new Size(94, 33);
sthPic.TabIndex = 39;
sthPic.UnCheckedText = "关闭";
//
// label6
//
label6.Location = new Point(28, 70);
label6.Name = "label6";
label6.Size = new Size(59, 23);
label6.TabIndex = 38;
label6.Text = "相 机 图";
//
// label8
//
label8.Location = new Point(58, 408);
label8.Name = "label8";
label8.Size = new Size(29, 37);
label8.TabIndex = 40;
label8.Text = "X:";
//
// label9
//
label9.Location = new Point(58, 451);
label9.Name = "label9";
label9.Size = new Size(29, 37);
label9.TabIndex = 41;
label9.Text = "Y:";
//
// label10
//
label10.Location = new Point(43, 494);
label10.Name = "label10";
label10.Size = new Size(44, 37);
label10.TabIndex = 42;
label10.Text = "宽度:";
//
// label11
//
label11.Location = new Point(43, 538);
label11.Name = "label11";
label11.Size = new Size(44, 36);
label11.TabIndex = 43;
label11.Text = "高度:";
//
// sthAllPic
//
sthAllPic.CheckedText = "启用";
sthAllPic.Location = new Point(93, 356);
sthAllPic.Name = "sthAllPic";
sthAllPic.Size = new Size(94, 33);
sthAllPic.TabIndex = 45;
sthAllPic.UnCheckedText = "关闭";
//
// label12
//
label12.Location = new Point(28, 366);
label12.Name = "label12";
label12.Size = new Size(59, 23);
label12.TabIndex = 44;
label12.Text = "全 画 幅";
//
// sltCamType
//
sltCamType.List = true;
sltCamType.Location = new Point(93, 97);
sltCamType.Name = "sltCamType";
sltCamType.Size = new Size(94, 36);
sltCamType.TabIndex = 47;
//
// label13
//
label13.Location = new Point(28, 99);
label13.Name = "label13";
label13.Size = new Size(59, 36);
label13.TabIndex = 46;
label13.Text = "相机类型";
//
// CameraControl
//
AutoScaleDimensions = new SizeF(7F, 17F);
AutoScaleMode = AutoScaleMode.Font;
Controls.Add(sltCamType);
Controls.Add(label13);
Controls.Add(sthAllPic);
Controls.Add(label12);
Controls.Add(label11);
Controls.Add(label10);
Controls.Add(label9);
Controls.Add(label8);
Controls.Add(sthPic);
Controls.Add(label6);
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, 601);
((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;
private AntdUI.Switch sthPic;
private AntdUI.Label label6;
private AntdUI.Label label8;
private AntdUI.Label label9;
private AntdUI.Label label10;
private AntdUI.Label label11;
private AntdUI.Switch sthAllPic;
private AntdUI.Label label12;
private AntdUI.Select sltCamType;
private AntdUI.Label label13;
}
}

View File

@ -0,0 +1,137 @@
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.Base;
using DH.Commons.Enums;
using static System.Windows.Forms.VisualStyles.VisualStyleElement;
using Window = AntdUI.Window;
namespace DHSoftware.Views
{
public partial class CameraControl : UserControl
{
Window window;
CameraBase CameraBase;
public CameraControl(Window _window, CameraBase cameraBase)
{
window = _window;
CameraBase = cameraBase;
InitializeComponent();
sltCamType.TextChanged += SltCamTpye_TextChanged;
InitData();
BindData();
}
private void SltCamTpye_TextChanged(object? sender, EventArgs e)
{
if (sender is Select slt && !string.IsNullOrEmpty(slt.Text))
{
// 将文本转换为枚举值
if (Enum.TryParse<EnumCamType>(slt.Text, out var plcType))
{
switch (plcType)
{
case EnumCamType.Do3think:
case EnumCamType.hik:
break;
default:
break;
}
}
else
{
}
}
}
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()
{
sltCamType.DataBindings.Add("Text", CameraBase, "CamType", true, DataSourceUpdateMode.OnPropertyChanged, "");
sthPic.DataBindings.Add(nameof(sthPic.Checked), CameraBase, nameof(CameraBase.IsSavePicEnabled),
true, DataSourceUpdateMode.OnPropertyChanged);
sthAllPic.DataBindings.Add(nameof(sthAllPic.Checked), CameraBase, nameof(CameraBase.IsAllPicEnabled),
true, DataSourceUpdateMode.OnPropertyChanged);
// 启用状态绑定
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()
{
// 获取枚举字段名列表(原描述改为字段名)
sltCamType.Items.Clear();
foreach (EnumCamType value in Enum.GetValues(typeof(EnumCamType)))
{
sltCamType.Items.Add(value.ToString());
}
// 初始化下拉框选项
sltAcquisitionMode.Items.AddRange(new[] { "连续模式", "触发模式" });
sltTriggerMode.Items.AddRange(new[] { "软触发", "硬触发" });
// 设置初始选择
sltAcquisitionMode.SelectedIndex = CameraBase.IsContinueMode ? 0 : 1;
sltTriggerMode.SelectedIndex = CameraBase.IsHardwareTrigger ? 1 : 0;
}
}
}

View File

@ -0,0 +1,120 @@
<?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>

102
DHSoftware/Views/CloseWindow.Designer.cs generated Normal file
View File

@ -0,0 +1,102 @@

namespace DHSoftware.Views
{
partial class CloseWindow
{
/// <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()
{
System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(CloseWindow));
panel1 = new AntdUI.Panel();
panel2 = new AntdUI.Panel();
spin1 = new AntdUI.Spin();
panel1.SuspendLayout();
panel2.SuspendLayout();
SuspendLayout();
//
// panel1
//
panel1.Back = Color.Transparent;
panel1.Controls.Add(panel2);
panel1.Dock = DockStyle.Fill;
panel1.Location = new Point(0, 0);
panel1.Name = "panel1";
panel1.Size = new Size(280, 124);
panel1.TabIndex = 0;
panel1.Text = "panel1";
//
// panel2
//
panel2.Back = Color.Transparent;
panel2.Controls.Add(spin1);
panel2.Dock = DockStyle.Fill;
panel2.Location = new Point(0, 0);
panel2.Name = "panel2";
panel2.Radius = 0;
panel2.Size = new Size(280, 124);
panel2.TabIndex = 4;
panel2.Text = "panel2";
//
// spin1
//
spin1.Fill = SystemColors.Window;
spin1.Font = new Font("Microsoft YaHei UI", 10.5F, FontStyle.Regular, GraphicsUnit.Point, 134);
spin1.ForeColor = SystemColors.Window;
spin1.Location = new Point(50, 20);
spin1.Name = "spin1";
spin1.Size = new Size(170, 92);
spin1.TabIndex = 0;
spin1.Text = "软件正在关闭,请稍候......";
//
// CloseWindow
//
AutoScaleDimensions = new SizeF(7F, 17F);
AutoScaleMode = AutoScaleMode.Font;
BackColor = Color.FromArgb(46, 108, 227);
ClientSize = new Size(280, 124);
ControlBox = false;
Controls.Add(panel1);
Icon = (Icon)resources.GetObject("$this.Icon");
MaximizeBox = false;
MinimizeBox = false;
Name = "CloseWindow";
ShowIcon = false;
StartPosition = FormStartPosition.CenterScreen;
Text = "WelcomeForm";
panel1.ResumeLayout(false);
panel2.ResumeLayout(false);
ResumeLayout(false);
}
#endregion
private AntdUI.Panel panel1;
private AntdUI.Panel panel2;
private AntdUI.Spin spin1;
}
}

View File

@ -0,0 +1,38 @@
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;
namespace DHSoftware.Views
{
public partial class CloseWindow : Window
{
public CloseWindow()
{
InitializeComponent();
Control.CheckForIllegalCrossThreadCalls = false;
}
/// <summary>
/// 窗体对象实例
/// </summary>
private static CloseWindow _instance;
public static CloseWindow Instance
{
get
{
if (_instance == null)
{
_instance = new CloseWindow();
}
return _instance;
}
}
}
}

View File

@ -0,0 +1,382 @@
<?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>
<assembly alias="System.Drawing" name="System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" />
<data name="$this.Icon" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
<value>
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
AAE+w7t4QMS7/EDEu/9AxLv/QMS7/0DEu/9AxLv/QMS7/0DEu/9AxLv/QMS7/0DEu/9ivI//s6kr/7yn
H/+8px//vKcf/7ynH/+rqzT/T8Co/0DEu/9AxLv/QMS7/0DEu/9AxLv/QMS7/0DEu/9AxLv/QMS7/0DE
u/9AxLv/QMS837ynH/+8px//vKcf/7ynH/+8px/NuqcdGgAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA
AAAAAAAAAAAAAAAAAAE+w7t4QMS7/EDEu/9AxLv/QMS7/0DEu/9AxLv/QMS7/0DEu/9AxLv/QMS7/0DE
u/9cvZj/sKot/7ynH/+8px//vKcf/7ynH/+xqi7/UcCm/0DEu/9AxLv/QMS7/0DEu/9AxLv/QMS7/0DE
u/9AxLv/QMS7/0DEu/9AxLv/QMS837ynH/+8px//vKcf/7ynH/+8px/NuqcdGgAAAAAAAAAAAAAAAAAA
AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAE+w7t4QMS7/EDEu/9AxLv/QMS7/0DEu/9AxLv/QMS7/0DE
u/9AxLv/QMS7/0DEu/9bvZj/sKou/7ynH/+8px//vKcf/7ynH/+xqi3/UcCl/0DEu/9AxLv/QMS7/0DE
u/9AxLv/QMS7/0DEu/9AxLv/QMS7/0DEu/9AxLv/QMS837ynH/+8px//vKcf/7ynH/+8px/NuqcdGgAA
AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAE+w7t4QMS7/EDEu/9AxLv/QMS7/z/E
u7E/w7qNP8O6jT/Duo0/w7qNP8O6jT/Duo1wuH2wtqgm+LynH/+8px//vKcf/7ynH/+0qSntWb6cmj/D
uo0/w7qNP8O6jT/Duo0/w7qNP8O6jT/Eu5Y/xLvhQMS7/0DEu/9AxLv/QMS837ynH/+8px//vKcf/7yn
H/+8px/NuqcdGgAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAE+w7t4QMS7/EDE
u/9AxLv/QMS7/0HEvlIzzMwFM8zMBTPMzAUzzMwFM8zMBTPMzAW4qCRku6cf9bynH/+8px//vKcf/7yn
H/+8pyDKp6c1HTPMzAUzzMwFM8zMBTPMzAUzzMwFM8zMBUDKvxhAxbu8QMS7/0DEu/9AxLv/QMS837yn
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
H/+8px/NuqcdGgAAAAD/gAACwqoYFbqoHUa9pR+DvaYewbyoH+G9qB/yvKcf/rynH/+8px//vKcf/7yn
H/+8px//vKcf/7ynH/+8px//vKcf/rumH5q7qiIegIAAAgAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA
AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAEC/vxQ/w7u7QMS7/0DEu/9AxLv/QMS837yn
H/+8px//vKcf/7ynH/+7px/tu6gftbunH8i9px/nu6cf/bynH/+8px//vKcf/7ynH/+8px//vKcf/7yn
H/+8px//vKcf/7ynH/+8px//vKcf/7yoH/i8px/OvqcdTgAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA
AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAEC/vxQ/w7u7QMS7/0DE
u/9AxLv/QMS837ynH/+8px//vKcf/7ynH/+8px//vKcf/7ynH/+8px//vKcf/7ynH/+8px//vKcf/7yn
H/+8px//vKcf/7ynH/+8px//vKcf/7ynH/+8px/6vKgfx7ymH3K7qhoeAAAAAQAAAAAAAAAAAAAAAAAA
AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAEC/
vxQ/w7u7QMS7/0DEu/9AxLv/QMS837ynH/+8px//vKcf/7ynH/+8px//vKcf/7ynH/+8px//vKcf/7yn
H/+8px//vKcf/7ynH/+8px//vKcf/7ynH/+8px//vKgf/ryoH828pR9buqcdGv+AAAIAAAAAAAAAAAAA
AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA
AAAAAAAAAAAAAEC/vxQ/w7u7QMS7/0DEu/9AxLv/QMS837ynH/+8px//vKcf/7ynH/+8px//vKcf/7yn
H/+8px//vKcf/7ynH/+8px//vKcf/7ynH/+8px/8vKgf8LynH927px+muaYfQv//AAEAAAAAAAAAAAAA
AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA
AAAAAAAAAAAAAAAAAAAAAAAAAAAAAEC/vxQ/w7u7QMS7/0DEu/9AxLv/QMS837ynH/+8px//vKcf/7yn
H/+8px//vKcf/7ynH/+8px//vKcf/7ynH/+8px70u6cf1rymH6+9px+DvKceVL+nICD/gAACAAAAAAAA
AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA
AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAEC/vxQ/w7u7QMS7/0DEu/9AxLv/QMS837yn
H+y8px/3u6Yf+bymH++8px7kvacf172nH8C8px6jvqcffb2qH1G3piEuuacaHb+fIBC/vwAEAAAAAAAA
AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA
AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAEC/vxQ/w7u7QMS7/0DE
u/9AxLv/QMS83wAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA
AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA
AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA
AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA
AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA
AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA
AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA
AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA
AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA
AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA==
</value>
</data>
</root>

View File

@ -96,6 +96,7 @@
button_ok.TabIndex = 0; button_ok.TabIndex = 0;
button_ok.Text = "确定"; button_ok.Text = "确定";
button_ok.Type = AntdUI.TTypeMini.Primary; button_ok.Type = AntdUI.TTypeMini.Primary;
// //
// divider1 // divider1
// //

View File

@ -3,7 +3,7 @@
using System.ComponentModel; using System.ComponentModel;
using System.Reflection; using System.Reflection;
using AntdUI; using AntdUI;
using DH.Commons.Enums; using DH.Commons.Base;
using DH.Devices.Vision; using DH.Devices.Vision;
namespace DHSoftware.Views namespace DHSoftware.Views
@ -97,6 +97,7 @@ namespace DHSoftware.Views
Font = new System.Drawing.Font("Microsoft YaHei UI", 9F), Font = new System.Drawing.Font("Microsoft YaHei UI", 9F),
Size = new Size(90, 42), Size = new Size(90, 42),
Text = name, Text = name,
ForeColor = Color.FromArgb(61, 94, 218)
}; };
foreach (var item in Cameras) foreach (var item in Cameras)
{ {

View File

@ -7,10 +7,9 @@ using System.Linq;
using System.Text; using System.Text;
using System.Threading.Tasks; using System.Threading.Tasks;
using System.Windows.Forms; using System.Windows.Forms;
using System.IO; using System.IO;
using DH.Commons.Enums; using DH.Commons.Enums;
using DH.Devices.Devices; using DH.Commons.Base;
namespace XKRS.UI.Device.Winform namespace XKRS.UI.Device.Winform

View File

@ -48,6 +48,8 @@ namespace AntdUIDemo.Views.Table
user.LabelDescription = input_name.Text; user.LabelDescription = input_name.Text;
user.ScoreMinValue =(double)input_minScore.Value; user.ScoreMinValue =(double)input_minScore.Value;
user.ScoreMaxValue = (double)input_maxScore.Value; user.ScoreMaxValue = (double)input_maxScore.Value;
user.AreaMinValue = (double)input_minArea.Value;
user.AreaMaxValue = (double)input_maxArea.Value;
submit = true; submit = true;
this.Dispose(); this.Dispose();
} }
@ -58,8 +60,8 @@ namespace AntdUIDemo.Views.Table
// input_addr.Text = user.Address; // input_addr.Text = user.Address;
input_minScore.Value =(decimal) user.ScoreMinValue; input_minScore.Value =(decimal) user.ScoreMinValue;
input_maxScore.Value =(decimal) user.ScoreMaxValue; input_maxScore.Value =(decimal) user.ScoreMaxValue;
input_minArea.Value =(decimal) user.ScoreMaxValue; input_minArea.Value =(decimal) user.AreaMinValue;
input_maxScore.Value =(decimal) user.ScoreMaxValue; input_maxArea.Value =(decimal) user.AreaMaxValue;
} }
} }
} }

View File

@ -15,6 +15,7 @@ using System.Text;
using System.Threading.Tasks; using System.Threading.Tasks;
using System.Windows.Forms; using System.Windows.Forms;
using DH.Devices.Vision; using DH.Devices.Vision;
using DH.Commons.Base;
namespace DHSoftware.Views namespace DHSoftware.Views
{ {
@ -23,7 +24,7 @@ namespace DHSoftware.Views
private DetectionConfig _currentConfig = new DetectionConfig(); private DetectionConfig _currentConfig = new DetectionConfig();
private readonly string _configName; private readonly string _configName;
List<KeyValuePair<string, int>> MLModelTypes = GetFilteredEnumDescriptionsAndValues<MLModelType>(); List<KeyValuePair<string, int>> MLModelTypes = GetFilteredEnumDescriptionsAndValues<ModelType>();
public static List<KeyValuePair<string, int>> GetFilteredEnumDescriptionsAndValues<T>() where T : Enum public static List<KeyValuePair<string, int>> GetFilteredEnumDescriptionsAndValues<T>() where T : Enum
{ {
@ -73,7 +74,7 @@ namespace DHSoftware.Views
{ {
InitializeComponent(); InitializeComponent();
InitTableColumns(); InitTableColumns();
InitData(); //InitData();
BindEventHandler(); BindEventHandler();
foreach (var item in MLModelTypes) foreach (var item in MLModelTypes)
{ {
@ -84,63 +85,6 @@ namespace DHSoftware.Views
} }
public bool IsEnabled
{
get => switchEnable.AutoCheck;
set => switchEnable.AutoCheck = value;
}
// 模型路径属性
public string ModelPath
{
get => Detection.ModelPath;
set
{
Detection.ModelPath = value;
tbModelpath.Text = value; // 更新到文本框
}
}
public bool IsPicNGEnable
{
get => sthSaveNGPic.AutoCheck;
set => sthSaveNGPic.AutoCheck = value;
}
public bool IsPicEnable
{
get => sthPic.AutoCheck;
set => sthPic.AutoCheck = value;
}
//public MLModelType LModelType
//{
//}
private string _picTag;
public string picTag
{
get => _picTag;
set
{
_picTag = value;
}
}
private string _afterTag;
public string afterTag
{
get => _afterTag;
set
{
_afterTag = value;
}
}
private void InitTableColumns() private void InitTableColumns()
{ {
table_base.Columns = new ColumnCollection() { table_base.Columns = new ColumnCollection() {

View File

@ -40,10 +40,10 @@
btnPreAdd = new AntdUI.Button(); btnPreAdd = new AntdUI.Button();
preTable = new AntdUI.Table(); preTable = new AntdUI.Table();
label3 = new AntdUI.Label(); label3 = new AntdUI.Label();
btnPath = new AntdUI.Button(); btnPrePath = new AntdUI.Button();
switch1 = new AntdUI.Switch(); sthPreStatus = new AntdUI.Switch();
label2 = new AntdUI.Label(); label2 = new AntdUI.Label();
iptPath = new AntdUI.Input(); iptPrePath = new AntdUI.Input();
label1 = new AntdUI.Label(); label1 = new AntdUI.Label();
tabPage2 = new AntdUI.TabPage(); tabPage2 = new AntdUI.TabPage();
btnLableDelete = new AntdUI.Button(); btnLableDelete = new AntdUI.Button();
@ -51,36 +51,33 @@
lableTable = new AntdUI.Table(); lableTable = new AntdUI.Table();
label15 = new AntdUI.Label(); label15 = new AntdUI.Label();
btnPic = new AntdUI.Button(); btnPic = new AntdUI.Button();
switch6 = new AntdUI.Switch(); sthDetectNG = new AntdUI.Switch();
label13 = new AntdUI.Label(); label13 = new AntdUI.Label();
switch7 = new AntdUI.Switch(); sthOKDetect = new AntdUI.Switch();
label14 = new AntdUI.Label(); label14 = new AntdUI.Label();
switch4 = new AntdUI.Switch(); sthNGOriginal = new AntdUI.Switch();
label6 = new AntdUI.Label(); label6 = new AntdUI.Label();
switch5 = new AntdUI.Switch(); sthOKOriginal = new AntdUI.Switch();
label12 = new AntdUI.Label(); label12 = new AntdUI.Label();
input1 = new AntdUI.Input(); iptConfidence = new AntdUI.Input();
label5 = new AntdUI.Label(); label5 = new AntdUI.Label();
flowPanel1 = new AntdUI.FlowPanel(); flowCameraPanel = new AntdUI.FlowPanel();
label11 = new AntdUI.Label(); label11 = new AntdUI.Label();
switch3 = new AntdUI.Switch(); sthStation = new AntdUI.Switch();
label10 = new AntdUI.Label(); label10 = new AntdUI.Label();
stDetectType = new AntdUI.Select(); stDetectType = new AntdUI.Select();
label9 = new AntdUI.Label(); label9 = new AntdUI.Label();
btnCorrelatedCamera = new AntdUI.Button(); btnCorrelatedCamera = new AntdUI.Button();
btnPath2 = new AntdUI.Button(); btnPath2 = new AntdUI.Button();
switch2 = new AntdUI.Switch(); sthDetectStatus = new AntdUI.Switch();
label7 = new AntdUI.Label(); label7 = new AntdUI.Label();
iptPath2 = new AntdUI.Input(); iptDetectPath = new AntdUI.Input();
label8 = new AntdUI.Label(); label8 = new AntdUI.Label();
tabPage3 = new AntdUI.TabPage(); tabPage3 = new AntdUI.TabPage();
tabPage4 = new AntdUI.TabPage(); tabPage4 = new AntdUI.TabPage();
switch8 = new AntdUI.Switch();
btnSizeDel = new AntdUI.Button(); btnSizeDel = new AntdUI.Button();
btnSizeAdd = new AntdUI.Button(); btnSizeAdd = new AntdUI.Button();
SizeTable = new AntdUI.Table(); SizeTable = new AntdUI.Table();
label17 = new AntdUI.Label();
label18 = new AntdUI.Label();
tabs1.SuspendLayout(); tabs1.SuspendLayout();
tabPage1.SuspendLayout(); tabPage1.SuspendLayout();
tabPage2.SuspendLayout(); tabPage2.SuspendLayout();
@ -98,7 +95,6 @@
tabs1.Pages.Add(tabPage1); tabs1.Pages.Add(tabPage1);
tabs1.Pages.Add(tabPage2); tabs1.Pages.Add(tabPage2);
tabs1.Pages.Add(tabPage3); tabs1.Pages.Add(tabPage3);
tabs1.SelectedIndex = 2;
tabs1.Size = new Size(915, 609); tabs1.Size = new Size(915, 609);
tabs1.Style = styleLine1; tabs1.Style = styleLine1;
tabs1.TabIndex = 1; tabs1.TabIndex = 1;
@ -114,12 +110,12 @@
tabPage1.Controls.Add(btnPreAdd); tabPage1.Controls.Add(btnPreAdd);
tabPage1.Controls.Add(preTable); tabPage1.Controls.Add(preTable);
tabPage1.Controls.Add(label3); tabPage1.Controls.Add(label3);
tabPage1.Controls.Add(btnPath); tabPage1.Controls.Add(btnPrePath);
tabPage1.Controls.Add(switch1); tabPage1.Controls.Add(sthPreStatus);
tabPage1.Controls.Add(label2); tabPage1.Controls.Add(label2);
tabPage1.Controls.Add(iptPath); tabPage1.Controls.Add(iptPrePath);
tabPage1.Controls.Add(label1); tabPage1.Controls.Add(label1);
tabPage1.Location = new Point(-909, -575); tabPage1.Location = new Point(3, 31);
tabPage1.Name = "tabPage1"; tabPage1.Name = "tabPage1";
tabPage1.Size = new Size(909, 575); tabPage1.Size = new Size(909, 575);
tabPage1.TabIndex = 0; tabPage1.TabIndex = 0;
@ -161,6 +157,8 @@
// //
// PreOutTable // PreOutTable
// //
PreOutTable.EmptyHeader = true;
PreOutTable.EnableHeaderResizing = true;
PreOutTable.Location = new Point(191, 355); PreOutTable.Location = new Point(191, 355);
PreOutTable.Name = "PreOutTable"; PreOutTable.Name = "PreOutTable";
PreOutTable.Size = new Size(423, 181); PreOutTable.Size = new Size(423, 181);
@ -195,6 +193,8 @@
// //
// preTable // preTable
// //
preTable.EmptyHeader = true;
preTable.EnableHeaderResizing = true;
preTable.Location = new Point(191, 148); preTable.Location = new Point(191, 148);
preTable.Name = "preTable"; preTable.Name = "preTable";
preTable.Size = new Size(423, 181); preTable.Size = new Size(423, 181);
@ -209,27 +209,27 @@
label3.TabIndex = 1; label3.TabIndex = 1;
label3.Text = "输入参数"; label3.Text = "输入参数";
// //
// btnPath // btnPrePath
// //
btnPath.BorderWidth = 2F; btnPrePath.BorderWidth = 2F;
btnPath.Font = new Font("Microsoft YaHei UI", 9F, FontStyle.Regular, GraphicsUnit.Point, 134); btnPrePath.Font = new Font("Microsoft YaHei UI", 9F, FontStyle.Regular, GraphicsUnit.Point, 134);
btnPath.Ghost = true; btnPrePath.Ghost = true;
btnPath.IconRatio = 0.8F; btnPrePath.IconRatio = 0.8F;
btnPath.IconSvg = resources.GetString("btnPath.IconSvg"); btnPrePath.IconSvg = resources.GetString("btnPrePath.IconSvg");
btnPath.Location = new Point(620, 79); btnPrePath.Location = new Point(620, 79);
btnPath.Name = "btnPath"; btnPrePath.Name = "btnPrePath";
btnPath.Size = new Size(80, 38); btnPrePath.Size = new Size(80, 38);
btnPath.TabIndex = 7; btnPrePath.TabIndex = 7;
btnPath.Text = "打开"; btnPrePath.Text = "打开";
// //
// switch1 // sthPreStatus
// //
switch1.CheckedText = "启用"; sthPreStatus.CheckedText = "启用";
switch1.Location = new Point(207, 33); sthPreStatus.Location = new Point(207, 33);
switch1.Name = "switch1"; sthPreStatus.Name = "sthPreStatus";
switch1.Size = new Size(82, 33); sthPreStatus.Size = new Size(82, 33);
switch1.TabIndex = 4; sthPreStatus.TabIndex = 4;
switch1.UnCheckedText = "关闭"; sthPreStatus.UnCheckedText = "关闭";
// //
// label2 // label2
// //
@ -239,14 +239,14 @@
label2.TabIndex = 3; label2.TabIndex = 3;
label2.Text = "状 态"; label2.Text = "状 态";
// //
// iptPath // iptPrePath
// //
iptPath.Location = new Point(191, 79); iptPrePath.Location = new Point(191, 79);
iptPath.Name = "iptPath"; iptPrePath.Name = "iptPrePath";
iptPath.PlaceholderText = "请点击打开按钮选择模型路径"; iptPrePath.PlaceholderText = "请点击打开按钮选择模型路径";
iptPath.ReadOnly = true; iptPrePath.ReadOnly = true;
iptPath.Size = new Size(423, 42); iptPrePath.Size = new Size(423, 42);
iptPath.TabIndex = 1; iptPrePath.TabIndex = 1;
// //
// label1 // label1
// //
@ -263,34 +263,33 @@
tabPage2.Controls.Add(lableTable); tabPage2.Controls.Add(lableTable);
tabPage2.Controls.Add(label15); tabPage2.Controls.Add(label15);
tabPage2.Controls.Add(btnPic); tabPage2.Controls.Add(btnPic);
tabPage2.Controls.Add(switch6); tabPage2.Controls.Add(sthDetectNG);
tabPage2.Controls.Add(label13); tabPage2.Controls.Add(label13);
tabPage2.Controls.Add(switch7); tabPage2.Controls.Add(sthOKDetect);
tabPage2.Controls.Add(label14); tabPage2.Controls.Add(label14);
tabPage2.Controls.Add(switch4); tabPage2.Controls.Add(sthNGOriginal);
tabPage2.Controls.Add(label6); tabPage2.Controls.Add(label6);
tabPage2.Controls.Add(switch5); tabPage2.Controls.Add(sthOKOriginal);
tabPage2.Controls.Add(label12); tabPage2.Controls.Add(label12);
tabPage2.Controls.Add(input1); tabPage2.Controls.Add(iptConfidence);
tabPage2.Controls.Add(label5); tabPage2.Controls.Add(label5);
tabPage2.Controls.Add(flowPanel1); tabPage2.Controls.Add(flowCameraPanel);
tabPage2.Controls.Add(label11); tabPage2.Controls.Add(label11);
tabPage2.Controls.Add(switch3); tabPage2.Controls.Add(sthStation);
tabPage2.Controls.Add(label10); tabPage2.Controls.Add(label10);
tabPage2.Controls.Add(stDetectType); tabPage2.Controls.Add(stDetectType);
tabPage2.Controls.Add(label9); tabPage2.Controls.Add(label9);
tabPage2.Controls.Add(btnCorrelatedCamera); tabPage2.Controls.Add(btnCorrelatedCamera);
tabPage2.Controls.Add(btnPath2); tabPage2.Controls.Add(btnPath2);
tabPage2.Controls.Add(switch2); tabPage2.Controls.Add(sthDetectStatus);
tabPage2.Controls.Add(label7); tabPage2.Controls.Add(label7);
tabPage2.Controls.Add(iptPath2); tabPage2.Controls.Add(iptDetectPath);
tabPage2.Controls.Add(label8); tabPage2.Controls.Add(label8);
tabPage2.Location = new Point(-909, -575); tabPage2.Location = new Point(-909, -575);
tabPage2.Name = "tabPage2"; tabPage2.Name = "tabPage2";
tabPage2.Size = new Size(909, 575); tabPage2.Size = new Size(909, 575);
tabPage2.TabIndex = 1; tabPage2.TabIndex = 1;
tabPage2.Text = "模型检测"; tabPage2.Text = "模型检测";
tabPage2.Click += tabPage2_Click;
// //
// btnLableDelete // btnLableDelete
// //
@ -320,7 +319,8 @@
// //
// lableTable // lableTable
// //
lableTable.BackColor = SystemColors.ControlLight; lableTable.BackColor = SystemColors.Window;
lableTable.EmptyHeader = true;
lableTable.Location = new Point(110, 252); lableTable.Location = new Point(110, 252);
lableTable.Name = "lableTable"; lableTable.Name = "lableTable";
lableTable.Size = new Size(656, 288); lableTable.Size = new Size(656, 288);
@ -348,14 +348,14 @@
btnPic.TabIndex = 44; btnPic.TabIndex = 44;
btnPic.Text = "查看图片"; btnPic.Text = "查看图片";
// //
// switch6 // sthDetectNG
// //
switch6.CheckedText = "启用"; sthDetectNG.CheckedText = "启用";
switch6.Location = new Point(607, 194); sthDetectNG.Location = new Point(607, 194);
switch6.Name = "switch6"; sthDetectNG.Name = "sthDetectNG";
switch6.Size = new Size(82, 33); sthDetectNG.Size = new Size(82, 33);
switch6.TabIndex = 43; sthDetectNG.TabIndex = 43;
switch6.UnCheckedText = "关闭"; sthDetectNG.UnCheckedText = "关闭";
// //
// label13 // label13
// //
@ -365,14 +365,14 @@
label13.TabIndex = 42; label13.TabIndex = 42;
label13.Text = "NG检测图"; label13.Text = "NG检测图";
// //
// switch7 // sthOKDetect
// //
switch7.CheckedText = "启用"; sthOKDetect.CheckedText = "启用";
switch7.Location = new Point(438, 194); sthOKDetect.Location = new Point(438, 194);
switch7.Name = "switch7"; sthOKDetect.Name = "sthOKDetect";
switch7.Size = new Size(82, 33); sthOKDetect.Size = new Size(82, 33);
switch7.TabIndex = 41; sthOKDetect.TabIndex = 41;
switch7.UnCheckedText = "关闭"; sthOKDetect.UnCheckedText = "关闭";
// //
// label14 // label14
// //
@ -382,14 +382,14 @@
label14.TabIndex = 40; label14.TabIndex = 40;
label14.Text = "OK检测图"; label14.Text = "OK检测图";
// //
// switch4 // sthNGOriginal
// //
switch4.CheckedText = "启用"; sthNGOriginal.CheckedText = "启用";
switch4.Location = new Point(270, 194); sthNGOriginal.Location = new Point(270, 194);
switch4.Name = "switch4"; sthNGOriginal.Name = "sthNGOriginal";
switch4.Size = new Size(82, 33); sthNGOriginal.Size = new Size(82, 33);
switch4.TabIndex = 39; sthNGOriginal.TabIndex = 39;
switch4.UnCheckedText = "关闭"; sthNGOriginal.UnCheckedText = "关闭";
// //
// label6 // label6
// //
@ -399,14 +399,14 @@
label6.TabIndex = 38; label6.TabIndex = 38;
label6.Text = "NG原图"; label6.Text = "NG原图";
// //
// switch5 // sthOKOriginal
// //
switch5.CheckedText = "启用"; sthOKOriginal.CheckedText = "启用";
switch5.Location = new Point(110, 194); sthOKOriginal.Location = new Point(110, 194);
switch5.Name = "switch5"; sthOKOriginal.Name = "sthOKOriginal";
switch5.Size = new Size(82, 33); sthOKOriginal.Size = new Size(82, 33);
switch5.TabIndex = 37; sthOKOriginal.TabIndex = 37;
switch5.UnCheckedText = "关闭"; sthOKOriginal.UnCheckedText = "关闭";
// //
// label12 // label12
// //
@ -416,14 +416,14 @@
label12.TabIndex = 36; label12.TabIndex = 36;
label12.Text = "OK原图"; label12.Text = "OK原图";
// //
// input1 // iptConfidence
// //
input1.Location = new Point(649, 24); iptConfidence.Location = new Point(649, 24);
input1.Name = "input1"; iptConfidence.Name = "iptConfidence";
input1.PlaceholderText = ""; iptConfidence.PlaceholderText = "";
input1.ReadOnly = true; iptConfidence.ReadOnly = true;
input1.Size = new Size(117, 42); iptConfidence.Size = new Size(117, 42);
input1.TabIndex = 35; iptConfidence.TabIndex = 35;
// //
// label5 // label5
// //
@ -433,15 +433,15 @@
label5.TabIndex = 34; label5.TabIndex = 34;
label5.Text = "置信度"; label5.Text = "置信度";
// //
// flowPanel1 // flowCameraPanel
// //
flowPanel1.AutoScroll = true; flowCameraPanel.AutoScroll = true;
flowPanel1.BackColor = SystemColors.ControlLight; flowCameraPanel.BackColor = SystemColors.Window;
flowPanel1.Location = new Point(110, 136); flowCameraPanel.Location = new Point(110, 136);
flowPanel1.Name = "flowPanel1"; flowCameraPanel.Name = "flowCameraPanel";
flowPanel1.Size = new Size(656, 49); flowCameraPanel.Size = new Size(656, 49);
flowPanel1.TabIndex = 33; flowCameraPanel.TabIndex = 33;
flowPanel1.Text = "flowPanel1"; flowCameraPanel.Text = "flowPanel1";
// //
// label11 // label11
// //
@ -451,14 +451,14 @@
label11.TabIndex = 32; label11.TabIndex = 32;
label11.Text = "关联相机"; label11.Text = "关联相机";
// //
// switch3 // sthStation
// //
switch3.CheckedText = "启用"; sthStation.CheckedText = "启用";
switch3.Location = new Point(270, 26); sthStation.Location = new Point(270, 26);
switch3.Name = "switch3"; sthStation.Name = "sthStation";
switch3.Size = new Size(82, 33); sthStation.Size = new Size(82, 33);
switch3.TabIndex = 31; sthStation.TabIndex = 31;
switch3.UnCheckedText = "关闭"; sthStation.UnCheckedText = "关闭";
// //
// label10 // label10
// //
@ -512,14 +512,14 @@
btnPath2.TabIndex = 20; btnPath2.TabIndex = 20;
btnPath2.Text = "打开"; btnPath2.Text = "打开";
// //
// switch2 // sthDetectStatus
// //
switch2.CheckedText = "启用"; sthDetectStatus.CheckedText = "启用";
switch2.Location = new Point(110, 26); sthDetectStatus.Location = new Point(110, 26);
switch2.Name = "switch2"; sthDetectStatus.Name = "sthDetectStatus";
switch2.Size = new Size(82, 33); sthDetectStatus.Size = new Size(82, 33);
switch2.TabIndex = 19; sthDetectStatus.TabIndex = 19;
switch2.UnCheckedText = "关闭"; sthDetectStatus.UnCheckedText = "关闭";
// //
// label7 // label7
// //
@ -529,14 +529,14 @@
label7.TabIndex = 18; label7.TabIndex = 18;
label7.Text = "状 态"; label7.Text = "状 态";
// //
// iptPath2 // iptDetectPath
// //
iptPath2.Location = new Point(110, 75); iptDetectPath.Location = new Point(110, 75);
iptPath2.Name = "iptPath2"; iptDetectPath.Name = "iptDetectPath";
iptPath2.PlaceholderText = "请点击打开按钮选择模型路径"; iptDetectPath.PlaceholderText = "请点击打开按钮选择模型路径";
iptPath2.ReadOnly = true; iptDetectPath.ReadOnly = true;
iptPath2.Size = new Size(656, 42); iptDetectPath.Size = new Size(656, 42);
iptPath2.TabIndex = 17; iptDetectPath.TabIndex = 17;
// //
// label8 // label8
// //
@ -549,7 +549,7 @@
// tabPage3 // tabPage3
// //
tabPage3.Controls.Add(tabPage4); tabPage3.Controls.Add(tabPage4);
tabPage3.Location = new Point(3, 31); tabPage3.Location = new Point(-909, -575);
tabPage3.Name = "tabPage3"; tabPage3.Name = "tabPage3";
tabPage3.Size = new Size(909, 575); tabPage3.Size = new Size(909, 575);
tabPage3.TabIndex = 3; tabPage3.TabIndex = 3;
@ -557,27 +557,15 @@
// //
// tabPage4 // tabPage4
// //
tabPage4.Controls.Add(switch8);
tabPage4.Controls.Add(btnSizeDel); tabPage4.Controls.Add(btnSizeDel);
tabPage4.Controls.Add(btnSizeAdd); tabPage4.Controls.Add(btnSizeAdd);
tabPage4.Controls.Add(SizeTable); tabPage4.Controls.Add(SizeTable);
tabPage4.Controls.Add(label17);
tabPage4.Controls.Add(label18);
tabPage4.Location = new Point(8, 8); tabPage4.Location = new Point(8, 8);
tabPage4.Name = "tabPage4"; tabPage4.Name = "tabPage4";
tabPage4.Size = new Size(909, 575); tabPage4.Size = new Size(909, 575);
tabPage4.TabIndex = 1; tabPage4.TabIndex = 1;
tabPage4.Text = "预处理"; 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
// //
btnSizeDel.BorderWidth = 2F; btnSizeDel.BorderWidth = 2F;
@ -585,7 +573,7 @@
btnSizeDel.Ghost = true; btnSizeDel.Ghost = true;
btnSizeDel.IconRatio = 0.8F; btnSizeDel.IconRatio = 0.8F;
btnSizeDel.IconSvg = resources.GetString("btnSizeDel.IconSvg"); btnSizeDel.IconSvg = resources.GetString("btnSizeDel.IconSvg");
btnSizeDel.Location = new Point(747, 192); btnSizeDel.Location = new Point(745, 147);
btnSizeDel.Name = "btnSizeDel"; btnSizeDel.Name = "btnSizeDel";
btnSizeDel.Size = new Size(80, 38); btnSizeDel.Size = new Size(80, 38);
btnSizeDel.TabIndex = 10; btnSizeDel.TabIndex = 10;
@ -598,7 +586,7 @@
btnSizeAdd.Ghost = true; btnSizeAdd.Ghost = true;
btnSizeAdd.IconRatio = 0.8F; btnSizeAdd.IconRatio = 0.8F;
btnSizeAdd.IconSvg = resources.GetString("btnSizeAdd.IconSvg"); btnSizeAdd.IconSvg = resources.GetString("btnSizeAdd.IconSvg");
btnSizeAdd.Location = new Point(747, 148); btnSizeAdd.Location = new Point(745, 103);
btnSizeAdd.Name = "btnSizeAdd"; btnSizeAdd.Name = "btnSizeAdd";
btnSizeAdd.Size = new Size(80, 38); btnSizeAdd.Size = new Size(80, 38);
btnSizeAdd.TabIndex = 9; btnSizeAdd.TabIndex = 9;
@ -606,28 +594,13 @@
// //
// SizeTable // SizeTable
// //
SizeTable.Location = new Point(38, 118); SizeTable.EmptyHeader = true;
SizeTable.Location = new Point(20, 52);
SizeTable.Name = "SizeTable"; SizeTable.Name = "SizeTable";
SizeTable.Size = new Size(686, 402); SizeTable.Size = new Size(706, 402);
SizeTable.TabIndex = 8; SizeTable.TabIndex = 8;
SizeTable.Text = "table1"; SizeTable.Text = "table1";
// //
// label17
//
label17.Location = new Point(38, 89);
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 // DetectControl
// //
AutoScaleDimensions = new SizeF(7F, 17F); AutoScaleDimensions = new SizeF(7F, 17F);
@ -650,10 +623,10 @@
private AntdUI.TabPage tabPage2; private AntdUI.TabPage tabPage2;
private AntdUI.TabPage tabPage3; private AntdUI.TabPage tabPage3;
private AntdUI.Label label1; private AntdUI.Label label1;
private AntdUI.Input iptPath; private AntdUI.Input iptPrePath;
private AntdUI.Label label2; private AntdUI.Label label2;
private AntdUI.Switch switch1; private AntdUI.Switch sthPreStatus;
private AntdUI.Button btnPath; private AntdUI.Button btnPrePath;
private AntdUI.Label label3; private AntdUI.Label label3;
private AntdUI.Button btnPreDelete; private AntdUI.Button btnPreDelete;
private AntdUI.Button btnPreAdd; private AntdUI.Button btnPreAdd;
@ -664,25 +637,25 @@
private AntdUI.Table PreOutTable; private AntdUI.Table PreOutTable;
private AntdUI.Button btnCorrelatedCamera; private AntdUI.Button btnCorrelatedCamera;
private AntdUI.Button btnPath2; private AntdUI.Button btnPath2;
private AntdUI.Switch switch2; private AntdUI.Switch sthDetectStatus;
private AntdUI.Label label7; private AntdUI.Label label7;
private AntdUI.Input iptPath2; private AntdUI.Input iptDetectPath;
private AntdUI.Label label8; private AntdUI.Label label8;
private AntdUI.Select stDetectType; private AntdUI.Select stDetectType;
private AntdUI.Label label9; private AntdUI.Label label9;
private AntdUI.Switch switch3; private AntdUI.Switch sthStation;
private AntdUI.Label label10; private AntdUI.Label label10;
private AntdUI.Label label11; private AntdUI.Label label11;
private AntdUI.FlowPanel flowPanel1; private AntdUI.FlowPanel flowCameraPanel;
private AntdUI.Label label5; private AntdUI.Label label5;
private AntdUI.Input input1; private AntdUI.Input iptConfidence;
private AntdUI.Switch switch4; private AntdUI.Switch sthNGOriginal;
private AntdUI.Label label6; private AntdUI.Label label6;
private AntdUI.Switch switch5; private AntdUI.Switch sthOKOriginal;
private AntdUI.Label label12; private AntdUI.Label label12;
private AntdUI.Switch switch6; private AntdUI.Switch sthDetectNG;
private AntdUI.Label label13; private AntdUI.Label label13;
private AntdUI.Switch switch7; private AntdUI.Switch sthOKDetect;
private AntdUI.Label label14; private AntdUI.Label label14;
private AntdUI.Button btnPic; private AntdUI.Button btnPic;
private AntdUI.Label label15; private AntdUI.Label label15;
@ -693,8 +666,5 @@
private AntdUI.Button btnSizeDel; private AntdUI.Button btnSizeDel;
private AntdUI.Button btnSizeAdd; private AntdUI.Button btnSizeAdd;
private AntdUI.Table SizeTable; private AntdUI.Table SizeTable;
private AntdUI.Label label17;
private AntdUI.Label label18;
private AntdUI.Switch switch8;
} }
} }

View File

@ -1,19 +1,12 @@
using System; using System.ComponentModel;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data; using System.Data;
using System.Drawing;
using System.Linq;
using System.Reflection; using System.Reflection;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
using System.Xml.Linq;
using AntdUI; using AntdUI;
using DH.Commons.Base;
using DH.Commons.Enums; using DH.Commons.Enums;
using DH.Devices.Vision; using DH.Devices.PLC;
using XKRS.CanFly; using XKRS.CanFly;
using static AntdUI.Table; using static System.Windows.Forms.AxHost;
using static DH.Commons.Enums.EnumHelper; using static DH.Commons.Enums.EnumHelper;
namespace DHSoftware.Views namespace DHSoftware.Views
@ -21,9 +14,11 @@ namespace DHSoftware.Views
public partial class DetectControl : UserControl public partial class DetectControl : UserControl
{ {
Window window; Window window;
public DetectControl(Window _window) DetectionConfig detectionConfig;
public DetectControl(Window _window,DetectionConfig _detection)
{ {
window = _window; window = _window;
detectionConfig = _detection;
InitializeComponent(); InitializeComponent();
//初始化表格列头 //初始化表格列头
InitTableColumns(); InitTableColumns();
@ -34,7 +29,7 @@ namespace DHSoftware.Views
private void BindEventHandler() private void BindEventHandler()
{ {
//预处理 //预处理
btnPath.Click += btnPath_Click; btnPrePath.Click += btnPath_Click;
btnPreAdd.Click += BtnPreAdd_Click; ; btnPreAdd.Click += BtnPreAdd_Click; ;
btnPreDelete.Click += BtnPreDelete_Click; ; btnPreDelete.Click += BtnPreDelete_Click; ;
preTable.CellClick += PreTable_CellClick; ; preTable.CellClick += PreTable_CellClick; ;
@ -63,12 +58,11 @@ namespace DHSoftware.Views
if (e.Record is DetectionLable DetectionLable) if (e.Record is DetectionLable DetectionLable)
{ {
curDetectionLable = DetectionLable;
switch (buttontext) switch (buttontext)
{ {
//暂不支持进入整行编辑,只支持指定单元格编辑,推荐使用弹窗或抽屉编辑整行数据 //暂不支持进入整行编辑,只支持指定单元格编辑,推荐使用弹窗或抽屉编辑整行数据
case "编辑": case "编辑":
var form = new DetectionLableEdit(window, curDetectionLable) { Size = new Size(500, 300) }; var form = new DetectionLableEdit(window, DetectionLable) { Size = new Size(500, 300) };
AntdUI.Drawer.open(new AntdUI.Drawer.Config(window, form) AntdUI.Drawer.open(new AntdUI.Drawer.Config(window, form)
{ {
OnLoad = () => OnLoad = () =>
@ -84,7 +78,7 @@ namespace DHSoftware.Views
case "删除": case "删除":
var result = Modal.open(window, "删除警告!", "确认要删除选择的数据吗?", TType.Warn); var result = Modal.open(window, "删除警告!", "确认要删除选择的数据吗?", TType.Warn);
if (result == DialogResult.OK) if (result == DialogResult.OK)
DetectionLableList.Remove(DetectionLable); detectionConfig.DetectionLableList.Remove(DetectionLable);
break; break;
} }
@ -98,12 +92,11 @@ namespace DHSoftware.Views
if (e.Record is SizeTreatParam sizeTreat) if (e.Record is SizeTreatParam sizeTreat)
{ {
SizeParamLable = sizeTreat;
switch (buttontext) switch (buttontext)
{ {
//暂不支持进入整行编辑,只支持指定单元格编辑,推荐使用弹窗或抽屉编辑整行数据 //暂不支持进入整行编辑,只支持指定单元格编辑,推荐使用弹窗或抽屉编辑整行数据
case "编辑": case "编辑":
var form = new SizeLabelEdit(window, SizeParamLable) { Size = new Size(500, 300) }; var form = new SizeLabelEdit(window, sizeTreat) { Size = new Size(500, 300) };
AntdUI.Drawer.open(new AntdUI.Drawer.Config(window, form) AntdUI.Drawer.open(new AntdUI.Drawer.Config(window, form)
{ {
OnLoad = () => OnLoad = () =>
@ -119,10 +112,10 @@ namespace DHSoftware.Views
case "删除": case "删除":
var result = Modal.open(window, "删除警告!", "确认要删除选择的数据吗?", TType.Warn); var result = Modal.open(window, "删除警告!", "确认要删除选择的数据吗?", TType.Warn);
if (result == DialogResult.OK) if (result == DialogResult.OK)
SizeLableList.Remove(sizeTreat); detectionConfig.SizeTreatParamList.Remove(sizeTreat);
break; break;
case "进行测量": case "进行测量":
var sizeType = ((int)SizeParamLable.PreType).ToString(); var sizeType = ((int)sizeTreat.PreType).ToString();
// 根据测量类型打开不同的窗口 // 根据测量类型打开不同的窗口
switch (sizeType) switch (sizeType)
@ -162,7 +155,7 @@ namespace DHSoftware.Views
private void BtnLableDelete_Click(object? sender, EventArgs e) private void BtnLableDelete_Click(object? sender, EventArgs e)
{ {
if (DetectionLableList.Count == 0 || !DetectionLableList.Any(x => x.Selected)) if (detectionConfig.DetectionLableList.Count == 0 || !detectionConfig.DetectionLableList.Any(x => x.Selected))
{ {
AntdUI.Message.warn(window, "请选择要删除的行!", autoClose: 3); AntdUI.Message.warn(window, "请选择要删除的行!", autoClose: 3);
return; return;
@ -172,12 +165,12 @@ namespace DHSoftware.Views
if (result == DialogResult.OK) if (result == DialogResult.OK)
{ {
// 使用反转for循环删除主列表中选中的项 // 使用反转for循环删除主列表中选中的项
for (int i = DetectionLableList.Count - 1; i >= 0; i--) for (int i = detectionConfig.DetectionLableList.Count - 1; i >= 0; i--)
{ {
// 删除选中的主列表项 // 删除选中的主列表项
if (DetectionLableList[i].Selected) if (detectionConfig.DetectionLableList[i].Selected)
{ {
DetectionLableList.RemoveAt(i); detectionConfig.DetectionLableList.RemoveAt(i);
} }
} }
// 提示删除完成 // 提示删除完成
@ -201,13 +194,13 @@ namespace DHSoftware.Views
}); });
if (form.submit) if (form.submit)
{ {
DetectionLableList.Add(detectionLable); detectionConfig.DetectionLableList.Add(detectionLable);
} }
} }
private void BtnSizeDelete_Click(object? sender, EventArgs e) private void BtnSizeDelete_Click(object? sender, EventArgs e)
{ {
if (SizeLableList.Count == 0 || !SizeLableList.Any(x => x.Selected)) if (detectionConfig.SizeTreatParamList.Count == 0 || !detectionConfig.SizeTreatParamList.Any(x => x.Selected))
{ {
AntdUI.Message.warn(window, "请选择要删除的行!", autoClose: 3); AntdUI.Message.warn(window, "请选择要删除的行!", autoClose: 3);
return; return;
@ -217,12 +210,12 @@ namespace DHSoftware.Views
if (result == DialogResult.OK) if (result == DialogResult.OK)
{ {
// 使用反转for循环删除主列表中选中的项 // 使用反转for循环删除主列表中选中的项
for (int i = SizeLableList.Count - 1; i >= 0; i--) for (int i = detectionConfig.SizeTreatParamList.Count - 1; i >= 0; i--)
{ {
// 删除选中的主列表项 // 删除选中的主列表项
if (SizeLableList[i].Selected) if (detectionConfig.SizeTreatParamList[i].Selected)
{ {
SizeLableList.RemoveAt(i); detectionConfig.SizeTreatParamList.RemoveAt(i);
} }
} }
// 提示删除完成 // 提示删除完成
@ -251,7 +244,7 @@ namespace DHSoftware.Views
}); });
if (form.submit) if (form.submit)
{ {
SizeLableList.Add(SizeParamLable); detectionConfig.SizeTreatParamList.Add(SizeParamLable);
} }
} }
@ -260,23 +253,20 @@ namespace DHSoftware.Views
} }
List<RelatedCamera> relatedCameras = new List<RelatedCamera>();
private void BtnCorrelatedCamera_Click(object? sender, EventArgs e) private void BtnCorrelatedCamera_Click(object? sender, EventArgs e)
{ {
var form = new CorrelatedCameraEdit(window, detectionConfig.CameraCollects) { Size = new Size(500, 400) };
var form = new CorrelatedCameraEdit(window, relatedCameras) { Size = new Size(500, 400) };
AntdUI.Modal.open(new AntdUI.Modal.Config(window, "", form, TType.None) AntdUI.Modal.open(new AntdUI.Modal.Config(window, "", form, TType.None)
{ {
BtnHeight = 0, BtnHeight = 0,
}); });
if (form.submit) if (form.submit)
{ {
flowPanel1.Controls.Clear(); flowCameraPanel.Controls.Clear();
if (relatedCameras.Count > 0) if (detectionConfig.CameraCollects.Count > 0)
{ {
foreach (var item in relatedCameras) foreach (var item in detectionConfig.CameraCollects)
{ {
var control = new AntdUI.Tag() var control = new AntdUI.Tag()
{ {
@ -288,11 +278,11 @@ namespace DHSoftware.Views
control.CloseChanged += (sender, e) => control.CloseChanged += (sender, e) =>
{ {
var tag = sender as Tag; var tag = sender as Tag;
foreach (var item in relatedCameras) foreach (var item in detectionConfig.CameraCollects)
{ {
if (item.CameraSourceId.Equals(tag.Text)) if (item.CameraSourceId.Equals(tag.Text))
{ {
relatedCameras.Remove(item); detectionConfig.CameraCollects.Remove(item);
break; break;
} }
} }
@ -301,7 +291,7 @@ namespace DHSoftware.Views
}; };
// 通过主窗口设置DPI控制添加控件保持缩放比例 // 通过主窗口设置DPI控制添加控件保持缩放比例
window.AutoDpi(control); window.AutoDpi(control);
flowPanel1.Controls.Add(control); flowCameraPanel.Controls.Add(control);
control.BringToFront(); control.BringToFront();
} }
} }
@ -329,7 +319,7 @@ namespace DHSoftware.Views
{ {
string filePath = openFileDialog.FileName; string filePath = openFileDialog.FileName;
iptPath2.Text = filePath; iptDetectPath.Text = filePath;
} }
} }
@ -341,12 +331,11 @@ namespace DHSoftware.Views
if (e.Record is PreTreatParam PreTreat) if (e.Record is PreTreatParam PreTreat)
{ {
curPreOutTreat = PreTreat;
switch (buttontext) switch (buttontext)
{ {
//暂不支持进入整行编辑,只支持指定单元格编辑,推荐使用弹窗或抽屉编辑整行数据 //暂不支持进入整行编辑,只支持指定单元格编辑,推荐使用弹窗或抽屉编辑整行数据
case "编辑": case "编辑":
var form = new PreTreatEdit(window, curPreOutTreat) { Size = new Size(500, 300) }; var form = new PreTreatEdit(window, PreTreat) { Size = new Size(500, 300) };
AntdUI.Drawer.open(new AntdUI.Drawer.Config(window, form) AntdUI.Drawer.open(new AntdUI.Drawer.Config(window, form)
{ {
OnLoad = () => OnLoad = () =>
@ -362,7 +351,7 @@ namespace DHSoftware.Views
case "删除": case "删除":
var result = Modal.open(window, "删除警告!", "确认要删除选择的数据吗?", TType.Warn); var result = Modal.open(window, "删除警告!", "确认要删除选择的数据吗?", TType.Warn);
if (result == DialogResult.OK) if (result == DialogResult.OK)
PreOutTreatList.Remove(PreTreat); detectionConfig.OUTPreTreatParams.Remove(PreTreat);
break; break;
} }
@ -371,7 +360,7 @@ namespace DHSoftware.Views
private void BtnOutDelete_Click(object? sender, EventArgs e) private void BtnOutDelete_Click(object? sender, EventArgs e)
{ {
if (PreOutTreatList.Count == 0 || !PreOutTreatList.Any(x => x.Selected)) if (detectionConfig.OUTPreTreatParams.Count == 0 || !detectionConfig.OUTPreTreatParams.Any(x => x.Selected))
{ {
AntdUI.Message.warn(window, "请选择要删除的行!", autoClose: 3); AntdUI.Message.warn(window, "请选择要删除的行!", autoClose: 3);
return; return;
@ -381,12 +370,12 @@ namespace DHSoftware.Views
if (result == DialogResult.OK) if (result == DialogResult.OK)
{ {
// 使用反转for循环删除主列表中选中的项 // 使用反转for循环删除主列表中选中的项
for (int i = PreOutTreatList.Count - 1; i >= 0; i--) for (int i = detectionConfig.OUTPreTreatParams.Count - 1; i >= 0; i--)
{ {
// 删除选中的主列表项 // 删除选中的主列表项
if (PreOutTreatList[i].Selected) if (detectionConfig.OUTPreTreatParams[i].Selected)
{ {
PreOutTreatList.RemoveAt(i); detectionConfig.OUTPreTreatParams.RemoveAt(i);
} }
} }
// 提示删除完成 // 提示删除完成
@ -411,7 +400,7 @@ namespace DHSoftware.Views
}); });
if (form.submit) if (form.submit)
{ {
PreOutTreatList.Add(preParam); detectionConfig.OUTPreTreatParams.Add(preParam);
} }
} }
@ -421,12 +410,11 @@ namespace DHSoftware.Views
if (e.Record is PreTreatParam PreTreat) if (e.Record is PreTreatParam PreTreat)
{ {
curPreTreat = PreTreat;
switch (buttontext) switch (buttontext)
{ {
//暂不支持进入整行编辑,只支持指定单元格编辑,推荐使用弹窗或抽屉编辑整行数据 //暂不支持进入整行编辑,只支持指定单元格编辑,推荐使用弹窗或抽屉编辑整行数据
case "编辑": case "编辑":
var form = new PreTreatEdit(window, curPreTreat) { Size = new Size(500, 300) }; var form = new PreTreatEdit(window, PreTreat) { Size = new Size(500, 300) };
AntdUI.Drawer.open(new AntdUI.Drawer.Config(window, form) AntdUI.Drawer.open(new AntdUI.Drawer.Config(window, form)
{ {
OnLoad = () => OnLoad = () =>
@ -442,7 +430,7 @@ namespace DHSoftware.Views
case "删除": case "删除":
var result = Modal.open(window, "删除警告!", "确认要删除选择的数据吗?", TType.Warn); var result = Modal.open(window, "删除警告!", "确认要删除选择的数据吗?", TType.Warn);
if (result == DialogResult.OK) if (result == DialogResult.OK)
PreTreatList.Remove(PreTreat); detectionConfig.PreTreatParams.Remove(PreTreat);
break; break;
} }
@ -457,7 +445,7 @@ namespace DHSoftware.Views
private void BtnPreDelete_Click(object? sender, EventArgs e) private void BtnPreDelete_Click(object? sender, EventArgs e)
{ {
if (PreTreatList.Count == 0 || !PreTreatList.Any(x => x.Selected)) if (detectionConfig.PreTreatParams.Count == 0 || !detectionConfig.PreTreatParams.Any(x => x.Selected))
{ {
AntdUI.Message.warn(window, "请选择要删除的行!", autoClose: 3); AntdUI.Message.warn(window, "请选择要删除的行!", autoClose: 3);
return; return;
@ -467,12 +455,12 @@ namespace DHSoftware.Views
if (result == DialogResult.OK) if (result == DialogResult.OK)
{ {
// 使用反转for循环删除主列表中选中的项 // 使用反转for循环删除主列表中选中的项
for (int i = PreTreatList.Count - 1; i >= 0; i--) for (int i = detectionConfig.PreTreatParams.Count - 1; i >= 0; i--)
{ {
// 删除选中的主列表项 // 删除选中的主列表项
if (PreTreatList[i].Selected) if (detectionConfig.PreTreatParams[i].Selected)
{ {
PreTreatList.RemoveAt(i); detectionConfig.PreTreatParams.RemoveAt(i);
} }
} }
// 提示删除完成 // 提示删除完成
@ -496,41 +484,102 @@ namespace DHSoftware.Views
}); });
if (form.submit) if (form.submit)
{ {
PreTreatList.Add(preParam); detectionConfig.PreTreatParams.Add(preParam);
} }
} }
AntList<PreTreatParam> PreTreatList;
AntList<PreTreatParam> PreOutTreatList;
AntList<DetectionLable> DetectionLableList;
AntList<SizeTreatParam> SizeLableList;
PreTreatParam curPreTreat;
PreTreatParam curPreOutTreat;
DetectionLable curDetectionLable;
SizeTreatParam SizeParamLable;
private void InitData() private void InitData()
{ {
PreTreatList = new AntList<PreTreatParam>(); stDetectType.Items.Clear();
foreach (ModelType value in Enum.GetValues(typeof(ModelType)))
preTable.Binding(PreTreatList);
PreOutTreatList = new AntList<PreTreatParam>();
PreOutTable.Binding(PreOutTreatList);
foreach (var item in MLModelTypes)
{ {
stDetectType.Items.Add(item.Key); stDetectType.Items.Add(value.ToString());
}
preTable.Binding(detectionConfig.PreTreatParams);
PreOutTable.Binding(detectionConfig.OUTPreTreatParams);
lableTable.Binding(detectionConfig.DetectionLableList);
SizeTable.Binding(detectionConfig.SizeTreatParamList);
if (detectionConfig.PreTreatParams.Count > 0)
{
foreach (var item in detectionConfig.PreTreatParams)
{
item.CellLinks = new CellLink[] {
new CellButton(Guid.NewGuid().ToString(), "编辑", TTypeMini.Primary) ,
new CellButton(Guid.NewGuid().ToString(), "删除", TTypeMini.Error)
};
}
} }
if (detectionConfig.OUTPreTreatParams.Count > 0)
{
foreach (var item in detectionConfig.OUTPreTreatParams)
{
DetectionLableList = new AntList<DetectionLable>(); item.CellLinks = new CellLink[] {
new CellButton(Guid.NewGuid().ToString(), "编辑", TTypeMini.Primary) ,
new CellButton(Guid.NewGuid().ToString(), "删除", TTypeMini.Error)
};
}
}
lableTable.Binding(DetectionLableList); if (detectionConfig.DetectionLableList.Count > 0)
{
foreach (var item in detectionConfig.DetectionLableList)
{
SizeLableList = new AntList<SizeTreatParam>(); item.CellLinks = new CellLink[] {
SizeTable.Binding(SizeLableList); new CellButton(Guid.NewGuid().ToString(), "编辑", TTypeMini.Primary) ,
new CellButton(Guid.NewGuid().ToString(), "删除", TTypeMini.Error)
};
}
}
if (detectionConfig.SizeTreatParamList.Count > 0)
{
foreach (var item in detectionConfig.SizeTreatParamList)
{
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)
};
}
}
if (detectionConfig.CameraCollects.Count > 0)
{
foreach (var item in detectionConfig.CameraCollects)
{
var control = new AntdUI.Tag()
{
Font = new System.Drawing.Font("Microsoft YaHei UI", 9F),
Size = new Size(90, 42),
Text = item.CameraSourceId,
CloseIcon = true
};
window.AutoDpi(control);
flowCameraPanel.Controls.Add(control);
control.BringToFront();
}
}
//1
sthPreStatus.DataBindings.Add("Checked", detectionConfig, "IsPreEnabled", true, DataSourceUpdateMode.OnPropertyChanged);
iptPrePath.DataBindings.Add("Text", detectionConfig, "HalconAlgorithemPath_Pre", true, DataSourceUpdateMode.OnPropertyChanged);
//2
sthDetectStatus.DataBindings.Add("Checked", detectionConfig, "IsEnabled", true, DataSourceUpdateMode.OnPropertyChanged);
sthStation.DataBindings.Add("Checked", detectionConfig, "IsAddStation", true, DataSourceUpdateMode.OnPropertyChanged);
stDetectType.DataBindings.Add("Text", detectionConfig, "ModelType",true, DataSourceUpdateMode.OnPropertyChanged);
iptConfidence.DataBindings.Add("Text", detectionConfig, "ModelconfThreshold", true, DataSourceUpdateMode.OnPropertyChanged);
iptDetectPath.DataBindings.Add("Text", detectionConfig, "ModelPath", true, DataSourceUpdateMode.OnPropertyChanged);
sthOKOriginal.DataBindings.Add("Checked", detectionConfig, "SaveOKOriginal", true, DataSourceUpdateMode.OnPropertyChanged);
sthNGOriginal.DataBindings.Add("Checked", detectionConfig, "SaveNGOriginal", true, DataSourceUpdateMode.OnPropertyChanged);
sthOKDetect.DataBindings.Add("Checked", detectionConfig, "SaveOKDetect", true, DataSourceUpdateMode.OnPropertyChanged);
sthDetectNG.DataBindings.Add("Checked", detectionConfig, "SaveNGDetect", true, DataSourceUpdateMode.OnPropertyChanged);
} }
@ -554,9 +603,9 @@ namespace DHSoftware.Views
lableTable.Columns = new ColumnCollection() { lableTable.Columns = new ColumnCollection() {
new ColumnCheck("Selected"){Fixed = true}, new ColumnCheck("Selected"){Fixed = true},
new Column("LabelName", "名称", ColumnAlign.Center), new Column("LabelName", "名称", ColumnAlign.Center),
new Column("MinSource", "最小得分",ColumnAlign.Center), new Column("MinScore", "最小得分",ColumnAlign.Center),
new Column("MaxArea", "最大得分", ColumnAlign.Center), new Column("MaxScore", "最大得分", ColumnAlign.Center),
new Column("MinSource", "最小面积",ColumnAlign.Center), new Column("MinArea", "最小面积",ColumnAlign.Center),
new Column("MaxArea", "最大面积", ColumnAlign.Center), new Column("MaxArea", "最大面积", ColumnAlign.Center),
new Column("ResultState", "结果", ColumnAlign.Center), new Column("ResultState", "结果", ColumnAlign.Center),
new Column("CellLinks", "操作", ColumnAlign.Center) new Column("CellLinks", "操作", ColumnAlign.Center)
@ -590,7 +639,7 @@ namespace DHSoftware.Views
{ {
string filePath = openFileDialog.FileName; string filePath = openFileDialog.FileName;
iptPath.Text = filePath; iptPrePath.Text = filePath;
} }
} }
@ -600,31 +649,11 @@ namespace DHSoftware.Views
List<KeyValuePair<string, int>> MLModelTypes = GetFilteredEnumDescriptionsAndValues<MLModelType>();
List<KeyValuePair<string, int>> SizeEnum = GetFilteredEnumDescriptionsAndValues<SizeEnum>();
private void tabPage2_Click(object sender, EventArgs e)
{
}
public static List<KeyValuePair<string, int>> GetFilteredEnumDescriptionsAndValues<T>() where T : Enum
{
return Enum.GetValues(typeof(T))
.Cast<T>()
.Select(e =>
{
// 获取枚举的 Description 属性,如果没有,则使用枚举的名称
var description = e.GetType()
.GetField(e.ToString())
?.GetCustomAttribute<DescriptionAttribute>()
?.Description ?? e.ToString();
// 返回枚举的描述和对应的整数值
return new KeyValuePair<string, int>(description, Convert.ToInt32(e));
})
.ToList();
}
} }
} }

View File

@ -129,7 +129,7 @@
<data name="btnPreAdd.IconSvg" xml:space="preserve"> <data name="btnPreAdd.IconSvg" xml:space="preserve">
<value>&lt;svg t="1741939836774" class="icon" viewBox="0 0 1024 1024" version="1.1" xmlns="http://www.w3.org/2000/svg" p-id="21349" width="200" height="200"&gt;&lt;path d="M1003.153333 404.96a52.933333 52.933333 0 0 0-42.38-20.96H896V266.666667a53.393333 53.393333 0 0 0-53.333333-53.333334H461.253333a10.573333 10.573333 0 0 1-7.54-3.126666L344.46 100.953333A52.986667 52.986667 0 0 0 306.746667 85.333333H53.333333a53.393333 53.393333 0 0 0-53.333333 53.333334v704a53.393333 53.393333 0 0 0 53.333333 53.333333h796.893334a53.453333 53.453333 0 0 0 51.453333-39.333333l110.546667-405.333334a52.953333 52.953333 0 0 0-9.073334-46.373333zM53.333333 128h253.413334a10.573333 10.573333 0 0 1 7.54 3.126667l109.253333 109.253333A52.986667 52.986667 0 0 0 461.253333 256H842.666667a10.666667 10.666667 0 0 1 10.666666 10.666667v117.333333H173.773333a53.453333 53.453333 0 0 0-51.453333 39.333333L42.666667 715.366667V138.666667a10.666667 10.666667 0 0 1 10.666666-10.666667zm917.726667 312.14l-110.546667 405.333333a10.666667 10.666667 0 0 1-10.286666 7.86H63.226667a10.666667 10.666667 0 0 1-10.286667-13.473333l110.546667-405.333333A10.666667 10.666667 0 0 1 173.773333 426.666667h787a10.666667 10.666667 0 0 1 10.286667 13.473333z" fill="#5C5C66" p-id="21350"/&gt;&lt;/svg&gt;</value> <value>&lt;svg t="1741939836774" class="icon" viewBox="0 0 1024 1024" version="1.1" xmlns="http://www.w3.org/2000/svg" p-id="21349" width="200" height="200"&gt;&lt;path d="M1003.153333 404.96a52.933333 52.933333 0 0 0-42.38-20.96H896V266.666667a53.393333 53.393333 0 0 0-53.333333-53.333334H461.253333a10.573333 10.573333 0 0 1-7.54-3.126666L344.46 100.953333A52.986667 52.986667 0 0 0 306.746667 85.333333H53.333333a53.393333 53.393333 0 0 0-53.333333 53.333334v704a53.393333 53.393333 0 0 0 53.333333 53.333333h796.893334a53.453333 53.453333 0 0 0 51.453333-39.333333l110.546667-405.333334a52.953333 52.953333 0 0 0-9.073334-46.373333zM53.333333 128h253.413334a10.573333 10.573333 0 0 1 7.54 3.126667l109.253333 109.253333A52.986667 52.986667 0 0 0 461.253333 256H842.666667a10.666667 10.666667 0 0 1 10.666666 10.666667v117.333333H173.773333a53.453333 53.453333 0 0 0-51.453333 39.333333L42.666667 715.366667V138.666667a10.666667 10.666667 0 0 1 10.666666-10.666667zm917.726667 312.14l-110.546667 405.333333a10.666667 10.666667 0 0 1-10.286666 7.86H63.226667a10.666667 10.666667 0 0 1-10.286667-13.473333l110.546667-405.333333A10.666667 10.666667 0 0 1 173.773333 426.666667h787a10.666667 10.666667 0 0 1 10.286667 13.473333z" fill="#5C5C66" p-id="21350"/&gt;&lt;/svg&gt;</value>
</data> </data>
<data name="btnPath.IconSvg" xml:space="preserve"> <data name="btnPrePath.IconSvg" xml:space="preserve">
<value>&lt;svg t="1741939836774" class="icon" viewBox="0 0 1024 1024" version="1.1" xmlns="http://www.w3.org/2000/svg" p-id="21349" width="200" height="200"&gt;&lt;path d="M1003.153333 404.96a52.933333 52.933333 0 0 0-42.38-20.96H896V266.666667a53.393333 53.393333 0 0 0-53.333333-53.333334H461.253333a10.573333 10.573333 0 0 1-7.54-3.126666L344.46 100.953333A52.986667 52.986667 0 0 0 306.746667 85.333333H53.333333a53.393333 53.393333 0 0 0-53.333333 53.333334v704a53.393333 53.393333 0 0 0 53.333333 53.333333h796.893334a53.453333 53.453333 0 0 0 51.453333-39.333333l110.546667-405.333334a52.953333 52.953333 0 0 0-9.073334-46.373333zM53.333333 128h253.413334a10.573333 10.573333 0 0 1 7.54 3.126667l109.253333 109.253333A52.986667 52.986667 0 0 0 461.253333 256H842.666667a10.666667 10.666667 0 0 1 10.666666 10.666667v117.333333H173.773333a53.453333 53.453333 0 0 0-51.453333 39.333333L42.666667 715.366667V138.666667a10.666667 10.666667 0 0 1 10.666666-10.666667zm917.726667 312.14l-110.546667 405.333333a10.666667 10.666667 0 0 1-10.286666 7.86H63.226667a10.666667 10.666667 0 0 1-10.286667-13.473333l110.546667-405.333333A10.666667 10.666667 0 0 1 173.773333 426.666667h787a10.666667 10.666667 0 0 1 10.286667 13.473333z" fill="#5C5C66" p-id="21350"/&gt;&lt;/svg&gt;</value> <value>&lt;svg t="1741939836774" class="icon" viewBox="0 0 1024 1024" version="1.1" xmlns="http://www.w3.org/2000/svg" p-id="21349" width="200" height="200"&gt;&lt;path d="M1003.153333 404.96a52.933333 52.933333 0 0 0-42.38-20.96H896V266.666667a53.393333 53.393333 0 0 0-53.333333-53.333334H461.253333a10.573333 10.573333 0 0 1-7.54-3.126666L344.46 100.953333A52.986667 52.986667 0 0 0 306.746667 85.333333H53.333333a53.393333 53.393333 0 0 0-53.333333 53.333334v704a53.393333 53.393333 0 0 0 53.333333 53.333333h796.893334a53.453333 53.453333 0 0 0 51.453333-39.333333l110.546667-405.333334a52.953333 52.953333 0 0 0-9.073334-46.373333zM53.333333 128h253.413334a10.573333 10.573333 0 0 1 7.54 3.126667l109.253333 109.253333A52.986667 52.986667 0 0 0 461.253333 256H842.666667a10.666667 10.666667 0 0 1 10.666666 10.666667v117.333333H173.773333a53.453333 53.453333 0 0 0-51.453333 39.333333L42.666667 715.366667V138.666667a10.666667 10.666667 0 0 1 10.666666-10.666667zm917.726667 312.14l-110.546667 405.333333a10.666667 10.666667 0 0 1-10.286666 7.86H63.226667a10.666667 10.666667 0 0 1-10.286667-13.473333l110.546667-405.333333A10.666667 10.666667 0 0 1 173.773333 426.666667h787a10.666667 10.666667 0 0 1 10.286667 13.473333z" fill="#5C5C66" p-id="21350"/&gt;&lt;/svg&gt;</value>
</data> </data>
<data name="btnLableDelete.IconSvg" xml:space="preserve"> <data name="btnLableDelete.IconSvg" xml:space="preserve">

View File

@ -3,6 +3,7 @@
using System.ComponentModel; using System.ComponentModel;
using System.Reflection; using System.Reflection;
using AntdUI; using AntdUI;
using DH.Commons.Base;
using DH.Commons.Enums; using DH.Commons.Enums;
using DH.Devices.Vision; using DH.Devices.Vision;
using static System.Windows.Forms.AxHost; using static System.Windows.Forms.AxHost;
@ -48,8 +49,8 @@ namespace DHSoftware.Views
return; return;
} }
detectionLable.LabelName = iptName.Text; detectionLable.LabelName = iptName.Text;
detectionLable.MinSource=Convert.ToDouble(iptMinSource.Text); detectionLable.MinScore=Convert.ToDouble(iptMinSource.Text);
detectionLable.MaxSource = Convert.ToDouble(iptMaxSource.Text); detectionLable.MaxScore = Convert.ToDouble(iptMaxSource.Text);
detectionLable.MinArea = Convert.ToDouble(iptMinArea.Text); detectionLable.MinArea = Convert.ToDouble(iptMinArea.Text);
detectionLable.MaxArea = Convert.ToDouble(iptMaxArea.Text); detectionLable.MaxArea = Convert.ToDouble(iptMaxArea.Text);
ResultState state = EnumHelper.GetEnumFromDescription<ResultState>(sltResultState.Text); ResultState state = EnumHelper.GetEnumFromDescription<ResultState>(sltResultState.Text);
@ -83,8 +84,8 @@ namespace DHSoftware.Views
else else
{ {
iptName.Text = detectionLable.LabelName; iptName.Text = detectionLable.LabelName;
iptMinSource.Text = detectionLable.MinSource.ToString(); iptMinSource.Text = detectionLable.MinScore.ToString();
iptMaxSource.Text = detectionLable.MaxSource.ToString(); iptMaxSource.Text = detectionLable.MaxScore.ToString();
iptMinArea.Text = detectionLable.MinArea.ToString(); iptMinArea.Text = detectionLable.MinArea.ToString();
iptMaxArea.Text = detectionLable.MaxArea.ToString(); iptMaxArea.Text = detectionLable.MaxArea.ToString();
sltResultState.Text= EnumHelper.GetEnumDescription(detectionLable.ResultState); sltResultState.Text= EnumHelper.GetEnumDescription(detectionLable.ResultState);

148
DHSoftware/Views/FrmLog.Designer.cs generated Normal file
View File

@ -0,0 +1,148 @@
namespace DHSoftware.Views
{
partial class FrmLog
{
/// <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()
{
this.components = new System.ComponentModel.Container();
this.contextMenuStrip1 = new System.Windows.Forms.ContextMenuStrip(this.components);
this.tsmiClearLog = new System.Windows.Forms.ToolStripMenuItem();
this.menuStrip1 = new System.Windows.Forms.MenuStrip();
this.tsmiLogLevels = new System.Windows.Forms.ToolStripMenuItem();
this.tsmiLogSources = new System.Windows.Forms.ToolStripMenuItem();
this.tsmiClearLog2 = new System.Windows.Forms.ToolStripMenuItem();
this.lvLog = new System.Windows.Forms.ListView();
this.columnHeader1 = ((System.Windows.Forms.ColumnHeader)(new System.Windows.Forms.ColumnHeader()));
this.columnHeader2 = ((System.Windows.Forms.ColumnHeader)(new System.Windows.Forms.ColumnHeader()));
this.columnHeader3 = ((System.Windows.Forms.ColumnHeader)(new System.Windows.Forms.ColumnHeader()));
this.contextMenuStrip1.SuspendLayout();
this.menuStrip1.SuspendLayout();
this.SuspendLayout();
//
// contextMenuStrip1
//
this.contextMenuStrip1.Items.AddRange(new System.Windows.Forms.ToolStripItem[] {
this.tsmiClearLog});
this.contextMenuStrip1.Name = "contextMenuStrip1";
this.contextMenuStrip1.Size = new System.Drawing.Size(125, 26);
//
// tsmiClearLog
//
this.tsmiClearLog.Name = "tsmiClearLog";
this.tsmiClearLog.Size = new System.Drawing.Size(124, 22);
this.tsmiClearLog.Text = "清空日志";
this.tsmiClearLog.Click += new System.EventHandler(this.tsmiClearLog_Click);
//
// menuStrip1
//
this.menuStrip1.BackColor = System.Drawing.Color.Transparent;
this.menuStrip1.Items.AddRange(new System.Windows.Forms.ToolStripItem[] {
this.tsmiLogLevels,
this.tsmiLogSources,
this.tsmiClearLog2});
this.menuStrip1.Location = new System.Drawing.Point(0, 0);
this.menuStrip1.Name = "menuStrip1";
this.menuStrip1.Size = new System.Drawing.Size(800, 25);
this.menuStrip1.TabIndex = 3;
this.menuStrip1.Text = "menuStrip1";
//
// tsmiLogLevels
//
this.tsmiLogLevels.Name = "tsmiLogLevels";
this.tsmiLogLevels.Size = new System.Drawing.Size(68, 21);
this.tsmiLogLevels.Text = "日志级别";
//
// tsmiLogSources
//
this.tsmiLogSources.Name = "tsmiLogSources";
this.tsmiLogSources.Size = new System.Drawing.Size(68, 21);
this.tsmiLogSources.Text = "日志来源";
//
// tsmiClearLog2
//
this.tsmiClearLog2.Name = "tsmiClearLog2";
this.tsmiClearLog2.Size = new System.Drawing.Size(68, 21);
this.tsmiClearLog2.Text = "清空日志";
this.tsmiClearLog2.Click += new System.EventHandler(this.tsmiClearLog2_Click);
//
// lvLog
//
this.lvLog.BackColor = System.Drawing.SystemColors.Control;
this.lvLog.BorderStyle = System.Windows.Forms.BorderStyle.None;
this.lvLog.Columns.AddRange(new System.Windows.Forms.ColumnHeader[] {
this.columnHeader1,
this.columnHeader2,
this.columnHeader3});
this.lvLog.ContextMenuStrip = this.contextMenuStrip1;
this.lvLog.Dock = System.Windows.Forms.DockStyle.Fill;
this.lvLog.FullRowSelect = true;
this.lvLog.HeaderStyle = System.Windows.Forms.ColumnHeaderStyle.None;
this.lvLog.HideSelection = false;
this.lvLog.Location = new System.Drawing.Point(0, 25);
this.lvLog.MultiSelect = false;
this.lvLog.Name = "lvLog";
this.lvLog.Size = new System.Drawing.Size(800, 463);
this.lvLog.TabIndex = 5;
this.lvLog.UseCompatibleStateImageBehavior = false;
this.lvLog.View = System.Windows.Forms.View.Details;
this.lvLog.SizeChanged += new System.EventHandler(this.lvLog_SizeChanged);
//
// columnHeader1
//
this.columnHeader1.Width = 80;
//
// FrmLog
//
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Inherit;
this.ClientSize = new System.Drawing.Size(800, 488);
this.Controls.Add(this.lvLog);
this.Controls.Add(this.menuStrip1);
//this.MainMenuStrip = this.menuStrip1;
this.Name = "FrmLog";
this.Text = "日志";
this.contextMenuStrip1.ResumeLayout(false);
this.menuStrip1.ResumeLayout(false);
this.menuStrip1.PerformLayout();
this.ResumeLayout(false);
this.PerformLayout();
}
#endregion
private System.Windows.Forms.ContextMenuStrip contextMenuStrip1;
private System.Windows.Forms.ToolStripMenuItem tsmiClearLog;
private System.Windows.Forms.MenuStrip menuStrip1;
private System.Windows.Forms.ToolStripMenuItem tsmiLogLevels;
private System.Windows.Forms.ToolStripMenuItem tsmiLogSources;
private System.Windows.Forms.ListView lvLog;
private System.Windows.Forms.ColumnHeader columnHeader1;
private System.Windows.Forms.ColumnHeader columnHeader2;
private System.Windows.Forms.ColumnHeader columnHeader3;
private System.Windows.Forms.ToolStripMenuItem tsmiClearLog2;
//private System.Windows.Forms.ToolStripMenuItem testToolStripMenuItem;
}
}

236
DHSoftware/Views/FrmLog.cs Normal file
View File

@ -0,0 +1,236 @@

using XKRS.UI.Model.Winform;
using Newtonsoft.Json;
using System;
using System.Collections.Concurrent;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading;
using System.Threading.Tasks;
using System.Windows.Forms;
using static DH.Commons.Enums.EnumHelper;
using DH.Commons.Enums;
namespace DHSoftware.Views
{
public partial class FrmLog : UserControl
{
public FrmLog()
{
InitializeComponent();
lvLog.ShowItemToolTips = true;
this.Load += (s, e) =>
{
_showLevels.Clear();
tsmiLogLevels.DropDownItems.Clear();
JsonConvert.DeserializeObject<List<dynamic>>(JsonConvert.SerializeObject(EnumHelper.GetEnumListByType(typeof(LogLevel)))).ForEach(d =>
{
LogLevel lvl = (LogLevel)((int)d.Value);
ToolStripMenuItem item = new ToolStripMenuItem(d.Desc.ToString());
item.CheckOnClick = true;
item.Checked = true;
item.Tag = lvl;
item.CheckedChanged += LevelItem_CheckedChanged;
item.BackColor = lvl.GetEnumSelectedColor();
item.ForeColor = lvl.GetEnumSelectedFontColor();
tsmiLogLevels.DropDownItems.Add(item);
_showLevels.Add(lvl);
});
};
}
//public override void OnProcessUpdated()
//{
// Invoke(new Action(() =>
// {
// _showDevice.Clear();
// tsmiLogSources.DropDownItems.Clear();
// ToolStripMenuItem processItem = new ToolStripMenuItem(SOURCE_PROCESS);
// processItem.CheckOnClick = true;
// processItem.Checked = true;
// processItem.CheckedChanged += SourceItem_CheckedChanged;
// tsmiLogSources.DropDownItems.Add(processItem);
// _showDevice.Add(SOURCE_PROCESS);
// Process.DeviceCollection.ForEach(d =>
// {
// ToolStripMenuItem item = new ToolStripMenuItem(d.Name);
// item.CheckOnClick = true;
// item.Checked = true;
// item.CheckedChanged += SourceItem_CheckedChanged;
// tsmiLogSources.DropDownItems.Add(item);
// _showDevice.Add(d.Name);
// });
// }));
//}
private void LevelItem_CheckedChanged(object sender, EventArgs e)
{
_showLevels.Clear();
foreach (ToolStripMenuItem item in tsmiLogLevels.DropDownItems)
{
if (item.Checked)
{
LogLevel lv = (LogLevel)Convert.ToInt32(item.Tag);
_showLevels.Add(lv);
}
}
RefreshLogs();
}
private void SourceItem_CheckedChanged(object sender, EventArgs e)
{
_showDevice.Clear();
foreach (ToolStripMenuItem item in tsmiLogSources.DropDownItems)
{
if (item.Checked)
{
_showDevice.Add(item.Text);
}
}
RefreshLogs();
}
//public TaskFactory _taskFactory = new TaskFactory(TaskCreationOptions.LongRunning, TaskContinuationOptions.LongRunning);
readonly ConcurrentQueue<LogMsg> _logQueue = new ConcurrentQueue<LogMsg>();
Task _logTask = null;
static readonly object _logLock = new object();
List<LogMsg> _logBuffer = new List<LogMsg>();
List<LogLevel> _showLevels = new List<LogLevel>();
List<string> _showDevice = new List<string>();
const string SOURCE_PROCESS = "流程";
const int LOG_NUM_LIMIT = 20;
public void LogDisplay(LogMsg msg)
{
_logQueue.Enqueue(msg);
lock (_logLock)
{
if (_logTask == null)
{
_logTask = Task.Run(async () =>
{
while (true)
{
try
{
Invoke(new Action(() =>
{
bool isNeedScroll = false;
while (_logQueue.TryDequeue(out LogMsg log))
{
_logBuffer.Add(log);
if (_showLevels.Contains(log.LogLevel) && (_showDevice.Count == 0 || (string.IsNullOrWhiteSpace(log.MsgSource) && _showDevice.Contains(SOURCE_PROCESS)) || _showDevice.Contains(log.MsgSource)))
{
isNeedScroll = true;
ListViewItem item = new ListViewItem($"{log.LogTime.ToString("HH:mm:ss.fff")}");
item.SubItems.Add($"{log.MsgSource}[{log.ThreadId}]");
item.SubItems.Add(log.Msg);
item.ToolTipText = log.Msg;
item.ForeColor = log.LogLevel.GetEnumSelectedFontColor();
item.BackColor = log.LogLevel.GetEnumSelectedColor();
lvLog.Items.Add(item);
}
}
if (_logBuffer.Count > LOG_NUM_LIMIT * 2)
{
_logBuffer = _logBuffer.Skip(_logBuffer.Count - LOG_NUM_LIMIT).ToList();
RefreshLogs();
isNeedScroll = true;
}
if (isNeedScroll && lvLog.Items.Count > 0)
{
RefreshLvLayout();
}
}));
}
catch (Exception ex)
{
}
await Task.Delay(2000);
}
});
}
}
}
private void RefreshLogs()
{
lvLog.Items.Clear();
_logBuffer.ForEach(log =>
{
if (_showLevels.Contains(log.LogLevel) && ((string.IsNullOrWhiteSpace(log.MsgSource) && _showDevice.Contains(SOURCE_PROCESS)) || _showDevice.Contains(log.MsgSource)))
{
ListViewItem item = new ListViewItem($"{log.LogTime.ToString("HH:mm:ss.fff")}");
item.SubItems.Add($"{log.MsgSource}[{log.ThreadId}]");
item.SubItems.Add(log.Msg);
item.ToolTipText = log.Msg;
item.ForeColor = log.LogLevel.GetEnumSelectedFontColor();
item.BackColor = log.LogLevel.GetEnumSelectedColor();
lvLog.Items.Add(item);
}
});
RefreshLvLayout();
}
private void lvLog_SizeChanged(object sender, EventArgs e)
{
RefreshLvLayout();
}
int width_1stCol = 80;
public event Action<LogMsg> OnLogMsgOutput;
private void RefreshLvLayout()
{
if (lvLog.Columns.Count <= 0)
return;
lvLog.Columns[0].Width = width_1stCol;
if (lvLog.Width <= lvLog.Height)
{
lvLog.Columns[1].Width = 0;
}
else
{
lvLog.Columns[1].AutoResize(ColumnHeaderAutoResizeStyle.ColumnContent);
}
lvLog.Columns[2].Width = lvLog.Width - width_1stCol - lvLog.Columns[1].Width - 10;
if (lvLog.Items.Count > 0)
lvLog.EnsureVisible(lvLog.Items.Count - 1);
}
private void tsmiClearLog_Click(object sender, EventArgs e)
{
lvLog.Items.Clear();
}
private void tsmiClearLog2_Click(object sender, EventArgs e)
{
lvLog.Items.Clear();
}
}
}

Some files were not shown because too many files have changed in this diff Show More