Compare commits
12 Commits
dev_newtes
...
ec642b707e
Author | SHA1 | Date | |
---|---|---|---|
ec642b707e | |||
73f8d2b968 | |||
6182dc2192 | |||
28e15a556d | |||
d2f3b3f3aa | |||
b009a7355b | |||
72b67b6a2f | |||
8a0668ed96 | |||
e31a890b06 | |||
428896dbf8 | |||
f9d472295b | |||
4765e0e5bd |
@ -343,7 +343,18 @@ namespace DH.Commons.Base
|
|||||||
}
|
}
|
||||||
|
|
||||||
// 其他方法保持原有逻辑
|
// 其他方法保持原有逻辑
|
||||||
public Action<DateTime, CameraBase, Mat> OnHImageOutput { get; set; }
|
public MatSet CopyImageSet(MatSet srcSet)
|
||||||
|
{
|
||||||
|
MatSet imageSet = new MatSet
|
||||||
|
{
|
||||||
|
Id = srcSet.Id,
|
||||||
|
_mat = srcSet._mat.Clone(),
|
||||||
|
// ImageSaveOption = srcSet.ImageSaveOption.Copy(),
|
||||||
|
ImageTime = srcSet.ImageTime
|
||||||
|
};
|
||||||
|
return imageSet;
|
||||||
|
}
|
||||||
|
public Action<DateTime, CameraBase, MatSet> OnHImageOutput { get; set; }
|
||||||
|
|
||||||
public virtual bool CameraConnect() { return false; }
|
public virtual bool CameraConnect() { return false; }
|
||||||
|
|
||||||
|
@ -488,6 +488,7 @@ namespace DH.Commons.Base
|
|||||||
#region 属性字段
|
#region 属性字段
|
||||||
private string _id = Guid.NewGuid().ToString();
|
private string _id = Guid.NewGuid().ToString();
|
||||||
private string _name;
|
private string _name;
|
||||||
|
private EnumDetectionType _detectionType= EnumDetectionType.深度学习;
|
||||||
private string _cameraSourceId = "";
|
private string _cameraSourceId = "";
|
||||||
private List<RelatedCamera> _cameraCollects = new List<RelatedCamera>();
|
private List<RelatedCamera> _cameraCollects = new List<RelatedCamera>();
|
||||||
private bool _isEnableGPU;
|
private bool _isEnableGPU;
|
||||||
@ -509,7 +510,7 @@ namespace DH.Commons.Base
|
|||||||
private AntList<SizeTreatParam> _sizeTreatParamList = new AntList<SizeTreatParam>();
|
private AntList<SizeTreatParam> _sizeTreatParamList = new AntList<SizeTreatParam>();
|
||||||
|
|
||||||
private CustomizedPoint _showLocation = new CustomizedPoint();
|
private CustomizedPoint _showLocation = new CustomizedPoint();
|
||||||
private string _imageSaveDirectory="D://Images";
|
private string _imageSaveDirectory= "D://PROJECTS//Images//";
|
||||||
private bool _saveOKOriginal = false;
|
private bool _saveOKOriginal = false;
|
||||||
private bool _saveNGOriginal = false;
|
private bool _saveNGOriginal = false;
|
||||||
private bool _saveOKDetect = false;
|
private bool _saveOKDetect = false;
|
||||||
@ -789,7 +790,19 @@ namespace DH.Commons.Base
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
[Category("检测配置")]
|
||||||
|
[DisplayName("检测类型")]
|
||||||
|
[Description("检测类型")]
|
||||||
|
public EnumDetectionType DetectionType
|
||||||
|
{
|
||||||
|
get => _detectionType;
|
||||||
|
set
|
||||||
|
{
|
||||||
|
if (_detectionType == value) return;
|
||||||
|
_detectionType = value;
|
||||||
|
OnPropertyChanged(nameof(DetectionType));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
[Category("显示配置")]
|
[Category("显示配置")]
|
||||||
[DisplayName("显示位置")]
|
[DisplayName("显示位置")]
|
||||||
@ -1072,6 +1085,15 @@ namespace DH.Commons.Base
|
|||||||
OnPropertyChanged(nameof(CellLinks));
|
OnPropertyChanged(nameof(CellLinks));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public bool FilterOperation(DetectionResultDetail recongnitionResult)
|
||||||
|
{
|
||||||
|
|
||||||
|
double compareValue = recongnitionResult.Area;
|
||||||
|
double compareScoreValue = recongnitionResult.Score;
|
||||||
|
return (compareValue >= MinArea && compareValue <= MaxArea)&& (compareScoreValue >= MinScore && compareScoreValue <= MaxScore);
|
||||||
|
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public class SizeTreatParam : NotifyProperty
|
public class SizeTreatParam : NotifyProperty
|
||||||
|
@ -305,7 +305,7 @@ namespace DH.Commons.Base
|
|||||||
|
|
||||||
//if (InitialConfig.IsEnableLog)
|
//if (InitialConfig.IsEnableLog)
|
||||||
//{
|
//{
|
||||||
// LoggerHelper.LogAsync(msg);
|
LoggerHelper.LogAsync(msg);
|
||||||
//}
|
//}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -36,7 +36,7 @@ namespace DH.Commons.Base
|
|||||||
|
|
||||||
public HTuple hv_ModelID;
|
public HTuple hv_ModelID;
|
||||||
|
|
||||||
public abstract DetectStationResult RunInference(Mat originImgSet, string detectionId = null);
|
public abstract DetectStationResult RunInference(MatSet originImgSet, string detectionId = null);
|
||||||
|
|
||||||
//public abstract void SaveDetectResultAsync(DetectStationResult detectResult);
|
//public abstract void SaveDetectResultAsync(DetectStationResult detectResult);
|
||||||
|
|
||||||
|
64
DH.Commons/Base/VisualLocalization.cs
Normal file
64
DH.Commons/Base/VisualLocalization.cs
Normal file
@ -0,0 +1,64 @@
|
|||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Linq;
|
||||||
|
using System.Text;
|
||||||
|
using System.Text.Json;
|
||||||
|
using System.Threading.Tasks;
|
||||||
|
|
||||||
|
namespace DH.Commons.Base
|
||||||
|
{
|
||||||
|
[Serializable]
|
||||||
|
public class VisualLocalization
|
||||||
|
{
|
||||||
|
// 必须包含公共无参构造函数
|
||||||
|
public VisualLocalization() { }
|
||||||
|
|
||||||
|
public string CameraName { get; set; }
|
||||||
|
public string ModelPath { get; set; }
|
||||||
|
public string ImgPath { get; set; }
|
||||||
|
public string Threshold { get; set; }
|
||||||
|
public string Direction { get; set; }
|
||||||
|
public string Speed { get; set; }
|
||||||
|
|
||||||
|
// 保存到文件
|
||||||
|
public void SaveToFile(string filePath)
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
var options = new JsonSerializerOptions
|
||||||
|
{
|
||||||
|
WriteIndented = true, // 美化格式
|
||||||
|
IgnoreNullValues = true // 忽略空值
|
||||||
|
};
|
||||||
|
|
||||||
|
string json = JsonSerializer.Serialize(this, options);
|
||||||
|
File.WriteAllText(filePath, json);
|
||||||
|
}
|
||||||
|
catch (Exception ex)
|
||||||
|
{
|
||||||
|
throw new InvalidOperationException($"保存失败: {ex.Message}");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// 从文件加载
|
||||||
|
public static VisualLocalization LoadFromFile(string filePath)
|
||||||
|
{
|
||||||
|
if (!File.Exists(filePath))
|
||||||
|
throw new FileNotFoundException("文件不存在", filePath);
|
||||||
|
|
||||||
|
try
|
||||||
|
{
|
||||||
|
string json = File.ReadAllText(filePath);
|
||||||
|
return JsonSerializer.Deserialize<VisualLocalization>(json);
|
||||||
|
}
|
||||||
|
catch (JsonException ex)
|
||||||
|
{
|
||||||
|
throw new InvalidOperationException($"JSON解析错误: {ex.Message}");
|
||||||
|
}
|
||||||
|
catch (IOException ex)
|
||||||
|
{
|
||||||
|
throw new InvalidOperationException($"文件读取失败: {ex.Message}");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
@ -12,6 +12,9 @@
|
|||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<PackageReference Include="AntdUI" Version="1.8.9" />
|
<PackageReference Include="AntdUI" Version="1.8.9" />
|
||||||
|
@ -141,6 +141,14 @@ namespace DH.Commons.Enums
|
|||||||
False,
|
False,
|
||||||
True
|
True
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public enum EnumDetectionType
|
||||||
|
{
|
||||||
|
深度学习,
|
||||||
|
尺寸测量
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
public enum StreamFormat
|
public enum StreamFormat
|
||||||
{
|
{
|
||||||
[Description("8位图像")]
|
[Description("8位图像")]
|
||||||
|
@ -375,6 +375,22 @@ namespace DH.Commons.Enums
|
|||||||
[Description("异常")]
|
[Description("异常")]
|
||||||
DSExcept = 32
|
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
|
||||||
{
|
{
|
||||||
X,
|
X,
|
||||||
|
26
DH.Commons/Models/ProductSummary.cs
Normal file
26
DH.Commons/Models/ProductSummary.cs
Normal 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; }
|
||||||
|
}
|
||||||
|
}
|
@ -1,4 +1,5 @@
|
|||||||
using System.Collections.Concurrent;
|
using System.Collections.Concurrent;
|
||||||
|
using System.Collections.Generic;
|
||||||
using System.Diagnostics;
|
using System.Diagnostics;
|
||||||
using System.Reflection.Metadata;
|
using System.Reflection.Metadata;
|
||||||
using System.Xml.Linq;
|
using System.Xml.Linq;
|
||||||
@ -9,6 +10,7 @@ using DVPCameraType;
|
|||||||
using OpenCvSharp;
|
using OpenCvSharp;
|
||||||
using OpenCvSharp.Extensions;
|
using OpenCvSharp.Extensions;
|
||||||
using static System.Net.Mime.MediaTypeNames;
|
using static System.Net.Mime.MediaTypeNames;
|
||||||
|
using static MvCamCtrl.NET.MyCamera;
|
||||||
using LogLevel = DH.Commons.Enums.EnumHelper.LogLevel;
|
using LogLevel = DH.Commons.Enums.EnumHelper.LogLevel;
|
||||||
|
|
||||||
|
|
||||||
@ -38,7 +40,7 @@ namespace DH.Devices.Camera
|
|||||||
{
|
{
|
||||||
LoggerHelper.LogPath = "D://";
|
LoggerHelper.LogPath = "D://";
|
||||||
LoggerHelper.LogPrefix = CameraName;
|
LoggerHelper.LogPrefix = CameraName;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -61,6 +63,7 @@ namespace DH.Devices.Camera
|
|||||||
{
|
{
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
|
pCallBackFunc = new DVPCamera.dvpEventCallback(cbExceptiondelegate);
|
||||||
nRet = DVPCamera.dvpOpenByUserId(CameraName,
|
nRet = DVPCamera.dvpOpenByUserId(CameraName,
|
||||||
dvpOpenMode.OPEN_NORMAL,
|
dvpOpenMode.OPEN_NORMAL,
|
||||||
ref m_handle);
|
ref m_handle);
|
||||||
@ -81,13 +84,13 @@ namespace DH.Devices.Camera
|
|||||||
nRet = DVPCamera.dvpGetCameraInfo(m_handle, ref camerainfo);
|
nRet = DVPCamera.dvpGetCameraInfo(m_handle, ref camerainfo);
|
||||||
|
|
||||||
SerialNumber = camerainfo.SerialNumber;
|
SerialNumber = camerainfo.SerialNumber;
|
||||||
// ch:注册异常回调函数 | en:Register Exception Callback
|
//ch: 注册异常回调函数 | en:Register Exception Callback
|
||||||
//nRet = DVPCamera.dvpRegisterEventCallback(m_handle, pCallBackFunc, dvpEvent.EVENT_DISCONNECTED, IntPtr.Zero);
|
nRet = DVPCamera.dvpRegisterEventCallback(m_handle, pCallBackFunc, dvpEvent.EVENT_DISCONNECTED, IntPtr.Zero);
|
||||||
//if (nRet != dvpStatus.DVP_STATUS_OK)
|
if (nRet != dvpStatus.DVP_STATUS_OK)
|
||||||
//{
|
{
|
||||||
// throw new Exception($"Register expection callback failed:{nRet}");
|
throw new Exception($"Register expection callback failed:{nRet}");
|
||||||
//}
|
}
|
||||||
//GC.KeepAlive(pCallBackFunc);
|
GC.KeepAlive(pCallBackFunc);
|
||||||
|
|
||||||
//// ch:设置采集连续模式 | en:Set Continues Aquisition Mode
|
//// ch:设置采集连续模式 | en:Set Continues Aquisition Mode
|
||||||
if (IsContinueMode)
|
if (IsContinueMode)
|
||||||
@ -152,7 +155,7 @@ namespace DH.Devices.Camera
|
|||||||
SetGain(Gain);
|
SetGain(Gain);
|
||||||
}
|
}
|
||||||
//全画幅
|
//全画幅
|
||||||
if(!IsAllPicEnabled)
|
if (!IsAllPicEnabled)
|
||||||
SetPictureRoi((int)ROIX, (int)ROIY, (int)ROIW, (int)ROIH);
|
SetPictureRoi((int)ROIX, (int)ROIY, (int)ROIW, (int)ROIH);
|
||||||
|
|
||||||
//// 设置 触发延迟
|
//// 设置 触发延迟
|
||||||
@ -190,7 +193,26 @@ namespace DH.Devices.Camera
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 回调函数
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="handle"></param>
|
||||||
|
/// <param name="_event"></param>
|
||||||
|
/// <param name="pContext"></param>
|
||||||
|
/// <param name="param"></param>
|
||||||
|
/// <param name="refVariant"></param>
|
||||||
|
/// <returns></returns>
|
||||||
|
public int cbExceptiondelegate(uint handle, dvpEvent _event, IntPtr pContext, int param, ref dvpVariant refVariant)
|
||||||
|
{
|
||||||
|
|
||||||
|
if (_event == dvpEvent.EVENT_DISCONNECTED)
|
||||||
|
{
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
return dvpStatus.DVP_STATUS_OK.ToInt();
|
||||||
|
}
|
||||||
|
|
||||||
private void IIConfig_PropertyChanged(object sender, System.ComponentModel.PropertyChangedEventArgs e)
|
private void IIConfig_PropertyChanged(object sender, System.ComponentModel.PropertyChangedEventArgs e)
|
||||||
{
|
{
|
||||||
@ -329,7 +351,7 @@ namespace DH.Devices.Camera
|
|||||||
Mat cvImage = new Mat();
|
Mat cvImage = new Mat();
|
||||||
if (this.CameraName.Equals("Cam1"))
|
if (this.CameraName.Equals("Cam1"))
|
||||||
{
|
{
|
||||||
Console.WriteLine( );
|
Console.WriteLine();
|
||||||
}
|
}
|
||||||
if (this.CameraName.Equals("Cam2"))
|
if (this.CameraName.Equals("Cam2"))
|
||||||
{
|
{
|
||||||
@ -369,13 +391,15 @@ namespace DH.Devices.Camera
|
|||||||
{
|
{
|
||||||
|
|
||||||
_mat = smat,
|
_mat = smat,
|
||||||
|
|
||||||
};
|
};
|
||||||
InitialImageSet(imageSet);
|
InitialImageSet(imageSet);
|
||||||
OnHImageOutput?.Invoke(DateTime.Now, this, smat);
|
|
||||||
|
var outImgSet = CopyImageSet(imageSet);
|
||||||
|
OnHImageOutput?.Invoke(DateTime.Now, this, outImgSet);
|
||||||
|
|
||||||
//存图
|
//存图
|
||||||
DisplayAndSaveOriginImage(imageSet.Id,SnapshotCount);
|
DisplayAndSaveOriginImage(imageSet.Id, SnapshotCount);
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@ -391,7 +415,7 @@ namespace DH.Devices.Camera
|
|||||||
}
|
}
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
public void InitialImageSet(MatSet set)
|
public void InitialImageSet(MatSet set)
|
||||||
{
|
{
|
||||||
//if (saveOption != null)
|
//if (saveOption != null)
|
||||||
//{
|
//{
|
||||||
@ -415,13 +439,25 @@ namespace DH.Devices.Camera
|
|||||||
{
|
{
|
||||||
await Task.Run(() =>
|
await Task.Run(() =>
|
||||||
{
|
{
|
||||||
Bitmap showImage = set._mat.ToBitmap();
|
Bitmap? showImage = null;
|
||||||
|
|
||||||
|
try
|
||||||
|
{
|
||||||
|
showImage = set._mat.ToBitmap();
|
||||||
|
}
|
||||||
|
catch (Exception)
|
||||||
|
{
|
||||||
|
//释放 himage
|
||||||
|
ClearImageSet(set);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
// showImage.Save("D:/test333.bmp");
|
// showImage.Save("D:/test333.bmp");
|
||||||
// Marshal.Copy(pbyteImageBuffer, 0, (IntPtr)lAddrImage, (int)dwBufferSize);
|
// Marshal.Copy(pbyteImageBuffer, 0, (IntPtr)lAddrImage, (int)dwBufferSize);
|
||||||
// Bitmap saveImage = showImage?.CopyBitmap();
|
// Bitmap saveImage = showImage?.CopyBitmap();
|
||||||
// saveImage.Save("d://TEST444.BMP");
|
// saveImage.Save("d://TEST444.BMP");
|
||||||
// OnShowImageUpdated?.Invoke(this, showImage, imgSetId);
|
// OnShowImageUpdated?.Invoke(this, showImage, imgSetId);
|
||||||
if (IsSavePicEnabled)
|
if (IsSavePicEnabled && showImage != null)
|
||||||
{
|
{
|
||||||
string fullname = Path.Combine(ImageSaveDirectory, $"{CameraName}_{_counter:D7}_{set.Id}.{set._imageFormat.ToString().ToLower()}");
|
string fullname = Path.Combine(ImageSaveDirectory, $"{CameraName}_{_counter:D7}_{set.Id}.{set._imageFormat.ToString().ToLower()}");
|
||||||
ImageSaveAsync(fullname, showImage);
|
ImageSaveAsync(fullname, showImage);
|
||||||
@ -466,7 +502,7 @@ namespace DH.Devices.Camera
|
|||||||
{
|
{
|
||||||
FullName = fullName,
|
FullName = fullName,
|
||||||
SaveImage = map,
|
SaveImage = map,
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
ImageSaveHelper.ImageSaveAsync(imageSaveSet);
|
ImageSaveHelper.ImageSaveAsync(imageSaveSet);
|
||||||
@ -475,31 +511,39 @@ namespace DH.Devices.Camera
|
|||||||
{
|
{
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
dvpStreamState StreamState = new dvpStreamState();
|
|
||||||
nRet = DVPCamera.dvpGetStreamState(m_handle, ref StreamState);
|
// 1. 停止采集(如果正在运行)
|
||||||
//Debug.Assert(nRet == dvpStatus.DVP_STATUS_OK);
|
dvpStreamState streamState = new dvpStreamState();
|
||||||
if (StreamState == dvpStreamState.STATE_STARTED)
|
nRet = DVPCamera.dvpGetStreamState(m_handle, ref streamState);
|
||||||
|
if (streamState == dvpStreamState.STATE_STARTED)
|
||||||
{
|
{
|
||||||
// stop camera
|
// 先停止采集流
|
||||||
nRet = DVPCamera.dvpStop(m_handle);
|
nRet = DVPCamera.dvpStop(m_handle);
|
||||||
Debug.Assert(nRet == dvpStatus.DVP_STATUS_OK);
|
|
||||||
if (nRet != dvpStatus.DVP_STATUS_OK)
|
if (nRet != dvpStatus.DVP_STATUS_OK)
|
||||||
{
|
{
|
||||||
throw new Exception($"Stop grabbing failed{nRet:x8}");
|
throw new Exception($"停止采集失败,错误码:0x{nRet:X8}");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// 2. 设置触发源为软件触发(此时设备已停止)
|
||||||
|
nRet = DVPCamera.dvpSetTriggerState(m_handle, false);
|
||||||
|
if (nRet != dvpStatus.DVP_STATUS_OK)
|
||||||
|
{
|
||||||
|
throw new Exception($"设置软件触发失败,错误码:0x{nRet:X8}");
|
||||||
|
}
|
||||||
|
|
||||||
|
// 3. 注销事件回调
|
||||||
nRet = DVPCamera.dvpUnregisterEventCallback(m_handle, pCallBackFunc, dvpEvent.EVENT_DISCONNECTED, IntPtr.Zero);
|
nRet = DVPCamera.dvpUnregisterEventCallback(m_handle, pCallBackFunc, dvpEvent.EVENT_DISCONNECTED, IntPtr.Zero);
|
||||||
if (nRet != dvpStatus.DVP_STATUS_OK)
|
if (nRet != dvpStatus.DVP_STATUS_OK)
|
||||||
{
|
{
|
||||||
throw new Exception($"Unregister expection callback failed:{nRet}");
|
throw new Exception($"注销事件回调失败,错误码:0x{nRet:X8}");
|
||||||
}
|
}
|
||||||
|
|
||||||
// ch:关闭设备 | en:Close device
|
// 4. 关闭设备
|
||||||
nRet = DVPCamera.dvpClose(m_handle);
|
nRet = DVPCamera.dvpClose(m_handle);
|
||||||
if (nRet != dvpStatus.DVP_STATUS_OK)
|
if (nRet != dvpStatus.DVP_STATUS_OK)
|
||||||
{
|
{
|
||||||
throw new Exception($"Close device failed{nRet:x8}");
|
throw new Exception($"关闭设备失败,错误码:0x{nRet:X8}");
|
||||||
}
|
}
|
||||||
|
|
||||||
m_handle = 0;
|
m_handle = 0;
|
||||||
@ -512,6 +556,12 @@ namespace DH.Devices.Camera
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void Snapshot()
|
||||||
|
{
|
||||||
|
DVPCamera.dvpTriggerFire(m_handle);
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
public void LogAsync(LogMsg msg)
|
public void LogAsync(LogMsg msg)
|
||||||
{
|
{
|
||||||
msg.MsgSource = CameraName;
|
msg.MsgSource = CameraName;
|
||||||
@ -525,7 +575,7 @@ namespace DH.Devices.Camera
|
|||||||
LoggerHelper.LogAsync(msg);
|
LoggerHelper.LogAsync(msg);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
public void LogAsync(DateTime dt, LogLevel logLevel, string msg)
|
public void LogAsync(DateTime dt, LogLevel logLevel, string msg)
|
||||||
{
|
{
|
||||||
LogAsync(new LogMsg(dt, logLevel, msg));
|
LogAsync(new LogMsg(dt, logLevel, msg));
|
||||||
}
|
}
|
||||||
|
@ -368,7 +368,7 @@ namespace DH.Devices.Camera
|
|||||||
throw new NotSupportedException($"Unsupported pixel type: {pFrameInfo.enPixelType}");
|
throw new NotSupportedException($"Unsupported pixel type: {pFrameInfo.enPixelType}");
|
||||||
}
|
}
|
||||||
|
|
||||||
OnHImageOutput?.Invoke(DateTime.Now, this, cvImage);
|
//OnHImageOutput?.Invoke(DateTime.Now, this, cvImage);
|
||||||
|
|
||||||
}
|
}
|
||||||
catch (Exception ex)
|
catch (Exception ex)
|
||||||
|
@ -41,7 +41,7 @@ namespace DH.Devices.PLC
|
|||||||
{
|
{
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
LoggerHelper.LogPath = "D://";
|
LoggerHelper.LogPath = "D://PROJECTS//Logs//";
|
||||||
LoggerHelper.LogPrefix = "PLC";
|
LoggerHelper.LogPrefix = "PLC";
|
||||||
|
|
||||||
TcpNet.IpAddress = IP;
|
TcpNet.IpAddress = IP;
|
||||||
@ -815,6 +815,30 @@ namespace DH.Devices.PLC
|
|||||||
WriteBool(pLCItem.Address, b);
|
WriteBool(pLCItem.Address, b);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 转盘方向
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="b"></param>
|
||||||
|
public void TurnDirection(bool b)
|
||||||
|
{
|
||||||
|
PLCItem? pLCItem = PLCItemList.FirstOrDefault(u => u.Name == "转盘方向");
|
||||||
|
if (pLCItem == null)
|
||||||
|
return;
|
||||||
|
WriteBool(pLCItem.Address, b);
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 转盘速度
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="b"></param>
|
||||||
|
public void TurnSpeed(int speed)
|
||||||
|
{
|
||||||
|
PLCItem? pLCItem = PLCItemList.FirstOrDefault(u => u.Name == "转盘速度");
|
||||||
|
if (pLCItem == null)
|
||||||
|
return;
|
||||||
|
WriteUInt16(pLCItem.Address, (ushort)speed);
|
||||||
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 转盘启停
|
/// 转盘启停
|
||||||
/// </summary>
|
/// </summary>
|
||||||
@ -1026,6 +1050,16 @@ namespace DH.Devices.PLC
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public int ReadVisionPos()
|
||||||
|
{
|
||||||
|
PLCItem? pLCItem = PLCItemList.FirstOrDefault(u => u.Name == "定位完成脉冲值");
|
||||||
|
if (pLCItem == null)
|
||||||
|
return 0;
|
||||||
|
int value = ReadInt32(pLCItem.Address);
|
||||||
|
Thread.Sleep(10);
|
||||||
|
return Math.Abs(value);
|
||||||
|
}
|
||||||
|
|
||||||
public void LogAsync(LogMsg msg)
|
public void LogAsync(LogMsg msg)
|
||||||
{
|
{
|
||||||
msg.MsgSource = "PLC";
|
msg.MsgSource = "PLC";
|
||||||
|
@ -58,7 +58,7 @@ namespace DH.Devices.Vision
|
|||||||
//{
|
//{
|
||||||
// LogAsync(new LogMsg(dt, LogLevel.Error, msg));
|
// LogAsync(new LogMsg(dt, LogLevel.Error, msg));
|
||||||
//}
|
//}
|
||||||
public override DetectStationResult RunInference(Mat originImgSet, string detectionId = null)
|
public override DetectStationResult RunInference(MatSet originImgSet, string detectionId = null)
|
||||||
{
|
{
|
||||||
DetectStationResult detectResult = new DetectStationResult();
|
DetectStationResult detectResult = new DetectStationResult();
|
||||||
DetectionConfig detectConfig = null;
|
DetectionConfig detectConfig = null;
|
||||||
@ -78,19 +78,20 @@ namespace DH.Devices.Vision
|
|||||||
//未能获得检测配置
|
//未能获得检测配置
|
||||||
return detectResult;
|
return detectResult;
|
||||||
}
|
}
|
||||||
|
detectResult.Id = originImgSet.Id;
|
||||||
detectResult.DetectName = detectConfig.Name;
|
detectResult.DetectName = detectConfig.Name;
|
||||||
detectResult.ImageSaveDirectory=detectConfig.ImageSaveDirectory;
|
detectResult.ImageSaveDirectory=detectConfig.ImageSaveDirectory;
|
||||||
detectResult.SaveNGDetect=detectConfig.SaveNGDetect;
|
detectResult.SaveNGDetect=detectConfig.SaveNGDetect;
|
||||||
detectResult.SaveNGOriginal=detectConfig.SaveNGOriginal;
|
detectResult.SaveNGOriginal=detectConfig.SaveNGOriginal;
|
||||||
detectResult.SaveOKDetect=detectConfig.SaveOKDetect;
|
detectResult.SaveOKDetect=detectConfig.SaveOKDetect;
|
||||||
detectResult.SaveOKOriginal=detectConfig.SaveOKOriginal;
|
detectResult.SaveOKOriginal=detectConfig.SaveOKOriginal;
|
||||||
Mat OriginImage = originImgSet.Clone();
|
Mat OriginImage = originImgSet._mat.Clone();
|
||||||
detectResult.DetectionOriginImage = CopyBitmapWithLockBits(OriginImage.ToBitmap());
|
detectResult.DetectionOriginImage = CopyBitmapWithLockBits(OriginImage.ToBitmap());
|
||||||
//detectResult.DetectionOriginImage = originImgSet.Clone().ToBitmap();
|
//detectResult.DetectionOriginImage = originImgSet.Clone().ToBitmap();
|
||||||
Stopwatch sw = new Stopwatch();
|
Stopwatch sw = new Stopwatch();
|
||||||
#region 1.预处理
|
#region 1.预处理
|
||||||
sw.Start();
|
sw.Start();
|
||||||
using (Mat PreTMat = originImgSet.Clone())
|
using (Mat PreTMat = originImgSet._mat.Clone())
|
||||||
{
|
{
|
||||||
PreTreated(detectConfig, detectResult, PreTMat);
|
PreTreated(detectConfig, detectResult, PreTMat);
|
||||||
PreTreated2(detectConfig, detectResult, PreTMat);
|
PreTreated2(detectConfig, detectResult, PreTMat);
|
||||||
@ -142,7 +143,7 @@ namespace DH.Devices.Vision
|
|||||||
req.ResizeHeight = (int)detectConfig.ModelHeight;
|
req.ResizeHeight = (int)detectConfig.ModelHeight;
|
||||||
// req.LabelNames = detectConfig.GetLabelNames();
|
// req.LabelNames = detectConfig.GetLabelNames();
|
||||||
// req.Score = IIConfig.Score;
|
// req.Score = IIConfig.Score;
|
||||||
req.mImage = originImgSet.Clone();
|
req.mImage = originImgSet._mat.Clone();
|
||||||
|
|
||||||
req.in_lable_path = detectConfig.In_lable_path;
|
req.in_lable_path = detectConfig.In_lable_path;
|
||||||
|
|
||||||
@ -170,41 +171,10 @@ namespace DH.Devices.Vision
|
|||||||
|
|
||||||
// LogAsync(DateTime.Now, LogLevel.Information, $"{detectConfig.Name} 产品{detectResult.TempPid} RunInference BEGIN");
|
// LogAsync(DateTime.Now, LogLevel.Information, $"{detectConfig.Name} 产品{detectResult.TempPid} RunInference BEGIN");
|
||||||
mlWatch.Start();
|
mlWatch.Start();
|
||||||
//20230802改成多线程推理 RunInferenceFixed
|
|
||||||
// MLResult result = new MLResult();
|
|
||||||
var result = mlSet.StationMLEngine.RunInference(req);
|
var result = mlSet.StationMLEngine.RunInference(req);
|
||||||
// var result = mlSet.StationMLEngine.RunInferenceFixed(req);
|
|
||||||
mlWatch.Stop();
|
mlWatch.Stop();
|
||||||
// LogAsync(DateTime.Now, LogLevel.Information, $"{detectConfig.Name} 产品{detectResult.TempPid} RunInference END");
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
// var req = new MLRequest();
|
|
||||||
|
|
||||||
//req.mImage = inferenceImage;
|
|
||||||
|
|
||||||
//req.ResizeWidth = detectConfig.ModelWidth;
|
|
||||||
//req.ResizeHeight = detectConfig.ModelHeight;
|
|
||||||
//req.confThreshold = detectConfig.ModelconfThreshold;
|
|
||||||
//req.iouThreshold = 0.3f;
|
|
||||||
//req.out_node_name = "output0";
|
|
||||||
//req.in_lable_path = detectConfig.in_lable_path;
|
|
||||||
|
|
||||||
//Stopwatch sw = Stopwatch.StartNew();
|
|
||||||
//var result = Dectection[detectionId].RunInference(req);
|
|
||||||
//sw.Stop();
|
|
||||||
//LogAsync(DateTime.Now, LogLevel.Information, $"{camera.Name} 推理进度1.1,产品{productNumber},耗时{sw.ElapsedMilliseconds}ms");
|
|
||||||
|
|
||||||
//this.BeginInvoke(new MethodInvoker(delegate ()
|
|
||||||
//{
|
|
||||||
// // pictureBox1.Image?.Dispose(); // 释放旧图像
|
|
||||||
// // pictureBox1.Image = result.ResultMap;
|
|
||||||
// richTextBox1.AppendText($"推理成功 {productNumber}, {result.IsSuccess}相机名字{camera.CameraName} 耗时 {mlWatch.ElapsedMilliseconds}ms\n");
|
|
||||||
//}));
|
|
||||||
//req.mImage?.Dispose();
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@ -268,22 +238,22 @@ namespace DH.Devices.Vision
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
//foreach (IGrouping<ResultState, DetectionFilter> group in conditionList)
|
foreach (IGrouping<ResultState, DetectionLable> group in conditionList)
|
||||||
//{
|
{
|
||||||
// bool b = group.ToList().Any(f =>
|
bool b = group.ToList().Any(f =>
|
||||||
// {
|
{
|
||||||
// return f.FilterOperation(d);
|
return f.FilterOperation(d);
|
||||||
// });
|
});
|
||||||
|
|
||||||
|
|
||||||
// if (b)
|
if (b)
|
||||||
// {
|
{
|
||||||
// d.FinalResult = group.Key;
|
d.FinalResult = group.Key;
|
||||||
// break;
|
break;
|
||||||
// }
|
}
|
||||||
|
|
||||||
|
|
||||||
//}
|
}
|
||||||
});
|
});
|
||||||
#endregion
|
#endregion
|
||||||
#region 5.统计缺陷过滤结果或预处理直接NG
|
#region 5.统计缺陷过滤结果或预处理直接NG
|
||||||
@ -308,7 +278,7 @@ namespace DH.Devices.Vision
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
DisplayDetectionResult(detectResult, originImgSet.Clone(), detectionId);
|
DisplayDetectionResult(detectResult, originImgSet._mat.Clone(), detectionId);
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@ -455,7 +425,7 @@ namespace DH.Devices.Vision
|
|||||||
{
|
{
|
||||||
// throw new ProcessException("异常:模型加载异常", null);
|
// throw new ProcessException("异常:模型加载异常", null);
|
||||||
}
|
}
|
||||||
LogAsync(DateTime.Now, LogLevel.Information, $"模型加载成功;是否GPU:{isGPU} CoreInx:{coreInx} - {dc.Name}" + $" {dc.ModelType.GetEnumDescription()}:{dc.ModelPath}");
|
LogAsync(DateTime.Now, LogLevel.Action, $"模型加载成功;是否GPU:{isGPU} CoreInx:{coreInx} - {dc.Name}" + $" {dc.ModelType.GetEnumDescription()}:{dc.ModelPath}");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
catch (Exception ex)
|
catch (Exception ex)
|
||||||
|
@ -12,9 +12,14 @@
|
|||||||
<OutputType>WinExe</OutputType>
|
<OutputType>WinExe</OutputType>
|
||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
|
|
||||||
<ItemGroup>
|
|
||||||
<Compile Remove="Services\AuthService.cs" />
|
|
||||||
</ItemGroup>
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<Content Include="db\config.json">
|
<Content Include="db\config.json">
|
||||||
@ -25,6 +30,35 @@
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
@ -55,9 +89,7 @@
|
|||||||
</Reference>
|
</Reference>
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
|
|
||||||
<ItemGroup>
|
|
||||||
<Folder Include="Services\" />
|
|
||||||
</ItemGroup>
|
|
||||||
|
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<None Include="db\db.sqlite">
|
<None Include="db\db.sqlite">
|
||||||
|
991
DHSoftware/MainWindow.Designer.cs
generated
991
DHSoftware/MainWindow.Designer.cs
generated
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
@ -118,33 +118,39 @@
|
|||||||
<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="segmentedItem1.IconActiveSvg" xml:space="preserve">
|
<data name="segmentedItem1.IconActiveSvg" xml:space="preserve">
|
||||||
<value><svg viewBox="0 0 1024 1024" xmlns="http://www.w3.org/2000/svg" width="200" height="200"><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"/><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"/></svg></value>
|
<value><svg viewBox="0 0 1024 1024" xmlns="http://www.w3.org/2000/svg" width="200" height="200"><path d="M512 1024a512 512 0 1 1 512-512 512.568889 512.568889 0 0 1-512 512zm0-946.915556A434.915556 434.915556 0 1 0 946.915556 512 435.427556 435.427556 0 0 0 512 77.084444z" fill="#FFFFFF"/><path d="M199.555 528.063h293.116v278.095L710.638 300.43 199.555 528.063zm148.53-39.044 252.043 112.252L531.715 616.92V489.019H383.185z" fill="#FFFFFF"/></svg></value>
|
||||||
</data>
|
</data>
|
||||||
<data name="segmentedItem1.IconSvg" xml:space="preserve">
|
<data name="segmentedItem1.IconSvg" xml:space="preserve">
|
||||||
<value><svg viewBox="0 0 1024 1024" xmlns="http://www.w3.org/2000/svg" width="200" height="200"><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"/><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"/></svg></value>
|
<value><svg viewBox="0 0 1024 1024" xmlns="http://www.w3.org/2000/svg" width="200" height="200"><path d="M512 1024a512 512 0 1 1 512-512 512.568889 512.568889 0 0 1-512 512zm0-946.915556A434.915556 434.915556 0 1 0 946.915556 512 435.427556 435.427556 0 0 0 512 77.084444z" fill="#FFFFFF"/><path d="M199.555 528.063h293.116v278.095L710.638 300.43 199.555 528.063zm148.53-39.044 252.043 112.252L531.715 616.92V489.019H383.185z" fill="#FFFFFF"/></svg></value>
|
||||||
</data>
|
</data>
|
||||||
<data name="segmentedItem2.IconActiveSvg" xml:space="preserve">
|
<data name="segmentedItem2.IconActiveSvg" xml:space="preserve">
|
||||||
<value><svg viewBox="0 0 1024 1024" xmlns="http://www.w3.org/2000/svg" width="200" height="200"><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"/></svg></value>
|
<value><svg viewBox="0 0 1024 1024" xmlns="http://www.w3.org/2000/svg" width="200" height="200"><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"/><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"/></svg></value>
|
||||||
</data>
|
</data>
|
||||||
<data name="segmentedItem2.IconSvg" xml:space="preserve">
|
<data name="segmentedItem2.IconSvg" xml:space="preserve">
|
||||||
<value><svg viewBox="0 0 1024 1024" xmlns="http://www.w3.org/2000/svg" width="200" height="200"><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"/></svg></value>
|
<value><svg viewBox="0 0 1024 1024" xmlns="http://www.w3.org/2000/svg" width="200" height="200"><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"/><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"/></svg></value>
|
||||||
</data>
|
</data>
|
||||||
<data name="segmentedItem3.IconActiveSvg" xml:space="preserve">
|
<data name="segmentedItem3.IconActiveSvg" xml:space="preserve">
|
||||||
<value><svg viewBox="0 0 1027 1024" xmlns="http://www.w3.org/2000/svg" width="200" height="200"><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"/><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"/></svg></value>
|
<value><svg viewBox="0 0 1024 1024" xmlns="http://www.w3.org/2000/svg" width="200" height="200"><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"/></svg></value>
|
||||||
</data>
|
</data>
|
||||||
<data name="segmentedItem3.IconSvg" xml:space="preserve">
|
<data name="segmentedItem3.IconSvg" xml:space="preserve">
|
||||||
<value><svg viewBox="0 0 1027 1024" xmlns="http://www.w3.org/2000/svg" width="200" height="200"><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"/><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"/></svg></value>
|
<value><svg viewBox="0 0 1024 1024" xmlns="http://www.w3.org/2000/svg" width="200" height="200"><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"/></svg></value>
|
||||||
</data>
|
</data>
|
||||||
<data name="segmentedItem4.IconActiveSvg" xml:space="preserve">
|
<data name="segmentedItem4.IconActiveSvg" xml:space="preserve">
|
||||||
<value><svg viewBox="0 0 1024 1024" xmlns="http://www.w3.org/2000/svg" width="200" height="200"><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"/><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"/></svg></value>
|
<value><svg viewBox="0 0 1027 1024" xmlns="http://www.w3.org/2000/svg" width="200" height="200"><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"/><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"/></svg></value>
|
||||||
</data>
|
</data>
|
||||||
<data name="segmentedItem4.IconSvg" xml:space="preserve">
|
<data name="segmentedItem4.IconSvg" xml:space="preserve">
|
||||||
<value><svg viewBox="0 0 1024 1024" xmlns="http://www.w3.org/2000/svg" width="200" height="200"><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"/><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"/></svg></value>
|
<value><svg viewBox="0 0 1027 1024" xmlns="http://www.w3.org/2000/svg" width="200" height="200"><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"/><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"/></svg></value>
|
||||||
</data>
|
</data>
|
||||||
<data name="segmentedItem5.IconActiveSvg" xml:space="preserve">
|
<data name="segmentedItem5.IconActiveSvg" xml:space="preserve">
|
||||||
<value><svg viewBox="0 0 1027 1024" xmlns="http://www.w3.org/2000/svg" width="200" height="200"><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"/><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"/><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"/></svg></value>
|
<value><svg viewBox="0 0 1024 1024" xmlns="http://www.w3.org/2000/svg" width="200" height="200"><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"/><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"/></svg></value>
|
||||||
</data>
|
</data>
|
||||||
<data name="segmentedItem5.IconSvg" xml:space="preserve">
|
<data name="segmentedItem5.IconSvg" xml:space="preserve">
|
||||||
|
<value><svg viewBox="0 0 1024 1024" xmlns="http://www.w3.org/2000/svg" width="200" height="200"><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"/><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"/></svg></value>
|
||||||
|
</data>
|
||||||
|
<data name="segmentedItem6.IconActiveSvg" xml:space="preserve">
|
||||||
|
<value><svg viewBox="0 0 1027 1024" xmlns="http://www.w3.org/2000/svg" width="200" height="200"><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"/><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"/><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"/></svg></value>
|
||||||
|
</data>
|
||||||
|
<data name="segmentedItem6.IconSvg" xml:space="preserve">
|
||||||
<value><svg viewBox="0 0 1027 1024" xmlns="http://www.w3.org/2000/svg" width="200" height="200"><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"/><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"/><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"/></svg></value>
|
<value><svg viewBox="0 0 1027 1024" xmlns="http://www.w3.org/2000/svg" width="200" height="200"><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"/><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"/><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"/></svg></value>
|
||||||
</data>
|
</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" />
|
||||||
|
@ -1,63 +0,0 @@
|
|||||||
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; }
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,64 +0,0 @@
|
|||||||
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();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
30
DHSoftware/Views/AddCubicleControl.Designer.cs
generated
30
DHSoftware/Views/AddCubicleControl.Designer.cs
generated
@ -37,12 +37,16 @@
|
|||||||
button_ok = new AntdUI.Button();
|
button_ok = new AntdUI.Button();
|
||||||
divider2 = new AntdUI.Divider();
|
divider2 = new AntdUI.Divider();
|
||||||
lbTitleName = new AntdUI.Label();
|
lbTitleName = new AntdUI.Label();
|
||||||
|
sltdetectionType = new AntdUI.Select();
|
||||||
|
label1 = new AntdUI.Label();
|
||||||
panel1.SuspendLayout();
|
panel1.SuspendLayout();
|
||||||
stackPanel1.SuspendLayout();
|
stackPanel1.SuspendLayout();
|
||||||
SuspendLayout();
|
SuspendLayout();
|
||||||
//
|
//
|
||||||
// panel1
|
// panel1
|
||||||
//
|
//
|
||||||
|
panel1.Controls.Add(sltdetectionType);
|
||||||
|
panel1.Controls.Add(label1);
|
||||||
panel1.Controls.Add(input_name);
|
panel1.Controls.Add(input_name);
|
||||||
panel1.Controls.Add(label3);
|
panel1.Controls.Add(label3);
|
||||||
panel1.Controls.Add(divider1);
|
panel1.Controls.Add(divider1);
|
||||||
@ -54,7 +58,7 @@
|
|||||||
panel1.Name = "panel1";
|
panel1.Name = "panel1";
|
||||||
panel1.Padding = new Padding(12);
|
panel1.Padding = new Padding(12);
|
||||||
panel1.Shadow = 6;
|
panel1.Shadow = 6;
|
||||||
panel1.Size = new Size(500, 194);
|
panel1.Size = new Size(500, 243);
|
||||||
panel1.TabIndex = 0;
|
panel1.TabIndex = 0;
|
||||||
panel1.Text = "panel1";
|
panel1.Text = "panel1";
|
||||||
//
|
//
|
||||||
@ -137,11 +141,31 @@
|
|||||||
lbTitleName.TabIndex = 17;
|
lbTitleName.TabIndex = 17;
|
||||||
lbTitleName.Text = "新增工位操作";
|
lbTitleName.Text = "新增工位操作";
|
||||||
//
|
//
|
||||||
|
// sltdetectionType
|
||||||
|
//
|
||||||
|
sltdetectionType.Dock = DockStyle.Top;
|
||||||
|
sltdetectionType.Font = new Font("Microsoft YaHei UI", 9F, FontStyle.Regular, GraphicsUnit.Point, 134);
|
||||||
|
sltdetectionType.Location = new Point(18, 196);
|
||||||
|
sltdetectionType.Name = "sltdetectionType";
|
||||||
|
sltdetectionType.Radius = 3;
|
||||||
|
sltdetectionType.Size = new Size(464, 38);
|
||||||
|
sltdetectionType.TabIndex = 24;
|
||||||
|
//
|
||||||
|
// label1
|
||||||
|
//
|
||||||
|
label1.Dock = DockStyle.Top;
|
||||||
|
label1.Font = new Font("Microsoft YaHei UI", 12F, FontStyle.Regular, GraphicsUnit.Point, 134);
|
||||||
|
label1.Location = new Point(18, 172);
|
||||||
|
label1.Name = "label1";
|
||||||
|
label1.Size = new Size(464, 24);
|
||||||
|
label1.TabIndex = 23;
|
||||||
|
label1.Text = "检测类型";
|
||||||
|
//
|
||||||
// AddCubicleControl
|
// AddCubicleControl
|
||||||
//
|
//
|
||||||
Controls.Add(panel1);
|
Controls.Add(panel1);
|
||||||
Name = "AddCubicleControl";
|
Name = "AddCubicleControl";
|
||||||
Size = new Size(500, 194);
|
Size = new Size(500, 243);
|
||||||
panel1.ResumeLayout(false);
|
panel1.ResumeLayout(false);
|
||||||
stackPanel1.ResumeLayout(false);
|
stackPanel1.ResumeLayout(false);
|
||||||
ResumeLayout(false);
|
ResumeLayout(false);
|
||||||
@ -158,5 +182,7 @@
|
|||||||
private AntdUI.Button button_cancel;
|
private AntdUI.Button button_cancel;
|
||||||
private AntdUI.Button button_ok;
|
private AntdUI.Button button_ok;
|
||||||
private AntdUI.Divider divider2;
|
private AntdUI.Divider divider2;
|
||||||
|
private AntdUI.Select sltdetectionType;
|
||||||
|
private AntdUI.Label label1;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1,5 +1,7 @@
|
|||||||
|
|
||||||
|
|
||||||
|
using DH.Commons.Enums;
|
||||||
|
|
||||||
namespace DHSoftware.Views
|
namespace DHSoftware.Views
|
||||||
{
|
{
|
||||||
public partial class AddCubicleControl : UserControl
|
public partial class AddCubicleControl : UserControl
|
||||||
@ -7,11 +9,17 @@ namespace DHSoftware.Views
|
|||||||
private AntdUI.Window window;
|
private AntdUI.Window window;
|
||||||
public bool submit;
|
public bool submit;
|
||||||
public string CubicleName;
|
public string CubicleName;
|
||||||
|
public EnumDetectionType DetectionType;
|
||||||
public AddCubicleControl(AntdUI.Window _window,string TitleName)
|
public AddCubicleControl(AntdUI.Window _window,string TitleName)
|
||||||
{
|
{
|
||||||
this.window = _window;
|
this.window = _window;
|
||||||
InitializeComponent();
|
InitializeComponent();
|
||||||
lbTitleName.Text = TitleName;
|
lbTitleName.Text = TitleName;
|
||||||
|
sltdetectionType.Items.Clear();
|
||||||
|
foreach (EnumDetectionType value in Enum.GetValues(typeof(EnumDetectionType)))
|
||||||
|
{
|
||||||
|
sltdetectionType.Items.Add(value.ToString());
|
||||||
|
}
|
||||||
// 绑定事件
|
// 绑定事件
|
||||||
BindEventHandler();
|
BindEventHandler();
|
||||||
}
|
}
|
||||||
@ -38,7 +46,14 @@ namespace DHSoftware.Views
|
|||||||
AntdUI.Message.warn(window, "工位名称不能为空!", autoClose: 3);
|
AntdUI.Message.warn(window, "工位名称不能为空!", autoClose: 3);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
CubicleName=input_name.Text;
|
if (String.IsNullOrEmpty(sltdetectionType.Text))
|
||||||
|
{
|
||||||
|
input_name.Status = AntdUI.TType.Error;
|
||||||
|
AntdUI.Message.warn(window, "请选择检测类型!", autoClose: 3);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
CubicleName =input_name.Text;
|
||||||
|
DetectionType = (EnumDetectionType)sltdetectionType.SelectedIndex;
|
||||||
submit = true;
|
submit = true;
|
||||||
this.Dispose();
|
this.Dispose();
|
||||||
}
|
}
|
||||||
|
2
DHSoftware/Views/FrmLog.Designer.cs
generated
2
DHSoftware/Views/FrmLog.Designer.cs
generated
@ -87,7 +87,7 @@
|
|||||||
this.tsmiClearLog2.Name = "tsmiClearLog2";
|
this.tsmiClearLog2.Name = "tsmiClearLog2";
|
||||||
this.tsmiClearLog2.Size = new System.Drawing.Size(68, 21);
|
this.tsmiClearLog2.Size = new System.Drawing.Size(68, 21);
|
||||||
this.tsmiClearLog2.Text = "清空日志";
|
this.tsmiClearLog2.Text = "清空日志";
|
||||||
this.tsmiClearLog2.Click += new System.EventHandler(this.tsmiClearLog2_Click);
|
// this.tsmiClearLog2.Click += new System.EventHandler(this.tsmiClearLog2_Click);
|
||||||
//
|
//
|
||||||
// lvLog
|
// lvLog
|
||||||
//
|
//
|
||||||
|
@ -11,226 +11,534 @@ using System.Threading.Tasks;
|
|||||||
using System.Windows.Forms;
|
using System.Windows.Forms;
|
||||||
using static DH.Commons.Enums.EnumHelper;
|
using static DH.Commons.Enums.EnumHelper;
|
||||||
using DH.Commons.Enums;
|
using DH.Commons.Enums;
|
||||||
|
using System.ComponentModel;
|
||||||
|
using System.Reflection;
|
||||||
|
|
||||||
|
|
||||||
namespace DHSoftware.Views
|
namespace DHSoftware.Views
|
||||||
{
|
{
|
||||||
|
|
||||||
public partial class FrmLog : UserControl
|
public partial class FrmLog : UserControl
|
||||||
{
|
{
|
||||||
|
#region Win32 API双缓冲处理
|
||||||
|
private const int LVM_SETEXTENDEDLISTVIEWSTYLE = 0x1036;
|
||||||
|
private const int LVS_EX_DOUBLEBUFFER = 0x00010000;
|
||||||
|
|
||||||
|
[System.Runtime.InteropServices.DllImport("user32.dll")]
|
||||||
|
private static extern int SendMessage(IntPtr hWnd, int wMsg, int wParam, int lParam);
|
||||||
|
#endregion
|
||||||
|
|
||||||
|
#region 常量配置
|
||||||
|
private const string SOURCE_PROCESS = "流程";
|
||||||
|
private const int LOG_NUM_LIMIT = 2000;
|
||||||
|
private const int BATCH_SIZE = 50;
|
||||||
|
private const int PROCESS_INTERVAL = 100;
|
||||||
|
private const int FIRST_COL_WIDTH = 120;
|
||||||
|
#endregion
|
||||||
|
|
||||||
|
#region 控件状态
|
||||||
|
private readonly ConcurrentQueue<LogMsg> _logQueue = new ConcurrentQueue<LogMsg>();
|
||||||
|
private List<LogMsg> _logBuffer = new List<LogMsg>();
|
||||||
|
private List<LogLevel> _showLevels = new List<LogLevel>();
|
||||||
|
private List<string> _showSources = new List<string>();
|
||||||
|
private Task _logTask;
|
||||||
|
private static readonly object _logLock = new object();
|
||||||
|
#endregion
|
||||||
|
|
||||||
public FrmLog()
|
public FrmLog()
|
||||||
{
|
{
|
||||||
InitializeComponent();
|
InitializeComponent();
|
||||||
|
InitializeCustomComponents();
|
||||||
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()
|
private void InitializeCustomComponents()
|
||||||
//{
|
{
|
||||||
|
// 启用双缓冲
|
||||||
|
SendMessage(lvLog.Handle, LVM_SETEXTENDEDLISTVIEWSTYLE,
|
||||||
|
LVS_EX_DOUBLEBUFFER, LVS_EX_DOUBLEBUFFER);
|
||||||
|
|
||||||
// Invoke(new Action(() =>
|
lvLog.ShowItemToolTips = true;
|
||||||
// {
|
lvLog.FullRowSelect = true;
|
||||||
// _showDevice.Clear();
|
lvLog.View = View.Details;
|
||||||
// tsmiLogSources.DropDownItems.Clear();
|
// 启用自定义绘制
|
||||||
// ToolStripMenuItem processItem = new ToolStripMenuItem(SOURCE_PROCESS);
|
//lvLog.OwnerDraw = true;
|
||||||
// processItem.CheckOnClick = true;
|
//lvLog.DrawColumnHeader += LvLog_DrawColumnHeader;
|
||||||
// processItem.Checked = true;
|
//lvLog.DrawSubItem += LvLog_DrawSubItem;
|
||||||
// processItem.CheckedChanged += SourceItem_CheckedChanged;
|
//lvLog.DrawItem += LvLog_DrawItem;
|
||||||
// tsmiLogSources.DropDownItems.Add(processItem);
|
|
||||||
// _showDevice.Add(SOURCE_PROCESS);
|
|
||||||
|
|
||||||
// Process.DeviceCollection.ForEach(d =>
|
// 初始化列头
|
||||||
// {
|
lvLog.Columns.Add("时间", FIRST_COL_WIDTH);
|
||||||
// ToolStripMenuItem item = new ToolStripMenuItem(d.Name);
|
lvLog.Columns.Add("来源", 150);
|
||||||
// item.CheckOnClick = true;
|
lvLog.Columns.Add("内容", 400);
|
||||||
// item.Checked = true;
|
|
||||||
// item.CheckedChanged += SourceItem_CheckedChanged;
|
|
||||||
// tsmiLogSources.DropDownItems.Add(item);
|
|
||||||
// _showDevice.Add(d.Name);
|
|
||||||
// });
|
|
||||||
// }));
|
|
||||||
//}
|
|
||||||
|
|
||||||
private void LevelItem_CheckedChanged(object sender, EventArgs e)
|
InitializeLevelFilter();
|
||||||
|
StartProcessingTask();
|
||||||
|
}
|
||||||
|
|
||||||
|
private void InitializeLevelFilter()
|
||||||
{
|
{
|
||||||
_showLevels.Clear();
|
_showLevels.Clear();
|
||||||
foreach (ToolStripMenuItem item in tsmiLogLevels.DropDownItems)
|
tsmiLogLevels.DropDownItems.Clear();
|
||||||
|
|
||||||
|
foreach (LogLevel level in Enum.GetValues(typeof(LogLevel)))
|
||||||
{
|
{
|
||||||
if (item.Checked)
|
var item = new ToolStripMenuItem(level.GetEnumDescription())
|
||||||
{
|
{
|
||||||
LogLevel lv = (LogLevel)Convert.ToInt32(item.Tag);
|
CheckOnClick = true,
|
||||||
_showLevels.Add(lv);
|
Checked = true,
|
||||||
|
Tag = level,
|
||||||
|
BackColor = level.GetEnumSelectedColor(),
|
||||||
|
ForeColor = level.GetEnumSelectedFontColor()
|
||||||
|
};
|
||||||
|
item.CheckedChanged += LevelItem_CheckedChanged;
|
||||||
|
tsmiLogLevels.DropDownItems.Add(item);
|
||||||
|
_showLevels.Add(level);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
#region 自定义绘制方法
|
||||||
|
private void LvLog_DrawColumnHeader(object sender, DrawListViewColumnHeaderEventArgs e)
|
||||||
|
{
|
||||||
|
e.DrawDefault = true;
|
||||||
|
}
|
||||||
|
|
||||||
|
private void LvLog_DrawSubItem(object sender, DrawListViewSubItemEventArgs e)
|
||||||
|
{
|
||||||
|
var item = e.Item;
|
||||||
|
var log = item.Tag as LogMsg;
|
||||||
|
|
||||||
|
// 设置背景色
|
||||||
|
e.Graphics.FillRectangle(new SolidBrush(log.LogLevel.GetEnumSelectedColor()), e.Bounds);
|
||||||
|
|
||||||
|
// 设置文字颜色
|
||||||
|
TextRenderer.DrawText(e.Graphics, e.SubItem.Text, lvLog.Font,
|
||||||
|
e.Bounds, log.LogLevel.GetEnumSelectedFontColor(), TextFormatFlags.Left);
|
||||||
|
}
|
||||||
|
//private ListViewItem CreateLogItem(LogMsg log)
|
||||||
|
//{
|
||||||
|
// var item = new ListViewItem(log.LogTime.ToString("HH:mm:ss.fff"));
|
||||||
|
// item.SubItems.Add(FormatSource(log));
|
||||||
|
// item.SubItems.Add(log.Msg);
|
||||||
|
// item.Tag = log; // 重要:将日志对象绑定到Tag
|
||||||
|
// return item;
|
||||||
|
//}
|
||||||
|
private void LvLog_DrawItem(object sender, DrawListViewItemEventArgs e)
|
||||||
|
{
|
||||||
|
e.DrawDefault = false; // 禁用默认绘制
|
||||||
|
}
|
||||||
|
#endregion
|
||||||
|
private void StartProcessingTask()
|
||||||
|
{
|
||||||
|
lock (_logLock)
|
||||||
|
{
|
||||||
|
if (_logTask == null || _logTask.IsCompleted)
|
||||||
|
{
|
||||||
|
_logTask = Task.Run(ProcessLogs);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private async Task ProcessLogs()
|
||||||
|
{
|
||||||
|
while (!IsDisposed)
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
await Task.Delay(PROCESS_INTERVAL);
|
||||||
|
ProcessBatch(BATCH_SIZE);
|
||||||
|
}
|
||||||
|
catch (Exception ex)
|
||||||
|
{
|
||||||
|
DebugWrite($"日志处理异常: {ex.Message}");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private void ProcessBatch(int batchSize)
|
||||||
|
{
|
||||||
|
if (InvokeRequired)
|
||||||
|
{
|
||||||
|
BeginInvoke(new Action(() => ProcessBatch(batchSize)));
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
lvLog.BeginUpdate();
|
||||||
|
try
|
||||||
|
{
|
||||||
|
var items = new List<ListViewItem>();
|
||||||
|
int processed = 0;
|
||||||
|
|
||||||
|
while (processed < batchSize && _logQueue.TryDequeue(out var log))
|
||||||
|
{
|
||||||
|
_logBuffer.Add(log);
|
||||||
|
if (ShouldShow(log))
|
||||||
|
{
|
||||||
|
items.Add(CreateLogItem(log));
|
||||||
|
processed++;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (items.Count > 0)
|
||||||
|
{
|
||||||
|
lvLog.Items.AddRange(items.ToArray());
|
||||||
|
MaintainBuffer();
|
||||||
|
AutoScrollIfNeeded();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
finally
|
||||||
|
{
|
||||||
|
lvLog.EndUpdate();
|
||||||
|
UpdateLayout();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private bool ShouldShow(LogMsg log)
|
||||||
|
{
|
||||||
|
return _showLevels.Contains(log.LogLevel) &&
|
||||||
|
(_showSources.Count == 0 ||
|
||||||
|
(string.IsNullOrEmpty(log.MsgSource) ?
|
||||||
|
_showSources.Contains(SOURCE_PROCESS) :
|
||||||
|
_showSources.Contains(log.MsgSource)));
|
||||||
|
}
|
||||||
|
|
||||||
|
private ListViewItem CreateLogItem(LogMsg log)
|
||||||
|
{
|
||||||
|
var item = new ListViewItem(log.LogTime.ToString("HH:mm:ss.fff"));
|
||||||
|
item.SubItems.Add(FormatSource(log));
|
||||||
|
item.SubItems.Add(log.Msg);
|
||||||
|
item.ToolTipText = log.Msg;
|
||||||
|
item.BackColor = log.LogLevel.GetEnumSelectedColor();
|
||||||
|
item.ForeColor = log.LogLevel.GetEnumSelectedFontColor();
|
||||||
|
return item;
|
||||||
|
}
|
||||||
|
|
||||||
|
private string FormatSource(LogMsg log)
|
||||||
|
{
|
||||||
|
return string.IsNullOrEmpty(log.MsgSource) ?
|
||||||
|
SOURCE_PROCESS :
|
||||||
|
$"{log.MsgSource}[{log.ThreadId}]";
|
||||||
|
}
|
||||||
|
|
||||||
|
private void MaintainBuffer()
|
||||||
|
{
|
||||||
|
if (_logBuffer.Count > LOG_NUM_LIMIT * 2)
|
||||||
|
{
|
||||||
|
_logBuffer = _logBuffer
|
||||||
|
.Skip(_logBuffer.Count - LOG_NUM_LIMIT)
|
||||||
|
.ToList();
|
||||||
|
RefreshLogs();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public void AddLog(LogMsg log)
|
||||||
|
{
|
||||||
|
_logQueue.Enqueue(log);
|
||||||
|
}
|
||||||
|
|
||||||
|
private void RefreshLogs()
|
||||||
|
{
|
||||||
|
lvLog.BeginUpdate();
|
||||||
|
try
|
||||||
|
{
|
||||||
|
lvLog.Items.Clear();
|
||||||
|
var items = _logBuffer
|
||||||
|
.Where(ShouldShow)
|
||||||
|
.Select(CreateLogItem);
|
||||||
|
lvLog.Items.AddRange(items.ToArray());
|
||||||
|
}
|
||||||
|
finally
|
||||||
|
{
|
||||||
|
lvLog.EndUpdate();
|
||||||
|
UpdateLayout();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private void AutoScrollIfNeeded()
|
||||||
|
{
|
||||||
|
if (lvLog.Items.Count > 0 /*&& chkAutoScroll.Checked*/)
|
||||||
|
{
|
||||||
|
lvLog.EnsureVisible(lvLog.Items.Count - 1);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private void UpdateLayout()
|
||||||
|
{
|
||||||
|
if (lvLog.Columns.Count < 3) return;
|
||||||
|
|
||||||
|
// 动态调整列宽
|
||||||
|
lvLog.Columns[0].Width = FIRST_COL_WIDTH;
|
||||||
|
lvLog.Columns[1].Width = lvLog.Width > 600 ? 150 : 0;
|
||||||
|
lvLog.Columns[2].Width = lvLog.ClientSize.Width -
|
||||||
|
lvLog.Columns[0].Width -
|
||||||
|
lvLog.Columns[1].Width -
|
||||||
|
SystemInformation.VerticalScrollBarWidth;
|
||||||
|
}
|
||||||
|
|
||||||
|
#region 事件处理
|
||||||
|
private void LevelItem_CheckedChanged(object sender, EventArgs e)
|
||||||
|
{
|
||||||
|
_showLevels = tsmiLogLevels.DropDownItems
|
||||||
|
.Cast<ToolStripMenuItem>()
|
||||||
|
.Where(i => i.Checked)
|
||||||
|
.Select(i => (LogLevel)i.Tag)
|
||||||
|
.ToList();
|
||||||
|
|
||||||
RefreshLogs();
|
RefreshLogs();
|
||||||
}
|
}
|
||||||
|
|
||||||
private void SourceItem_CheckedChanged(object sender, EventArgs e)
|
private void SourceItem_CheckedChanged(object sender, EventArgs e)
|
||||||
{
|
{
|
||||||
_showDevice.Clear();
|
_showSources = tsmiLogSources.DropDownItems
|
||||||
foreach (ToolStripMenuItem item in tsmiLogSources.DropDownItems)
|
.Cast<ToolStripMenuItem>()
|
||||||
{
|
.Where(i => i.Checked)
|
||||||
if (item.Checked)
|
.Select(i => i.Text)
|
||||||
{
|
.ToList();
|
||||||
_showDevice.Add(item.Text);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
RefreshLogs();
|
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)
|
private void tsmiClearLog_Click(object sender, EventArgs e)
|
||||||
{
|
{
|
||||||
lvLog.Items.Clear();
|
lvLog.Items.Clear();
|
||||||
|
_logBuffer.Clear();
|
||||||
}
|
}
|
||||||
|
|
||||||
private void tsmiClearLog2_Click(object sender, EventArgs e)
|
private void lvLog_SizeChanged(object sender, EventArgs e)
|
||||||
{
|
{
|
||||||
lvLog.Items.Clear();
|
UpdateLayout();
|
||||||
}
|
}
|
||||||
|
#endregion
|
||||||
|
|
||||||
|
#region 辅助方法
|
||||||
|
private void DebugWrite(string message)
|
||||||
|
{
|
||||||
|
System.Diagnostics.Debug.WriteLine($"[{DateTime.Now:HH:mm:ss.fff}] {message}");
|
||||||
|
}
|
||||||
|
#endregion
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
//public partial class FrmLog1 : UserControl
|
||||||
|
//{
|
||||||
|
// // 添加双缓冲字段
|
||||||
|
// private const int LVM_SETEXTENDEDLISTVIEWSTYLE = 0x1036;
|
||||||
|
// private const int LVS_EX_DOUBLEBUFFER = 0x00010000;
|
||||||
|
|
||||||
|
// [System.Runtime.InteropServices.DllImport("user32.dll")]
|
||||||
|
// private static extern int SendMessage(IntPtr hWnd, int wMsg, int wParam, int lParam);
|
||||||
|
|
||||||
|
// public FrmLog()
|
||||||
|
// {
|
||||||
|
// InitializeComponent();
|
||||||
|
// // 启用双缓冲
|
||||||
|
// SendMessage(lvLog.Handle, LVM_SETEXTENDEDLISTVIEWSTYLE, LVS_EX_DOUBLEBUFFER, LVS_EX_DOUBLEBUFFER);
|
||||||
|
// 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();
|
||||||
|
// }
|
||||||
|
//}
|
||||||
}
|
}
|
||||||
|
28
DHSoftware/Views/ImageViewerControl.Designer.cs
generated
Normal file
28
DHSoftware/Views/ImageViewerControl.Designer.cs
generated
Normal file
@ -0,0 +1,28 @@
|
|||||||
|
namespace DHSoftware.Views
|
||||||
|
{
|
||||||
|
partial class ImageViewerControl
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// 必需的设计器变量。
|
||||||
|
/// </summary>
|
||||||
|
private System.ComponentModel.IContainer components = null;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 清理所有正在使用的资源。
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="disposing">如果应释放托管资源,为 true;否则为 false。</param>
|
||||||
|
|
||||||
|
#region 组件设计器生成的代码
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 设计器支持所需的方法 - 不要修改
|
||||||
|
/// 使用代码编辑器修改此方法的内容。
|
||||||
|
/// </summary>
|
||||||
|
private void InitializeComponent()
|
||||||
|
{
|
||||||
|
components = new System.ComponentModel.Container();
|
||||||
|
}
|
||||||
|
|
||||||
|
#endregion
|
||||||
|
}
|
||||||
|
}
|
346
DHSoftware/Views/ImageViewerControl.cs
Normal file
346
DHSoftware/Views/ImageViewerControl.cs
Normal file
@ -0,0 +1,346 @@
|
|||||||
|
using System;
|
||||||
|
using System.Drawing;
|
||||||
|
using System.Drawing.Drawing2D;
|
||||||
|
using System.Windows.Forms;
|
||||||
|
|
||||||
|
namespace DHSoftware.Views
|
||||||
|
{
|
||||||
|
public partial class ImageViewerControl : UserControl
|
||||||
|
{
|
||||||
|
#region 内部控件
|
||||||
|
private PictureBox pictureBox;
|
||||||
|
private Label statusLabel;
|
||||||
|
#endregion
|
||||||
|
|
||||||
|
#region 核心字段
|
||||||
|
private Bitmap _currentImage;
|
||||||
|
private float _scale = 1.0f;
|
||||||
|
private PointF _offset = PointF.Empty;
|
||||||
|
private Point _dragStart;
|
||||||
|
private bool _isDragging;
|
||||||
|
private readonly object _imageLock = new object();
|
||||||
|
#endregion
|
||||||
|
|
||||||
|
#region 公开属性
|
||||||
|
public Bitmap Image
|
||||||
|
{
|
||||||
|
get
|
||||||
|
{
|
||||||
|
lock (_imageLock)
|
||||||
|
{
|
||||||
|
return _currentImage?.Clone() as Bitmap;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
set
|
||||||
|
{
|
||||||
|
Bitmap newImage = value?.Clone() as Bitmap;
|
||||||
|
Bitmap oldImageToDispose = null;
|
||||||
|
|
||||||
|
lock (_imageLock)
|
||||||
|
{
|
||||||
|
// 交换图像引用
|
||||||
|
oldImageToDispose = _currentImage;
|
||||||
|
_currentImage = newImage;
|
||||||
|
|
||||||
|
if (_currentImage != null)
|
||||||
|
{
|
||||||
|
if (oldImageToDispose?.Size != _currentImage.Size)
|
||||||
|
{
|
||||||
|
AutoFit();
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
ClampOffset();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// 在锁外安全释放旧图像
|
||||||
|
if (oldImageToDispose != null)
|
||||||
|
{
|
||||||
|
// 使用BeginInvoke确保在UI线程释放资源
|
||||||
|
BeginInvoke(new Action(() =>
|
||||||
|
{
|
||||||
|
oldImageToDispose.Dispose();
|
||||||
|
oldImageToDispose = null;
|
||||||
|
}));
|
||||||
|
}
|
||||||
|
|
||||||
|
SafeInvalidate();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
#endregion
|
||||||
|
|
||||||
|
public ImageViewerControl()
|
||||||
|
{
|
||||||
|
InitializeComponents();
|
||||||
|
SetupDoubleBuffering();
|
||||||
|
}
|
||||||
|
|
||||||
|
#region 初始化
|
||||||
|
private void InitializeComponents()
|
||||||
|
{
|
||||||
|
pictureBox = new PictureBox
|
||||||
|
{
|
||||||
|
Dock = DockStyle.Fill,
|
||||||
|
BackColor = Color.DarkGray,
|
||||||
|
Cursor = Cursors.Hand
|
||||||
|
};
|
||||||
|
|
||||||
|
statusLabel = new Label
|
||||||
|
{
|
||||||
|
Dock = DockStyle.Bottom,
|
||||||
|
Height = 20,
|
||||||
|
Text = "就绪",
|
||||||
|
BorderStyle = BorderStyle.FixedSingle,
|
||||||
|
Font = new Font("Consolas", 10)
|
||||||
|
};
|
||||||
|
|
||||||
|
pictureBox.MouseDown += PictureBox_MouseDown;
|
||||||
|
pictureBox.MouseMove += PictureBox_MouseMove;
|
||||||
|
pictureBox.MouseUp += PictureBox_MouseUp;
|
||||||
|
pictureBox.MouseWheel += PictureBox_MouseWheel;
|
||||||
|
pictureBox.Paint += PictureBox_Paint;
|
||||||
|
|
||||||
|
Controls.Add(pictureBox);
|
||||||
|
Controls.Add(statusLabel);
|
||||||
|
}
|
||||||
|
|
||||||
|
private void SetupDoubleBuffering()
|
||||||
|
{
|
||||||
|
typeof(PictureBox).GetMethod("SetStyle",
|
||||||
|
System.Reflection.BindingFlags.NonPublic |
|
||||||
|
System.Reflection.BindingFlags.Instance)?
|
||||||
|
.Invoke(pictureBox, new object[] {
|
||||||
|
ControlStyles.OptimizedDoubleBuffer |
|
||||||
|
ControlStyles.AllPaintingInWmPaint,
|
||||||
|
true
|
||||||
|
});
|
||||||
|
}
|
||||||
|
#endregion
|
||||||
|
|
||||||
|
#region 核心功能
|
||||||
|
private void AutoFit()
|
||||||
|
{
|
||||||
|
lock (_imageLock)
|
||||||
|
{
|
||||||
|
if (_currentImage == null) return;
|
||||||
|
|
||||||
|
const float marginRatio = 0.1f;
|
||||||
|
float marginWidth = Width * marginRatio;
|
||||||
|
float marginHeight = Height * marginRatio;
|
||||||
|
|
||||||
|
_scale = Math.Min(
|
||||||
|
(Width - marginWidth * 2) / _currentImage.Width,
|
||||||
|
(Height - marginHeight * 2) / _currentImage.Height
|
||||||
|
);
|
||||||
|
|
||||||
|
_offset.X = marginWidth + (Width - marginWidth * 2 - _currentImage.Width * _scale) / 2;
|
||||||
|
_offset.Y = marginHeight + (Height - marginHeight * 2 - _currentImage.Height * _scale) / 2;
|
||||||
|
|
||||||
|
ClampOffset();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private void PictureBox_Paint(object sender, PaintEventArgs e)
|
||||||
|
{
|
||||||
|
Bitmap drawImage = null;
|
||||||
|
RectangleF destRect;
|
||||||
|
float scale;
|
||||||
|
PointF offset;
|
||||||
|
|
||||||
|
// 创建临时绘图参数
|
||||||
|
lock (_imageLock)
|
||||||
|
{
|
||||||
|
if (_currentImage == null) return;
|
||||||
|
|
||||||
|
// 创建绘图副本
|
||||||
|
drawImage = _currentImage.Clone() as Bitmap;
|
||||||
|
scale = _scale;
|
||||||
|
offset = _offset;
|
||||||
|
|
||||||
|
destRect = new RectangleF(
|
||||||
|
offset.X,
|
||||||
|
offset.Y,
|
||||||
|
drawImage.Width * scale,
|
||||||
|
drawImage.Height * scale);
|
||||||
|
}
|
||||||
|
|
||||||
|
try
|
||||||
|
{
|
||||||
|
e.Graphics.InterpolationMode = InterpolationMode.HighQualityBicubic;
|
||||||
|
e.Graphics.DrawImage(drawImage, destRect);
|
||||||
|
}
|
||||||
|
finally
|
||||||
|
{
|
||||||
|
drawImage?.Dispose();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
#endregion
|
||||||
|
|
||||||
|
#region 鼠标交互(左键拖动)
|
||||||
|
private void PictureBox_MouseDown(object sender, MouseEventArgs e)
|
||||||
|
{
|
||||||
|
if (InvokeRequired) return;
|
||||||
|
|
||||||
|
lock (_imageLock)
|
||||||
|
{
|
||||||
|
if (_currentImage == null) return;
|
||||||
|
|
||||||
|
if (e.Button == MouseButtons.Left)
|
||||||
|
{
|
||||||
|
_dragStart = e.Location;
|
||||||
|
_isDragging = true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private void PictureBox_MouseMove(object sender, MouseEventArgs e)
|
||||||
|
{
|
||||||
|
if (InvokeRequired) return;
|
||||||
|
|
||||||
|
lock (_imageLock)
|
||||||
|
{
|
||||||
|
if (_currentImage == null) return;
|
||||||
|
|
||||||
|
if (_isDragging)
|
||||||
|
{
|
||||||
|
_offset.X += e.X - _dragStart.X;
|
||||||
|
_offset.Y += e.Y - _dragStart.Y;
|
||||||
|
_dragStart = e.Location;
|
||||||
|
ClampOffset();
|
||||||
|
SafeInvalidate();
|
||||||
|
}
|
||||||
|
|
||||||
|
UpdateStatus(e.Location);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private void PictureBox_MouseUp(object sender, MouseEventArgs e)
|
||||||
|
{
|
||||||
|
lock (_imageLock)
|
||||||
|
{
|
||||||
|
_isDragging = false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private void PictureBox_MouseWheel(object sender, MouseEventArgs e)
|
||||||
|
{
|
||||||
|
if (InvokeRequired) return;
|
||||||
|
|
||||||
|
lock (_imageLock)
|
||||||
|
{
|
||||||
|
if (_currentImage == null) return;
|
||||||
|
|
||||||
|
PointF imgPos = ConvertToImageCoords(e.Location);
|
||||||
|
if (imgPos.X < 0 || imgPos.X > _currentImage.Width ||
|
||||||
|
imgPos.Y < 0 || imgPos.Y > _currentImage.Height)
|
||||||
|
return;
|
||||||
|
|
||||||
|
float zoom = e.Delta > 0 ? 1.1f : 0.9f;
|
||||||
|
float newScale = Math.Clamp(_scale * zoom, 0.1f, 10f);
|
||||||
|
|
||||||
|
_offset.X = e.Location.X - imgPos.X * newScale;
|
||||||
|
_offset.Y = e.Location.Y - imgPos.Y * newScale;
|
||||||
|
|
||||||
|
_scale = newScale;
|
||||||
|
ClampOffset();
|
||||||
|
SafeInvalidate();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
#endregion
|
||||||
|
|
||||||
|
#region 辅助方法
|
||||||
|
private PointF ConvertToImageCoords(Point mousePos)
|
||||||
|
{
|
||||||
|
lock (_imageLock)
|
||||||
|
{
|
||||||
|
if (_currentImage == null) return PointF.Empty;
|
||||||
|
return new PointF(
|
||||||
|
(mousePos.X - _offset.X) / _scale,
|
||||||
|
(mousePos.Y - _offset.Y) / _scale);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private void ClampOffset()
|
||||||
|
{
|
||||||
|
lock (_imageLock)
|
||||||
|
{
|
||||||
|
if (_currentImage == null) return;
|
||||||
|
|
||||||
|
float imgWidth = _currentImage.Width * _scale;
|
||||||
|
float imgHeight = _currentImage.Height * _scale;
|
||||||
|
|
||||||
|
_offset.X = Math.Clamp(_offset.X,
|
||||||
|
imgWidth > Width ? Width - imgWidth : 0,
|
||||||
|
imgWidth > Width ? 0 : Width - imgWidth);
|
||||||
|
|
||||||
|
_offset.Y = Math.Clamp(_offset.Y,
|
||||||
|
imgHeight > Height ? Height - imgHeight : 0,
|
||||||
|
imgHeight > Height ? 0 : Height - imgHeight);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private void UpdateStatus(Point mousePos)
|
||||||
|
{
|
||||||
|
if (InvokeRequired)
|
||||||
|
{
|
||||||
|
BeginInvoke(new Action<Point>(UpdateStatus), mousePos);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
lock (_imageLock)
|
||||||
|
{
|
||||||
|
if (_currentImage == null)
|
||||||
|
{
|
||||||
|
statusLabel.Text = "无有效图像";
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
PointF imgPos = ConvertToImageCoords(mousePos);
|
||||||
|
bool inImage = imgPos.X >= 0 && imgPos.X <= _currentImage.Width &&
|
||||||
|
imgPos.Y >= 0 && imgPos.Y <= _currentImage.Height;
|
||||||
|
|
||||||
|
statusLabel.Text = inImage ?
|
||||||
|
$"坐标: ({imgPos.X:F1}, {imgPos.Y:F1}) | 缩放: {_scale * 100:0}%" :
|
||||||
|
$"图像尺寸: {_currentImage.Width}x{_currentImage.Height} | 缩放: {_scale * 100:0}%";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private void SafeInvalidate()
|
||||||
|
{
|
||||||
|
if (InvokeRequired)
|
||||||
|
{
|
||||||
|
BeginInvoke(new Action(pictureBox.Invalidate));
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
pictureBox.Invalidate();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
#endregion
|
||||||
|
|
||||||
|
public Bitmap GetCurrentSnapshot()
|
||||||
|
{
|
||||||
|
lock (_imageLock)
|
||||||
|
{
|
||||||
|
// 返回深拷贝防止原始图像被修改
|
||||||
|
return _currentImage?.Clone() as Bitmap;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
protected override void Dispose(bool disposing)
|
||||||
|
{
|
||||||
|
if (disposing && (components != null))
|
||||||
|
{
|
||||||
|
components.Dispose();
|
||||||
|
}
|
||||||
|
lock (_imageLock)
|
||||||
|
{
|
||||||
|
_currentImage?.Dispose();
|
||||||
|
_currentImage = null;
|
||||||
|
}
|
||||||
|
base.Dispose(disposing);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
120
DHSoftware/Views/ImageViewerControl.resx
Normal file
120
DHSoftware/Views/ImageViewerControl.resx
Normal 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>
|
189
DHSoftware/Views/SavePositionControl.Designer.cs
generated
Normal file
189
DHSoftware/Views/SavePositionControl.Designer.cs
generated
Normal file
@ -0,0 +1,189 @@
|
|||||||
|
namespace DHSoftware.Views
|
||||||
|
{
|
||||||
|
partial class SavePositionControl
|
||||||
|
{
|
||||||
|
/// <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();
|
||||||
|
sltName = new AntdUI.Select();
|
||||||
|
label1 = new AntdUI.Label();
|
||||||
|
iptPosition = 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(sltName);
|
||||||
|
panel1.Controls.Add(label1);
|
||||||
|
panel1.Controls.Add(iptPosition);
|
||||||
|
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, 243);
|
||||||
|
panel1.TabIndex = 0;
|
||||||
|
panel1.Text = "panel1";
|
||||||
|
//
|
||||||
|
// sltName
|
||||||
|
//
|
||||||
|
sltName.Dock = DockStyle.Top;
|
||||||
|
sltName.Font = new Font("Microsoft YaHei UI", 9F, FontStyle.Regular, GraphicsUnit.Point, 134);
|
||||||
|
sltName.Location = new Point(18, 196);
|
||||||
|
sltName.MaxCount = 20;
|
||||||
|
sltName.Name = "sltName";
|
||||||
|
sltName.Radius = 3;
|
||||||
|
sltName.Size = new Size(464, 38);
|
||||||
|
sltName.TabIndex = 24;
|
||||||
|
//
|
||||||
|
// label1
|
||||||
|
//
|
||||||
|
label1.Dock = DockStyle.Top;
|
||||||
|
label1.Font = new Font("Microsoft YaHei UI", 12F, FontStyle.Regular, GraphicsUnit.Point, 134);
|
||||||
|
label1.Location = new Point(18, 172);
|
||||||
|
label1.Name = "label1";
|
||||||
|
label1.Size = new Size(464, 24);
|
||||||
|
label1.TabIndex = 23;
|
||||||
|
label1.Text = "工位名称";
|
||||||
|
//
|
||||||
|
// iptPosition
|
||||||
|
//
|
||||||
|
iptPosition.Dock = DockStyle.Top;
|
||||||
|
iptPosition.Font = new Font("Microsoft YaHei UI", 9F, FontStyle.Regular, GraphicsUnit.Point, 134);
|
||||||
|
iptPosition.Location = new Point(18, 134);
|
||||||
|
iptPosition.Name = "iptPosition";
|
||||||
|
iptPosition.Radius = 3;
|
||||||
|
iptPosition.Size = new Size(464, 38);
|
||||||
|
iptPosition.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 = "保存当前位置操作";
|
||||||
|
//
|
||||||
|
// SavePositionControl
|
||||||
|
//
|
||||||
|
Controls.Add(panel1);
|
||||||
|
Name = "SavePositionControl";
|
||||||
|
Size = new Size(500, 243);
|
||||||
|
panel1.ResumeLayout(false);
|
||||||
|
stackPanel1.ResumeLayout(false);
|
||||||
|
ResumeLayout(false);
|
||||||
|
}
|
||||||
|
|
||||||
|
#endregion
|
||||||
|
|
||||||
|
private AntdUI.Panel panel1;
|
||||||
|
private AntdUI.Label lbTitleName;
|
||||||
|
private AntdUI.Input iptPosition;
|
||||||
|
private AntdUI.Label label3;
|
||||||
|
private AntdUI.Divider divider1;
|
||||||
|
private AntdUI.StackPanel stackPanel1;
|
||||||
|
private AntdUI.Button button_cancel;
|
||||||
|
private AntdUI.Button button_ok;
|
||||||
|
private AntdUI.Divider divider2;
|
||||||
|
private AntdUI.Select sltName;
|
||||||
|
private AntdUI.Label label1;
|
||||||
|
}
|
||||||
|
}
|
116
DHSoftware/Views/SavePositionControl.cs
Normal file
116
DHSoftware/Views/SavePositionControl.cs
Normal file
@ -0,0 +1,116 @@
|
|||||||
|
|
||||||
|
|
||||||
|
using System.Text.RegularExpressions;
|
||||||
|
using DH.Commons.Base;
|
||||||
|
using DH.Commons.Enums;
|
||||||
|
using DH.Commons.Helper;
|
||||||
|
using DH.Commons.Models;
|
||||||
|
|
||||||
|
namespace DHSoftware.Views
|
||||||
|
{
|
||||||
|
public partial class SavePositionControl : UserControl
|
||||||
|
{
|
||||||
|
private AntdUI.Window window;
|
||||||
|
public bool submit;
|
||||||
|
public int Position;
|
||||||
|
|
||||||
|
|
||||||
|
public SavePositionControl(AntdUI.Window _window,int _position)
|
||||||
|
{
|
||||||
|
this.window = _window;
|
||||||
|
InitializeComponent();
|
||||||
|
Position=_position;
|
||||||
|
sltName.Items.Clear();
|
||||||
|
var targetFields = GetSpecificIOFields();
|
||||||
|
foreach(var item in targetFields)
|
||||||
|
{
|
||||||
|
sltName.Items.Add(item);
|
||||||
|
}
|
||||||
|
iptPosition.Text= Position.ToString();
|
||||||
|
// 绑定事件
|
||||||
|
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)
|
||||||
|
{
|
||||||
|
iptPosition.Status = AntdUI.TType.None;
|
||||||
|
|
||||||
|
if (String.IsNullOrEmpty(sltName.Text))
|
||||||
|
{
|
||||||
|
sltName.Status = AntdUI.TType.Error;
|
||||||
|
AntdUI.Message.warn(window, "请选择工位!", autoClose: 3);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
//根据工位查找点位
|
||||||
|
PLCItem? pLCItem = ConfigModel.PLCBaseList?
|
||||||
|
.FirstOrDefault()?
|
||||||
|
.PLCItemList?
|
||||||
|
.Where(it=>it.Name==sltName.Text).FirstOrDefault();
|
||||||
|
if (pLCItem == null)
|
||||||
|
{
|
||||||
|
AntdUI.Message.warn(window, $"未找到{sltName.Text}地址,请检查该地址是否存在于点位表!", autoClose: 3);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
PLCItem? pLCItem1 = ConfigModel.GlobalList?
|
||||||
|
.FirstOrDefault()?
|
||||||
|
.StartProcessList?
|
||||||
|
.Where(it=>it.Name ==sltName.Text).FirstOrDefault();
|
||||||
|
|
||||||
|
if (pLCItem1 == null)
|
||||||
|
{
|
||||||
|
pLCItem1=new PLCItem();
|
||||||
|
pLCItem1.Name = pLCItem.Name;
|
||||||
|
pLCItem1.Address = pLCItem.Address;
|
||||||
|
pLCItem1.Value = iptPosition.Text;
|
||||||
|
pLCItem1.Type = pLCItem.Type;
|
||||||
|
pLCItem1.StartExecute = true;
|
||||||
|
ConfigModel.GlobalList?
|
||||||
|
.FirstOrDefault()?
|
||||||
|
.StartProcessList?.Add(pLCItem1);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
pLCItem1.Value = iptPosition.Text;
|
||||||
|
}
|
||||||
|
|
||||||
|
ConfigHelper.SaveConfig();
|
||||||
|
AntdUI.Message.success(window, "保存成功!", autoClose: 3);
|
||||||
|
submit = true;
|
||||||
|
this.Dispose();
|
||||||
|
}
|
||||||
|
|
||||||
|
public static List<string> GetSpecificIOFields()
|
||||||
|
{
|
||||||
|
return Enum.GetNames(typeof(EnumPLCOutputIO))
|
||||||
|
.Where(name =>
|
||||||
|
Regex.IsMatch(name, @"^工位[1-9]|10$") || // 匹配工位1-10
|
||||||
|
name == "OK脉冲" ||
|
||||||
|
name == "NG脉冲")
|
||||||
|
.OrderBy(name =>
|
||||||
|
{
|
||||||
|
// 对工位进行数字排序
|
||||||
|
if (name.StartsWith("工位"))
|
||||||
|
{
|
||||||
|
return int.Parse(name.Substring(2));
|
||||||
|
}
|
||||||
|
return 99; // OK/NG放在最后
|
||||||
|
})
|
||||||
|
.ToList();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -1,7 +1,7 @@
|
|||||||
<?xml version="1.0" encoding="utf-8"?>
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
<root>
|
<root>
|
||||||
<!--
|
<!--
|
||||||
Microsoft ResX Schema
|
Microsoft ResX Schema
|
||||||
|
|
||||||
Version 2.0
|
Version 2.0
|
||||||
|
|
||||||
@ -48,7 +48,7 @@
|
|||||||
value : The object must be serialized with
|
value : The object must be serialized with
|
||||||
: System.Runtime.Serialization.Formatters.Binary.BinaryFormatter
|
: System.Runtime.Serialization.Formatters.Binary.BinaryFormatter
|
||||||
: and then encoded with base64 encoding.
|
: and then encoded with base64 encoding.
|
||||||
|
|
||||||
mimetype: application/x-microsoft.net.object.soap.base64
|
mimetype: application/x-microsoft.net.object.soap.base64
|
||||||
value : The object must be serialized with
|
value : The object must be serialized with
|
||||||
: System.Runtime.Serialization.Formatters.Soap.SoapFormatter
|
: System.Runtime.Serialization.Formatters.Soap.SoapFormatter
|
@ -112,12 +112,20 @@ namespace DHSoftware.Views
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
DetectionConfig? detectionConfig = ConfigModel.DetectionList.Where(c => c.Name == clickedItem.Text).FirstOrDefault();
|
DetectionConfig? detectionConfig = ConfigModel.DetectionList.Where(c => c.Name == clickedItem.Text).FirstOrDefault();
|
||||||
if (detectionConfig == null)
|
//if (detectionConfig == null)
|
||||||
{
|
//{
|
||||||
detectionConfig = new DetectionConfig();
|
// detectionConfig = new DetectionConfig();
|
||||||
}
|
//}
|
||||||
UserControl control1 = null;
|
UserControl control1 = null;
|
||||||
control1 = new DetectControl(this, detectionConfig);
|
if (DH.Commons.Enums.EnumDetectionType.深度学习==detectionConfig?.DetectionType)
|
||||||
|
{
|
||||||
|
control1 = new DetectControl(this, detectionConfig);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
control1=new SizeControl(this,detectionConfig);
|
||||||
|
}
|
||||||
|
|
||||||
if (control1 != null)
|
if (control1 != null)
|
||||||
{
|
{
|
||||||
//容器添加控件,需要调整dpi
|
//容器添加控件,需要调整dpi
|
||||||
@ -764,7 +772,7 @@ namespace DHSoftware.Views
|
|||||||
|
|
||||||
if (workstationItem1 != null)
|
if (workstationItem1 != null)
|
||||||
{
|
{
|
||||||
var form = new AddCubicleControl(this, "新增工位操作") { Size = new Size(300, 200) };
|
var form = new AddCubicleControl(this, "新增工位操作") { Size = new Size(300, 400) };
|
||||||
AntdUI.Modal.open(new AntdUI.Modal.Config(this, "", form, TType.None)
|
AntdUI.Modal.open(new AntdUI.Modal.Config(this, "", form, TType.None)
|
||||||
{
|
{
|
||||||
BtnHeight = 0,
|
BtnHeight = 0,
|
||||||
@ -779,6 +787,7 @@ namespace DHSoftware.Views
|
|||||||
workstationItem1.Sub.Add(newItem);
|
workstationItem1.Sub.Add(newItem);
|
||||||
DetectionConfig detection = new DetectionConfig();
|
DetectionConfig detection = new DetectionConfig();
|
||||||
detection.Name = form.CubicleName;
|
detection.Name = form.CubicleName;
|
||||||
|
detection.DetectionType = form.DetectionType;
|
||||||
ConfigModel.DetectionList.Add(detection);
|
ConfigModel.DetectionList.Add(detection);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
104
DHSoftware/Views/SizeConfigControl.Designer.cs
generated
104
DHSoftware/Views/SizeConfigControl.Designer.cs
generated
@ -1,104 +0,0 @@
|
|||||||
namespace DHSoftware.Views
|
|
||||||
{
|
|
||||||
partial class SizeConfigControl
|
|
||||||
{
|
|
||||||
/// <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()
|
|
||||||
{
|
|
||||||
panel2 = new Panel();
|
|
||||||
label2 = new Label();
|
|
||||||
btnDelSizeParm = new AntdUI.Button();
|
|
||||||
tbSizeParm = new AntdUI.Table();
|
|
||||||
btnAddSizeParm = new AntdUI.Button();
|
|
||||||
panel2.SuspendLayout();
|
|
||||||
SuspendLayout();
|
|
||||||
//
|
|
||||||
// panel2
|
|
||||||
//
|
|
||||||
panel2.Controls.Add(label2);
|
|
||||||
panel2.Controls.Add(btnDelSizeParm);
|
|
||||||
panel2.Controls.Add(tbSizeParm);
|
|
||||||
panel2.Controls.Add(btnAddSizeParm);
|
|
||||||
panel2.Location = new Point(3, 3);
|
|
||||||
panel2.Name = "panel2";
|
|
||||||
panel2.Size = new Size(779, 286);
|
|
||||||
panel2.TabIndex = 36;
|
|
||||||
//
|
|
||||||
// label2
|
|
||||||
//
|
|
||||||
label2.AutoSize = true;
|
|
||||||
label2.Location = new Point(3, 5);
|
|
||||||
label2.Name = "label2";
|
|
||||||
label2.Size = new Size(56, 17);
|
|
||||||
label2.TabIndex = 25;
|
|
||||||
label2.Text = "尺寸参数";
|
|
||||||
//
|
|
||||||
// btnDelSizeParm
|
|
||||||
//
|
|
||||||
btnDelSizeParm.Location = new Point(93, 25);
|
|
||||||
btnDelSizeParm.Name = "btnDelSizeParm";
|
|
||||||
btnDelSizeParm.Size = new Size(84, 34);
|
|
||||||
btnDelSizeParm.TabIndex = 24;
|
|
||||||
btnDelSizeParm.Text = "删除";
|
|
||||||
//
|
|
||||||
// tbSizeParm
|
|
||||||
//
|
|
||||||
tbSizeParm.Location = new Point(3, 65);
|
|
||||||
tbSizeParm.Name = "tbSizeParm";
|
|
||||||
tbSizeParm.Size = new Size(773, 218);
|
|
||||||
tbSizeParm.TabIndex = 22;
|
|
||||||
tbSizeParm.Text = "table1";
|
|
||||||
//
|
|
||||||
// btnAddSizeParm
|
|
||||||
//
|
|
||||||
btnAddSizeParm.Location = new Point(3, 25);
|
|
||||||
btnAddSizeParm.Name = "btnAddSizeParm";
|
|
||||||
btnAddSizeParm.Size = new Size(84, 34);
|
|
||||||
btnAddSizeParm.TabIndex = 23;
|
|
||||||
btnAddSizeParm.Text = "新增";
|
|
||||||
//
|
|
||||||
// SizeConfigControl
|
|
||||||
//
|
|
||||||
AutoScaleDimensions = new SizeF(7F, 17F);
|
|
||||||
AutoScaleMode = AutoScaleMode.Font;
|
|
||||||
BorderStyle = BorderStyle.FixedSingle;
|
|
||||||
Controls.Add(panel2);
|
|
||||||
Name = "SizeConfigControl";
|
|
||||||
Size = new Size(783, 290);
|
|
||||||
panel2.ResumeLayout(false);
|
|
||||||
panel2.PerformLayout();
|
|
||||||
ResumeLayout(false);
|
|
||||||
}
|
|
||||||
|
|
||||||
#endregion
|
|
||||||
|
|
||||||
private Panel panel2;
|
|
||||||
private Label label2;
|
|
||||||
private AntdUI.Button btnDelSizeParm;
|
|
||||||
private AntdUI.Table tbSizeParm;
|
|
||||||
private AntdUI.Button btnAddSizeParm;
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,20 +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;
|
|
||||||
|
|
||||||
namespace DHSoftware.Views
|
|
||||||
{
|
|
||||||
public partial class SizeConfigControl : UserControl
|
|
||||||
{
|
|
||||||
public SizeConfigControl()
|
|
||||||
{
|
|
||||||
InitializeComponent();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
151
DHSoftware/Views/SizeControl.Designer.cs
generated
Normal file
151
DHSoftware/Views/SizeControl.Designer.cs
generated
Normal file
@ -0,0 +1,151 @@
|
|||||||
|
namespace DHSoftware.Views
|
||||||
|
{
|
||||||
|
partial class SizeControl
|
||||||
|
{
|
||||||
|
/// <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()
|
||||||
|
{
|
||||||
|
AntdUI.Tabs.StyleLine styleLine1 = new AntdUI.Tabs.StyleLine();
|
||||||
|
System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(SizeControl));
|
||||||
|
tabPage3 = new AntdUI.TabPage();
|
||||||
|
tabPage4 = new AntdUI.TabPage();
|
||||||
|
tabs1 = new AntdUI.Tabs();
|
||||||
|
panel1 = new AntdUI.Panel();
|
||||||
|
btnSizeDel = new AntdUI.Button();
|
||||||
|
btnSizeAdd = new AntdUI.Button();
|
||||||
|
SizeTable = new AntdUI.Table();
|
||||||
|
tabPage3.SuspendLayout();
|
||||||
|
tabPage4.SuspendLayout();
|
||||||
|
tabs1.SuspendLayout();
|
||||||
|
panel1.SuspendLayout();
|
||||||
|
SuspendLayout();
|
||||||
|
//
|
||||||
|
// tabPage3
|
||||||
|
//
|
||||||
|
tabPage3.Controls.Add(tabPage4);
|
||||||
|
tabPage3.Location = new Point(3, 31);
|
||||||
|
tabPage3.Name = "tabPage3";
|
||||||
|
tabPage3.Size = new Size(909, 575);
|
||||||
|
tabPage3.TabIndex = 3;
|
||||||
|
tabPage3.Text = "尺寸测量";
|
||||||
|
//
|
||||||
|
// tabPage4
|
||||||
|
//
|
||||||
|
tabPage4.Controls.Add(SizeTable);
|
||||||
|
tabPage4.Controls.Add(panel1);
|
||||||
|
tabPage4.Location = new Point(8, 8);
|
||||||
|
tabPage4.Name = "tabPage4";
|
||||||
|
tabPage4.Size = new Size(909, 575);
|
||||||
|
tabPage4.TabIndex = 1;
|
||||||
|
tabPage4.Text = "预处理";
|
||||||
|
//
|
||||||
|
// tabs1
|
||||||
|
//
|
||||||
|
tabs1.Centered = true;
|
||||||
|
tabs1.Dock = DockStyle.Fill;
|
||||||
|
tabs1.Font = new Font("Microsoft YaHei UI", 10.5F, FontStyle.Regular, GraphicsUnit.Point, 134);
|
||||||
|
tabs1.Location = new Point(0, 0);
|
||||||
|
tabs1.Name = "tabs1";
|
||||||
|
tabs1.Pages.Add(tabPage3);
|
||||||
|
tabs1.Size = new Size(915, 609);
|
||||||
|
tabs1.Style = styleLine1;
|
||||||
|
tabs1.TabIndex = 1;
|
||||||
|
tabs1.Text = "tabs1";
|
||||||
|
//
|
||||||
|
// panel1
|
||||||
|
//
|
||||||
|
panel1.Controls.Add(btnSizeDel);
|
||||||
|
panel1.Controls.Add(btnSizeAdd);
|
||||||
|
panel1.Dock = DockStyle.Top;
|
||||||
|
panel1.Location = new Point(0, 0);
|
||||||
|
panel1.Name = "panel1";
|
||||||
|
panel1.Size = new Size(909, 42);
|
||||||
|
panel1.TabIndex = 9;
|
||||||
|
panel1.Text = "panel1";
|
||||||
|
//
|
||||||
|
// btnSizeDel
|
||||||
|
//
|
||||||
|
btnSizeDel.BorderWidth = 2F;
|
||||||
|
btnSizeDel.Dock = DockStyle.Left;
|
||||||
|
btnSizeDel.Font = new Font("Microsoft YaHei UI", 9F, FontStyle.Regular, GraphicsUnit.Point, 134);
|
||||||
|
btnSizeDel.Ghost = true;
|
||||||
|
btnSizeDel.IconRatio = 0.8F;
|
||||||
|
btnSizeDel.IconSvg = resources.GetString("btnSizeDel.IconSvg");
|
||||||
|
btnSizeDel.Location = new Point(80, 0);
|
||||||
|
btnSizeDel.Name = "btnSizeDel";
|
||||||
|
btnSizeDel.Size = new Size(80, 42);
|
||||||
|
btnSizeDel.TabIndex = 12;
|
||||||
|
btnSizeDel.Text = "删除";
|
||||||
|
//
|
||||||
|
// btnSizeAdd
|
||||||
|
//
|
||||||
|
btnSizeAdd.BorderWidth = 2F;
|
||||||
|
btnSizeAdd.Dock = DockStyle.Left;
|
||||||
|
btnSizeAdd.Font = new Font("Microsoft YaHei UI", 9F, FontStyle.Regular, GraphicsUnit.Point, 134);
|
||||||
|
btnSizeAdd.Ghost = true;
|
||||||
|
btnSizeAdd.IconRatio = 0.8F;
|
||||||
|
btnSizeAdd.IconSvg = resources.GetString("btnSizeAdd.IconSvg");
|
||||||
|
btnSizeAdd.Location = new Point(0, 0);
|
||||||
|
btnSizeAdd.Name = "btnSizeAdd";
|
||||||
|
btnSizeAdd.Size = new Size(80, 42);
|
||||||
|
btnSizeAdd.TabIndex = 11;
|
||||||
|
btnSizeAdd.Text = "新增";
|
||||||
|
//
|
||||||
|
// SizeTable
|
||||||
|
//
|
||||||
|
SizeTable.Dock = DockStyle.Fill;
|
||||||
|
SizeTable.EmptyHeader = true;
|
||||||
|
SizeTable.Location = new Point(0, 42);
|
||||||
|
SizeTable.Name = "SizeTable";
|
||||||
|
SizeTable.Size = new Size(909, 533);
|
||||||
|
SizeTable.TabIndex = 10;
|
||||||
|
SizeTable.Text = "table1";
|
||||||
|
//
|
||||||
|
// SizeControl
|
||||||
|
//
|
||||||
|
AutoScaleDimensions = new SizeF(7F, 17F);
|
||||||
|
AutoScaleMode = AutoScaleMode.Font;
|
||||||
|
Controls.Add(tabs1);
|
||||||
|
Name = "SizeControl";
|
||||||
|
Size = new Size(915, 609);
|
||||||
|
tabPage3.ResumeLayout(false);
|
||||||
|
tabPage4.ResumeLayout(false);
|
||||||
|
tabs1.ResumeLayout(false);
|
||||||
|
panel1.ResumeLayout(false);
|
||||||
|
ResumeLayout(false);
|
||||||
|
}
|
||||||
|
|
||||||
|
#endregion
|
||||||
|
|
||||||
|
private AntdUI.TabPage tabPage3;
|
||||||
|
private AntdUI.TabPage tabPage4;
|
||||||
|
private AntdUI.Tabs tabs1;
|
||||||
|
private AntdUI.Table SizeTable;
|
||||||
|
private AntdUI.Panel panel1;
|
||||||
|
private AntdUI.Button btnSizeDel;
|
||||||
|
private AntdUI.Button btnSizeAdd;
|
||||||
|
}
|
||||||
|
}
|
223
DHSoftware/Views/SizeControl.cs
Normal file
223
DHSoftware/Views/SizeControl.cs
Normal file
@ -0,0 +1,223 @@
|
|||||||
|
using System.ComponentModel;
|
||||||
|
using System.Data;
|
||||||
|
using System.Reflection;
|
||||||
|
using AntdUI;
|
||||||
|
using DH.Commons.Base;
|
||||||
|
using DH.Commons.Enums;
|
||||||
|
using DH.Devices.PLC;
|
||||||
|
using XKRS.CanFly;
|
||||||
|
using static System.Windows.Forms.AxHost;
|
||||||
|
using static DH.Commons.Enums.EnumHelper;
|
||||||
|
|
||||||
|
namespace DHSoftware.Views
|
||||||
|
{
|
||||||
|
public partial class SizeControl : UserControl
|
||||||
|
{
|
||||||
|
Window window;
|
||||||
|
DetectionConfig detectionConfig;
|
||||||
|
public SizeControl(Window _window,DetectionConfig _detection)
|
||||||
|
{
|
||||||
|
window = _window;
|
||||||
|
detectionConfig = _detection;
|
||||||
|
InitializeComponent();
|
||||||
|
//初始化表格列头
|
||||||
|
InitTableColumns();
|
||||||
|
InitData();
|
||||||
|
BindEventHandler();
|
||||||
|
}
|
||||||
|
|
||||||
|
private void BindEventHandler()
|
||||||
|
{
|
||||||
|
|
||||||
|
btnSizeAdd.Click += BtnSizeAdd_Click;
|
||||||
|
btnSizeDel.Click += BtnSizeDelete_Click;
|
||||||
|
SizeTable.CellButtonClick += SizeTable_CellButtonClick;
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
private void SizeTable_CellButtonClick(object sender, TableButtonEventArgs e)
|
||||||
|
{
|
||||||
|
var buttontext = e.Btn.Text;
|
||||||
|
|
||||||
|
if (e.Record is SizeTreatParam sizeTreat)
|
||||||
|
{
|
||||||
|
switch (buttontext)
|
||||||
|
{
|
||||||
|
//暂不支持进入整行编辑,只支持指定单元格编辑,推荐使用弹窗或抽屉编辑整行数据
|
||||||
|
case "编辑":
|
||||||
|
var form = new SizeLabelEdit(window, sizeTreat) { Size = new Size(500, 300) };
|
||||||
|
AntdUI.Drawer.open(new AntdUI.Drawer.Config(window, form)
|
||||||
|
{
|
||||||
|
OnLoad = () =>
|
||||||
|
{
|
||||||
|
AntdUI.Message.info(window, "进入编辑", autoClose: 1);
|
||||||
|
},
|
||||||
|
OnClose = () =>
|
||||||
|
{
|
||||||
|
AntdUI.Message.info(window, "结束编辑", autoClose: 1);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
break;
|
||||||
|
case "删除":
|
||||||
|
var result = Modal.open(window, "删除警告!", "确认要删除选择的数据吗?", TType.Warn);
|
||||||
|
if (result == DialogResult.OK)
|
||||||
|
detectionConfig.SizeTreatParamList.Remove(sizeTreat);
|
||||||
|
break;
|
||||||
|
case "进行测量":
|
||||||
|
var sizeType = ((int)sizeTreat.PreType).ToString();
|
||||||
|
|
||||||
|
// 根据测量类型打开不同的窗口
|
||||||
|
switch (sizeType)
|
||||||
|
{
|
||||||
|
case "1":
|
||||||
|
case "2":
|
||||||
|
case "3":
|
||||||
|
case "4":
|
||||||
|
case "5":
|
||||||
|
FrmMain3 frmMain3 = new FrmMain3(sizeType);
|
||||||
|
frmMain3.ShowDialog();
|
||||||
|
if (!string.IsNullOrEmpty(frmMain3.inputtext))
|
||||||
|
{
|
||||||
|
|
||||||
|
sizeTreat.ResultShow = frmMain3.inputtext;
|
||||||
|
}
|
||||||
|
if (!string.IsNullOrEmpty(frmMain3.outtext))
|
||||||
|
{
|
||||||
|
|
||||||
|
|
||||||
|
sizeTreat.OutResultShow = frmMain3.outtext;
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
MessageBox.Show("未定义的测量类型!");
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
//使用clone可以防止table中的image被修改
|
||||||
|
//Preview.open(new Preview.Config(window, (Image)SizeParamLable.CellImages[0].Image.Clone()));
|
||||||
|
break;
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
private void BtnSizeDelete_Click(object? sender, EventArgs e)
|
||||||
|
{
|
||||||
|
if (detectionConfig.SizeTreatParamList.Count == 0 || !detectionConfig.SizeTreatParamList.Any(x => x.Selected))
|
||||||
|
{
|
||||||
|
AntdUI.Message.warn(window, "请选择要删除的行!", autoClose: 3);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
var result = Modal.open(window, "删除警告!", "确认要删除选择的数据吗?", TType.Warn);
|
||||||
|
if (result == DialogResult.OK)
|
||||||
|
{
|
||||||
|
// 使用反转for循环删除主列表中选中的项
|
||||||
|
for (int i = detectionConfig.SizeTreatParamList.Count - 1; i >= 0; i--)
|
||||||
|
{
|
||||||
|
// 删除选中的主列表项
|
||||||
|
if (detectionConfig.SizeTreatParamList[i].Selected)
|
||||||
|
{
|
||||||
|
detectionConfig.SizeTreatParamList.RemoveAt(i);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
// 提示删除完成
|
||||||
|
AntdUI.Message.success(window, "删除成功!", autoClose: 3);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private void BtnSizeAdd_Click(object? sender, EventArgs e)
|
||||||
|
{
|
||||||
|
SizeTreatParam SizeParamLable = new SizeTreatParam()
|
||||||
|
{
|
||||||
|
//CellBadge = new CellBadge(SizeEnum.Circle.GetEnumDescription()),
|
||||||
|
CellLinks = new CellLink[] {
|
||||||
|
new CellButton(Guid.NewGuid().ToString(),"编辑",TTypeMini.Primary),
|
||||||
|
|
||||||
|
new CellButton(Guid.NewGuid().ToString(),"删除",TTypeMini.Error),
|
||||||
|
new CellButton(Guid.NewGuid().ToString(),"进行测量",TTypeMini.Primary)
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
};
|
||||||
|
var form = new SizeLabelEdit(window, SizeParamLable) { Size = new Size(450, 500) };
|
||||||
|
AntdUI.Modal.open(new AntdUI.Modal.Config(window, "", form, TType.None)
|
||||||
|
{
|
||||||
|
BtnHeight = 0,
|
||||||
|
});
|
||||||
|
if (form.submit)
|
||||||
|
{
|
||||||
|
detectionConfig.SizeTreatParamList.Add(SizeParamLable);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
private void InitData()
|
||||||
|
{
|
||||||
|
|
||||||
|
SizeTable.Binding(detectionConfig.SizeTreatParamList);
|
||||||
|
|
||||||
|
|
||||||
|
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)
|
||||||
|
};
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private void InitTableColumns()
|
||||||
|
{
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
SizeTable.Columns = new ColumnCollection() {
|
||||||
|
new ColumnCheck("Selected"){Fixed = true},
|
||||||
|
new ColumnSwitch("IsEnable", "是否启用", ColumnAlign.Center),
|
||||||
|
new Column("PreName", "测量名称",ColumnAlign.Center),
|
||||||
|
new Column("PreType", "测量类型", ColumnAlign.Center),
|
||||||
|
new Column("PrePix", "阈值", ColumnAlign.Center),
|
||||||
|
new Column("ResultShow", "输入参数", ColumnAlign.Center),
|
||||||
|
new Column("OutResultShow", "输出参数", ColumnAlign.Center),
|
||||||
|
new Column("CellLinks", "操作", ColumnAlign.Center)
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
126
DHSoftware/Views/SizeControl.resx
Normal file
126
DHSoftware/Views/SizeControl.resx
Normal file
@ -0,0 +1,126 @@
|
|||||||
|
<?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>
|
||||||
|
<data name="btnSizeDel.IconSvg" xml:space="preserve">
|
||||||
|
<value><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"><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"/></svg></value>
|
||||||
|
</data>
|
||||||
|
<data name="btnSizeAdd.IconSvg" xml:space="preserve">
|
||||||
|
<value><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"><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"/></svg></value>
|
||||||
|
</data>
|
||||||
|
</root>
|
@ -49,7 +49,7 @@ namespace DHSoftware.Views
|
|||||||
detect._window = this._windows;
|
detect._window = this._windows;
|
||||||
|
|
||||||
// 添加尺寸测量控件
|
// 添加尺寸测量控件
|
||||||
var sizeFrm = new SizeConfigControl();
|
//var sizeFrm = new SizeControl();
|
||||||
|
|
||||||
|
|
||||||
CameraConfigControl camConfigFrm = new CameraConfigControl();
|
CameraConfigControl camConfigFrm = new CameraConfigControl();
|
||||||
@ -123,7 +123,7 @@ namespace DHSoftware.Views
|
|||||||
panel2.Controls.Add(ptuc);
|
panel2.Controls.Add(ptuc);
|
||||||
panel3.Controls.Add(flowmodel);
|
panel3.Controls.Add(flowmodel);
|
||||||
panel3.Controls.Add(detect);
|
panel3.Controls.Add(detect);
|
||||||
panel4.Controls.Add(sizeFrm);
|
//panel4.Controls.Add(sizeFrm);
|
||||||
group1.Controls.Add(panel);
|
group1.Controls.Add(panel);
|
||||||
group2.Controls.Add(panel2);
|
group2.Controls.Add(panel2);
|
||||||
group3.Controls.Add(panel3);
|
group3.Controls.Add(panel3);
|
||||||
|
379
DHSoftware/Views/VisualLocalizationWindow.Designer.cs
generated
Normal file
379
DHSoftware/Views/VisualLocalizationWindow.Designer.cs
generated
Normal file
@ -0,0 +1,379 @@
|
|||||||
|
namespace DHSoftware.Views
|
||||||
|
{
|
||||||
|
partial class VisualLocalizationWindow
|
||||||
|
{
|
||||||
|
/// <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()
|
||||||
|
{
|
||||||
|
titlebar = new AntdUI.PageHeader();
|
||||||
|
panel1 = new AntdUI.Panel();
|
||||||
|
iptThreshold = new AntdUI.InputNumber();
|
||||||
|
label6 = new AntdUI.Label();
|
||||||
|
btnSelectBackImg = new AntdUI.Button();
|
||||||
|
btnSelectModel = new AntdUI.Button();
|
||||||
|
iptBackImg = new AntdUI.Input();
|
||||||
|
label3 = new AntdUI.Label();
|
||||||
|
iptModel = new AntdUI.Input();
|
||||||
|
label2 = new AntdUI.Label();
|
||||||
|
sltCameraName = new AntdUI.Select();
|
||||||
|
label1 = new AntdUI.Label();
|
||||||
|
panel2 = new AntdUI.Panel();
|
||||||
|
iptSpeed = new AntdUI.InputNumber();
|
||||||
|
label7 = new AntdUI.Label();
|
||||||
|
btnSaveImg = new AntdUI.Button();
|
||||||
|
btnSavePos = new AntdUI.Button();
|
||||||
|
btnReverse = new AntdUI.Button();
|
||||||
|
btnForward = new AntdUI.Button();
|
||||||
|
btnLocalization = new AntdUI.Button();
|
||||||
|
btnAcquisition = new AntdUI.Button();
|
||||||
|
iptPosition = new AntdUI.InputNumber();
|
||||||
|
label5 = new AntdUI.Label();
|
||||||
|
sltDirection = new AntdUI.Select();
|
||||||
|
label4 = new AntdUI.Label();
|
||||||
|
imageViewerControl1 = new ImageViewerControl();
|
||||||
|
panel1.SuspendLayout();
|
||||||
|
panel2.SuspendLayout();
|
||||||
|
SuspendLayout();
|
||||||
|
//
|
||||||
|
// titlebar
|
||||||
|
//
|
||||||
|
titlebar.BackColor = Color.FromArgb(46, 108, 227);
|
||||||
|
titlebar.DividerShow = true;
|
||||||
|
titlebar.DividerThickness = 0F;
|
||||||
|
titlebar.Dock = DockStyle.Top;
|
||||||
|
titlebar.Font = new Font("Microsoft YaHei UI", 12F, FontStyle.Regular, GraphicsUnit.Point, 134);
|
||||||
|
titlebar.ForeColor = Color.White;
|
||||||
|
titlebar.Location = new Point(0, 0);
|
||||||
|
titlebar.Mode = AntdUI.TAMode.Dark;
|
||||||
|
titlebar.Name = "titlebar";
|
||||||
|
titlebar.ShowButton = true;
|
||||||
|
titlebar.ShowIcon = true;
|
||||||
|
titlebar.Size = new Size(1210, 37);
|
||||||
|
titlebar.SubText = "视觉定位系统";
|
||||||
|
titlebar.TabIndex = 1;
|
||||||
|
titlebar.Text = "山东迭慧智能科技有限公司";
|
||||||
|
//
|
||||||
|
// panel1
|
||||||
|
//
|
||||||
|
panel1.Controls.Add(iptThreshold);
|
||||||
|
panel1.Controls.Add(label6);
|
||||||
|
panel1.Controls.Add(btnSelectBackImg);
|
||||||
|
panel1.Controls.Add(btnSelectModel);
|
||||||
|
panel1.Controls.Add(iptBackImg);
|
||||||
|
panel1.Controls.Add(label3);
|
||||||
|
panel1.Controls.Add(iptModel);
|
||||||
|
panel1.Controls.Add(label2);
|
||||||
|
panel1.Controls.Add(sltCameraName);
|
||||||
|
panel1.Controls.Add(label1);
|
||||||
|
panel1.Dock = DockStyle.Top;
|
||||||
|
panel1.Location = new Point(0, 37);
|
||||||
|
panel1.Name = "panel1";
|
||||||
|
panel1.Size = new Size(1210, 56);
|
||||||
|
panel1.TabIndex = 2;
|
||||||
|
panel1.Text = "panel1";
|
||||||
|
//
|
||||||
|
// iptThreshold
|
||||||
|
//
|
||||||
|
iptThreshold.Location = new Point(1094, 6);
|
||||||
|
iptThreshold.Name = "iptThreshold";
|
||||||
|
iptThreshold.Size = new Size(107, 43);
|
||||||
|
iptThreshold.TabIndex = 15;
|
||||||
|
iptThreshold.Text = "0";
|
||||||
|
//
|
||||||
|
// label6
|
||||||
|
//
|
||||||
|
label6.BackColor = SystemColors.Window;
|
||||||
|
label6.Location = new Point(1044, 18);
|
||||||
|
label6.Name = "label6";
|
||||||
|
label6.Size = new Size(57, 23);
|
||||||
|
label6.TabIndex = 14;
|
||||||
|
label6.Text = "定位阈值";
|
||||||
|
//
|
||||||
|
// btnSelectBackImg
|
||||||
|
//
|
||||||
|
btnSelectBackImg.Font = new Font("Microsoft YaHei UI", 9F, FontStyle.Regular, GraphicsUnit.Point, 134);
|
||||||
|
btnSelectBackImg.Location = new Point(963, 11);
|
||||||
|
btnSelectBackImg.Name = "btnSelectBackImg";
|
||||||
|
btnSelectBackImg.Size = new Size(75, 38);
|
||||||
|
btnSelectBackImg.TabIndex = 13;
|
||||||
|
btnSelectBackImg.Text = "打开";
|
||||||
|
btnSelectBackImg.Type = AntdUI.TTypeMini.Primary;
|
||||||
|
//
|
||||||
|
// btnSelectModel
|
||||||
|
//
|
||||||
|
btnSelectModel.Font = new Font("Microsoft YaHei UI", 9F, FontStyle.Regular, GraphicsUnit.Point, 134);
|
||||||
|
btnSelectModel.Location = new Point(525, 9);
|
||||||
|
btnSelectModel.Name = "btnSelectModel";
|
||||||
|
btnSelectModel.Size = new Size(75, 38);
|
||||||
|
btnSelectModel.TabIndex = 12;
|
||||||
|
btnSelectModel.Text = "打开";
|
||||||
|
btnSelectModel.Type = AntdUI.TTypeMini.Primary;
|
||||||
|
//
|
||||||
|
// iptBackImg
|
||||||
|
//
|
||||||
|
iptBackImg.Location = new Point(694, 6);
|
||||||
|
iptBackImg.Name = "iptBackImg";
|
||||||
|
iptBackImg.PlaceholderText = "请选择背景图片";
|
||||||
|
iptBackImg.Size = new Size(263, 43);
|
||||||
|
iptBackImg.TabIndex = 10;
|
||||||
|
//
|
||||||
|
// label3
|
||||||
|
//
|
||||||
|
label3.BackColor = SystemColors.Window;
|
||||||
|
label3.Location = new Point(606, 18);
|
||||||
|
label3.Name = "label3";
|
||||||
|
label3.Size = new Size(82, 23);
|
||||||
|
label3.TabIndex = 9;
|
||||||
|
label3.Text = "背景图片路径";
|
||||||
|
//
|
||||||
|
// iptModel
|
||||||
|
//
|
||||||
|
iptModel.Location = new Point(256, 6);
|
||||||
|
iptModel.Name = "iptModel";
|
||||||
|
iptModel.PlaceholderText = "请选择算法";
|
||||||
|
iptModel.Size = new Size(263, 43);
|
||||||
|
iptModel.TabIndex = 3;
|
||||||
|
//
|
||||||
|
// label2
|
||||||
|
//
|
||||||
|
label2.BackColor = SystemColors.Window;
|
||||||
|
label2.Location = new Point(193, 18);
|
||||||
|
label2.Name = "label2";
|
||||||
|
label2.Size = new Size(57, 23);
|
||||||
|
label2.TabIndex = 2;
|
||||||
|
label2.Text = "算法路径";
|
||||||
|
//
|
||||||
|
// sltCameraName
|
||||||
|
//
|
||||||
|
sltCameraName.List = true;
|
||||||
|
sltCameraName.Location = new Point(72, 7);
|
||||||
|
sltCameraName.MaxCount = 10;
|
||||||
|
sltCameraName.Name = "sltCameraName";
|
||||||
|
sltCameraName.PlaceholderText = "请选择相机";
|
||||||
|
sltCameraName.Size = new Size(115, 43);
|
||||||
|
sltCameraName.TabIndex = 1;
|
||||||
|
//
|
||||||
|
// label1
|
||||||
|
//
|
||||||
|
label1.BackColor = SystemColors.Window;
|
||||||
|
label1.Location = new Point(9, 18);
|
||||||
|
label1.Name = "label1";
|
||||||
|
label1.Size = new Size(57, 23);
|
||||||
|
label1.TabIndex = 0;
|
||||||
|
label1.Text = "相机名称";
|
||||||
|
//
|
||||||
|
// panel2
|
||||||
|
//
|
||||||
|
panel2.Controls.Add(iptSpeed);
|
||||||
|
panel2.Controls.Add(label7);
|
||||||
|
panel2.Controls.Add(btnSaveImg);
|
||||||
|
panel2.Controls.Add(btnSavePos);
|
||||||
|
panel2.Controls.Add(btnReverse);
|
||||||
|
panel2.Controls.Add(btnForward);
|
||||||
|
panel2.Controls.Add(btnLocalization);
|
||||||
|
panel2.Controls.Add(btnAcquisition);
|
||||||
|
panel2.Controls.Add(iptPosition);
|
||||||
|
panel2.Controls.Add(label5);
|
||||||
|
panel2.Controls.Add(sltDirection);
|
||||||
|
panel2.Controls.Add(label4);
|
||||||
|
panel2.Dock = DockStyle.Top;
|
||||||
|
panel2.Location = new Point(0, 93);
|
||||||
|
panel2.Name = "panel2";
|
||||||
|
panel2.Size = new Size(1210, 56);
|
||||||
|
panel2.TabIndex = 3;
|
||||||
|
panel2.Text = "panel2";
|
||||||
|
//
|
||||||
|
// iptSpeed
|
||||||
|
//
|
||||||
|
iptSpeed.Location = new Point(256, 6);
|
||||||
|
iptSpeed.Name = "iptSpeed";
|
||||||
|
iptSpeed.Size = new Size(107, 43);
|
||||||
|
iptSpeed.TabIndex = 20;
|
||||||
|
iptSpeed.Text = "0";
|
||||||
|
//
|
||||||
|
// label7
|
||||||
|
//
|
||||||
|
label7.BackColor = SystemColors.Window;
|
||||||
|
label7.Location = new Point(193, 18);
|
||||||
|
label7.Name = "label7";
|
||||||
|
label7.Size = new Size(57, 23);
|
||||||
|
label7.TabIndex = 19;
|
||||||
|
label7.Text = "转盘速度";
|
||||||
|
//
|
||||||
|
// btnSaveImg
|
||||||
|
//
|
||||||
|
btnSaveImg.Font = new Font("Microsoft YaHei UI", 9F, FontStyle.Regular, GraphicsUnit.Point, 134);
|
||||||
|
btnSaveImg.Location = new Point(1126, 11);
|
||||||
|
btnSaveImg.Name = "btnSaveImg";
|
||||||
|
btnSaveImg.Size = new Size(75, 38);
|
||||||
|
btnSaveImg.TabIndex = 18;
|
||||||
|
btnSaveImg.Text = "保存图像";
|
||||||
|
btnSaveImg.Type = AntdUI.TTypeMini.Primary;
|
||||||
|
//
|
||||||
|
// btnSavePos
|
||||||
|
//
|
||||||
|
btnSavePos.Font = new Font("Microsoft YaHei UI", 9F, FontStyle.Regular, GraphicsUnit.Point, 134);
|
||||||
|
btnSavePos.Location = new Point(1013, 11);
|
||||||
|
btnSavePos.Name = "btnSavePos";
|
||||||
|
btnSavePos.Size = new Size(75, 38);
|
||||||
|
btnSavePos.TabIndex = 17;
|
||||||
|
btnSavePos.Text = "保存定位";
|
||||||
|
btnSavePos.Type = AntdUI.TTypeMini.Primary;
|
||||||
|
//
|
||||||
|
// btnReverse
|
||||||
|
//
|
||||||
|
btnReverse.Font = new Font("Microsoft YaHei UI", 9F, FontStyle.Regular, GraphicsUnit.Point, 134);
|
||||||
|
btnReverse.Location = new Point(904, 11);
|
||||||
|
btnReverse.Name = "btnReverse";
|
||||||
|
btnReverse.Size = new Size(75, 38);
|
||||||
|
btnReverse.TabIndex = 16;
|
||||||
|
btnReverse.Text = "转盘反转";
|
||||||
|
btnReverse.Type = AntdUI.TTypeMini.Primary;
|
||||||
|
//
|
||||||
|
// btnForward
|
||||||
|
//
|
||||||
|
btnForward.Font = new Font("Microsoft YaHei UI", 9F, FontStyle.Regular, GraphicsUnit.Point, 134);
|
||||||
|
btnForward.Location = new Point(804, 11);
|
||||||
|
btnForward.Name = "btnForward";
|
||||||
|
btnForward.Size = new Size(75, 38);
|
||||||
|
btnForward.TabIndex = 15;
|
||||||
|
btnForward.Text = "转盘正转";
|
||||||
|
btnForward.Type = AntdUI.TTypeMini.Primary;
|
||||||
|
//
|
||||||
|
// btnLocalization
|
||||||
|
//
|
||||||
|
btnLocalization.Font = new Font("Microsoft YaHei UI", 9F, FontStyle.Regular, GraphicsUnit.Point, 134);
|
||||||
|
btnLocalization.Location = new Point(704, 11);
|
||||||
|
btnLocalization.Name = "btnLocalization";
|
||||||
|
btnLocalization.Size = new Size(75, 38);
|
||||||
|
btnLocalization.TabIndex = 14;
|
||||||
|
btnLocalization.Text = "开始定位";
|
||||||
|
btnLocalization.Type = AntdUI.TTypeMini.Primary;
|
||||||
|
//
|
||||||
|
// btnAcquisition
|
||||||
|
//
|
||||||
|
btnAcquisition.Font = new Font("Microsoft YaHei UI", 9F, FontStyle.Regular, GraphicsUnit.Point, 134);
|
||||||
|
btnAcquisition.Location = new Point(606, 11);
|
||||||
|
btnAcquisition.Name = "btnAcquisition";
|
||||||
|
btnAcquisition.Size = new Size(75, 38);
|
||||||
|
btnAcquisition.TabIndex = 13;
|
||||||
|
btnAcquisition.Text = "开始采集";
|
||||||
|
btnAcquisition.Type = AntdUI.TTypeMini.Primary;
|
||||||
|
//
|
||||||
|
// iptPosition
|
||||||
|
//
|
||||||
|
iptPosition.Location = new Point(425, 6);
|
||||||
|
iptPosition.Name = "iptPosition";
|
||||||
|
iptPosition.ReadOnly = true;
|
||||||
|
iptPosition.Size = new Size(175, 43);
|
||||||
|
iptPosition.TabIndex = 7;
|
||||||
|
iptPosition.Text = "0";
|
||||||
|
//
|
||||||
|
// label5
|
||||||
|
//
|
||||||
|
label5.BackColor = SystemColors.Window;
|
||||||
|
label5.Location = new Point(369, 18);
|
||||||
|
label5.Name = "label5";
|
||||||
|
label5.Size = new Size(59, 23);
|
||||||
|
label5.TabIndex = 6;
|
||||||
|
label5.Text = "当前位置";
|
||||||
|
//
|
||||||
|
// sltDirection
|
||||||
|
//
|
||||||
|
sltDirection.Items.AddRange(new object[] { "正方向", "反方向" });
|
||||||
|
sltDirection.List = true;
|
||||||
|
sltDirection.Location = new Point(72, 6);
|
||||||
|
sltDirection.MaxCount = 10;
|
||||||
|
sltDirection.Name = "sltDirection";
|
||||||
|
sltDirection.PlaceholderText = "请选择方向";
|
||||||
|
sltDirection.Size = new Size(115, 43);
|
||||||
|
sltDirection.TabIndex = 5;
|
||||||
|
//
|
||||||
|
// label4
|
||||||
|
//
|
||||||
|
label4.BackColor = SystemColors.Window;
|
||||||
|
label4.Location = new Point(9, 18);
|
||||||
|
label4.Name = "label4";
|
||||||
|
label4.Size = new Size(57, 23);
|
||||||
|
label4.TabIndex = 4;
|
||||||
|
label4.Text = "转盘方向";
|
||||||
|
//
|
||||||
|
// imageViewerControl1
|
||||||
|
//
|
||||||
|
imageViewerControl1.Dock = DockStyle.Fill;
|
||||||
|
imageViewerControl1.Image = null;
|
||||||
|
imageViewerControl1.Location = new Point(0, 149);
|
||||||
|
imageViewerControl1.Name = "imageViewerControl1";
|
||||||
|
imageViewerControl1.Size = new Size(1210, 558);
|
||||||
|
imageViewerControl1.TabIndex = 4;
|
||||||
|
//
|
||||||
|
// VisualLocalizationWindow
|
||||||
|
//
|
||||||
|
AutoScaleDimensions = new SizeF(7F, 17F);
|
||||||
|
AutoScaleMode = AutoScaleMode.Font;
|
||||||
|
ClientSize = new Size(1210, 707);
|
||||||
|
Controls.Add(imageViewerControl1);
|
||||||
|
Controls.Add(panel2);
|
||||||
|
Controls.Add(panel1);
|
||||||
|
Controls.Add(titlebar);
|
||||||
|
Name = "VisualLocalizationWindow";
|
||||||
|
Text = "CCD光学筛选定位系统";
|
||||||
|
WindowState = FormWindowState.Maximized;
|
||||||
|
panel1.ResumeLayout(false);
|
||||||
|
panel2.ResumeLayout(false);
|
||||||
|
ResumeLayout(false);
|
||||||
|
}
|
||||||
|
|
||||||
|
#endregion
|
||||||
|
|
||||||
|
private AntdUI.PageHeader titlebar;
|
||||||
|
private AntdUI.Panel panel1;
|
||||||
|
private AntdUI.Select sltCameraName;
|
||||||
|
private AntdUI.Label label1;
|
||||||
|
private AntdUI.Input iptModel;
|
||||||
|
private AntdUI.Label label2;
|
||||||
|
private AntdUI.Input iptBackImg;
|
||||||
|
private AntdUI.Label label3;
|
||||||
|
private AntdUI.Panel panel2;
|
||||||
|
private AntdUI.Label label4;
|
||||||
|
private AntdUI.Select sltDirection;
|
||||||
|
private AntdUI.InputNumber iptPosition;
|
||||||
|
private AntdUI.Label label5;
|
||||||
|
private AntdUI.Button btnSelectBackImg;
|
||||||
|
private AntdUI.Button btnSelectModel;
|
||||||
|
private AntdUI.Button btnAcquisition;
|
||||||
|
private AntdUI.Button btnLocalization;
|
||||||
|
private AntdUI.Button btnReverse;
|
||||||
|
private AntdUI.Button btnForward;
|
||||||
|
private AntdUI.Button btnSaveImg;
|
||||||
|
private AntdUI.Button btnSavePos;
|
||||||
|
private ImageViewerControl imageViewerControl1;
|
||||||
|
private AntdUI.InputNumber iptThreshold;
|
||||||
|
private AntdUI.Label label6;
|
||||||
|
private AntdUI.InputNumber iptSpeed;
|
||||||
|
private AntdUI.Label label7;
|
||||||
|
}
|
||||||
|
}
|
493
DHSoftware/Views/VisualLocalizationWindow.cs
Normal file
493
DHSoftware/Views/VisualLocalizationWindow.cs
Normal file
@ -0,0 +1,493 @@
|
|||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.ComponentModel;
|
||||||
|
using System.Data;
|
||||||
|
using System.Drawing;
|
||||||
|
using System.Drawing.Imaging;
|
||||||
|
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 DH.Devices.Camera;
|
||||||
|
using HalconDotNet;
|
||||||
|
using OpenCvSharp.Extensions;
|
||||||
|
using Sunny.UI;
|
||||||
|
using static System.Net.Mime.MediaTypeNames;
|
||||||
|
|
||||||
|
namespace DHSoftware.Views
|
||||||
|
{
|
||||||
|
public partial class VisualLocalizationWindow : Window
|
||||||
|
{
|
||||||
|
//采集状态
|
||||||
|
private volatile bool isCapturing=false;
|
||||||
|
//定位状态
|
||||||
|
private volatile bool isLocationing = false;
|
||||||
|
//算法
|
||||||
|
HDevEngine MyEngine = new HDevEngine();
|
||||||
|
HDevProcedure Procedure;
|
||||||
|
HDevProcedureCall ProcCall;
|
||||||
|
//背景图
|
||||||
|
HImage backImage = new HImage();
|
||||||
|
//当前相机
|
||||||
|
Do3ThinkCamera Do3ThinkCamera = new Do3ThinkCamera();
|
||||||
|
//定时器
|
||||||
|
private System.Threading.Timer Timer;
|
||||||
|
|
||||||
|
|
||||||
|
public VisualLocalizationWindow()
|
||||||
|
{
|
||||||
|
InitializeComponent();
|
||||||
|
Load += VisualLocalizationWindow_Load;
|
||||||
|
btnSelectModel.Click += BtnSelectModel_Click;
|
||||||
|
btnSelectBackImg.Click += BtnSelectBackImg_Click;
|
||||||
|
btnAcquisition.Click += BtnAcquisition_Click;
|
||||||
|
btnLocalization.Click += BtnLocalization_Click;
|
||||||
|
btnForward.MouseDown += BtnForward_MouseDown;
|
||||||
|
btnForward.MouseUp += BtnForward_MouseUp;
|
||||||
|
btnReverse.MouseDown += BtnReverse_MouseDown;
|
||||||
|
btnReverse.MouseUp += BtnReverse_MouseUp;
|
||||||
|
btnSaveImg.Click += BtnSaveImg_Click;
|
||||||
|
btnSavePos.Click += BtnSavePos_Click;
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
private void BtnSavePos_Click(object? sender, EventArgs e)
|
||||||
|
{
|
||||||
|
var form = new SavePositionControl(this,Convert.ToInt32(iptPosition.Text)) { Size = new Size(300, 300) };
|
||||||
|
AntdUI.Modal.open(new AntdUI.Modal.Config(this, "", form, TType.None)
|
||||||
|
{
|
||||||
|
BtnHeight = 0,
|
||||||
|
});
|
||||||
|
if (form.submit)
|
||||||
|
{
|
||||||
|
//保存用户操作到文件
|
||||||
|
VisualLocalization visualLocalization = new VisualLocalization();
|
||||||
|
visualLocalization.CameraName = sltCameraName.Text;
|
||||||
|
visualLocalization.ModelPath=iptModel.Text;
|
||||||
|
visualLocalization.ImgPath=iptBackImg.Text;
|
||||||
|
visualLocalization.Threshold=iptThreshold.Text;
|
||||||
|
visualLocalization.Direction=sltDirection.Text;
|
||||||
|
visualLocalization.Speed=iptSpeed.Text;
|
||||||
|
visualLocalization.SaveToFile("VisualLocalization.json");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 保存图像
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="sender"></param>
|
||||||
|
/// <param name="e"></param>
|
||||||
|
private void BtnSaveImg_Click(object? sender, EventArgs e)
|
||||||
|
{
|
||||||
|
if (!isCapturing)
|
||||||
|
{
|
||||||
|
AntdUI.Message.warn(this, $"未开始采集,无法保存图像!", autoClose: 3);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
Bitmap bitmap =imageViewerControl1.GetCurrentSnapshot();
|
||||||
|
using (SaveFileDialog saveDialog = new SaveFileDialog())
|
||||||
|
{
|
||||||
|
saveDialog.Title = "保存图像文件";
|
||||||
|
saveDialog.Filter = "JPEG 图像|*.jpg";
|
||||||
|
saveDialog.FilterIndex = 0;
|
||||||
|
saveDialog.AddExtension = true;
|
||||||
|
saveDialog.OverwritePrompt = true;
|
||||||
|
|
||||||
|
if (saveDialog.ShowDialog() == DialogResult.OK)
|
||||||
|
{
|
||||||
|
bitmap.Save(saveDialog.FileName, ImageFormat.Jpeg);
|
||||||
|
AntdUI.Message.success(this, $"图像保存成功!", autoClose: 3);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
AntdUI.Message.warn(this, $"取消图像保存操作!", autoClose: 3);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 定位
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="sender"></param>
|
||||||
|
/// <param name="e"></param>
|
||||||
|
private void BtnLocalization_Click(object? sender, EventArgs e)
|
||||||
|
{
|
||||||
|
if (!isCapturing)
|
||||||
|
{
|
||||||
|
AntdUI.Message.warn(this, $"未开始采集,无法开始定位!", autoClose: 3);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
if (!isLocationing)
|
||||||
|
{
|
||||||
|
bool direction =sltDirection.SelectedIndex==0?true:false;
|
||||||
|
if (string.IsNullOrEmpty(iptSpeed.Text))
|
||||||
|
{
|
||||||
|
AntdUI.Message.warn(this, $"请输入速度!", autoClose: 3);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
int speed = 0;
|
||||||
|
|
||||||
|
try
|
||||||
|
{
|
||||||
|
bool isValid = int.TryParse(iptSpeed.Text, out speed);
|
||||||
|
if (!isValid)
|
||||||
|
{
|
||||||
|
AntdUI.Message.warn(this, $"输入的速度不是有效值!", autoClose: 3);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
catch (Exception ex) { }
|
||||||
|
MainWindow.Instance.PLC.TurnSpeed(speed);
|
||||||
|
MainWindow.Instance.PLC.TurnDirection(direction);
|
||||||
|
MainWindow.Instance.PLC.TurnStart(true);
|
||||||
|
isLocationing = true;
|
||||||
|
btnLocalization.Text = "结束定位";
|
||||||
|
btnLocalization.Type = TTypeMini.Warn;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
MainWindow.Instance.PLC.TurnStart(false);
|
||||||
|
iptPosition.Text= MainWindow.Instance.PLC.ReadVisionPos().ToString();
|
||||||
|
isLocationing = false;
|
||||||
|
btnLocalization.Text = "开始定位";
|
||||||
|
btnLocalization.Type = TTypeMini.Primary;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 采集
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="sender"></param>
|
||||||
|
/// <param name="e"></param>
|
||||||
|
private void BtnAcquisition_Click(object? sender, EventArgs e)
|
||||||
|
{
|
||||||
|
if (!isCapturing)
|
||||||
|
{
|
||||||
|
if (string.IsNullOrWhiteSpace(sltCameraName.Text))
|
||||||
|
{
|
||||||
|
AntdUI.Message.warn(this, $"请选择相机!", autoClose: 3);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
if (string.IsNullOrWhiteSpace(iptModel.Text))
|
||||||
|
{
|
||||||
|
AntdUI.Message.warn(this, $"请选择算法!", autoClose: 3);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
if (string.IsNullOrWhiteSpace(iptBackImg.Text))
|
||||||
|
{
|
||||||
|
AntdUI.Message.warn(this, $"请选择背景图片!", autoClose: 3);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
// 加载HALCON模型
|
||||||
|
if (!File.Exists(iptModel.Text))
|
||||||
|
{
|
||||||
|
AntdUI.Message.warn(this, $"算法文件不存在!", autoClose: 3);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
if (!File.Exists(iptBackImg.Text))
|
||||||
|
{
|
||||||
|
AntdUI.Message.warn(this, $"图片文件不存在!", autoClose: 3);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
//获取背景图
|
||||||
|
backImage = new HImage();
|
||||||
|
backImage.ReadImage(iptBackImg.Text);
|
||||||
|
// 从完整路径获取过程名称
|
||||||
|
string procedureName = Path.GetFileNameWithoutExtension(iptModel.Text);
|
||||||
|
string procedureDir = Path.GetDirectoryName(iptModel.Text);
|
||||||
|
|
||||||
|
// 重新初始化HALCON引擎
|
||||||
|
MyEngine.SetProcedurePath(procedureDir);
|
||||||
|
Procedure = new HDevProcedure(procedureName);
|
||||||
|
ProcCall = new HDevProcedureCall(Procedure);
|
||||||
|
|
||||||
|
if (MainWindow.Instance.PLC.Connected)
|
||||||
|
{
|
||||||
|
//启用视觉定位
|
||||||
|
MainWindow.Instance.PLC.VisionPos(true);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
AntdUI.Message.warn(this, $"未连接PLC,无法视觉定位!", autoClose: 3);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
Do3ThinkCamera=MainWindow.Instance.Cameras.Where(it=>it.CameraName==sltCameraName.Text).FirstOrDefault()??new Do3ThinkCamera();
|
||||||
|
Do3ThinkCamera.OnHImageOutput += OnCameraHImageOutput;
|
||||||
|
Timer = new System.Threading.Timer(CaptureLoop, null, 0, 50);
|
||||||
|
isCapturing = true;
|
||||||
|
btnAcquisition.Text = "结束采集";
|
||||||
|
btnAcquisition.Type = TTypeMini.Warn;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
if (isLocationing)
|
||||||
|
{
|
||||||
|
AntdUI.Message.warn(this, $"定位未结束,不能结束采集!", autoClose: 3);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
MainWindow.Instance.PLC.VisionPos(false);
|
||||||
|
Do3ThinkCamera.OnHImageOutput -= OnCameraHImageOutput;
|
||||||
|
Timer?.Dispose();
|
||||||
|
isCapturing = false;
|
||||||
|
btnAcquisition.Text = "开始采集";
|
||||||
|
btnAcquisition.Type = TTypeMini.Primary;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 触发
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="state"></param>
|
||||||
|
private void CaptureLoop(object? state)
|
||||||
|
{
|
||||||
|
Do3ThinkCamera.Snapshot();
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 反转抬起
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="sender"></param>
|
||||||
|
/// <param name="e"></param>
|
||||||
|
private void BtnReverse_MouseUp(object? sender, MouseEventArgs e)
|
||||||
|
{
|
||||||
|
if (MainWindow.Instance.PLC.Connected)
|
||||||
|
{
|
||||||
|
MainWindow.Instance.PLC.TurnStart(false);
|
||||||
|
iptPosition.Text = MainWindow.Instance.PLC.ReadVisionPos().ToString();
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
AntdUI.Message.warn(this, $"未连接PLC!", autoClose: 3);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 反转按下
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="sender"></param>
|
||||||
|
/// <param name="e"></param>
|
||||||
|
private void BtnReverse_MouseDown(object? sender, MouseEventArgs e)
|
||||||
|
{
|
||||||
|
if (MainWindow.Instance.PLC.Connected)
|
||||||
|
{
|
||||||
|
//开启转盘
|
||||||
|
if (string.IsNullOrEmpty(iptSpeed.Text))
|
||||||
|
{
|
||||||
|
AntdUI.Message.warn(this, $"请输入速度!", autoClose: 3);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
int speed = 0;
|
||||||
|
|
||||||
|
try
|
||||||
|
{
|
||||||
|
bool isValid = int.TryParse(iptSpeed.Text, out speed);
|
||||||
|
if (!isValid)
|
||||||
|
{
|
||||||
|
AntdUI.Message.warn(this, $"输入的速度不是有效值!", autoClose: 3);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
catch (Exception ex) { }
|
||||||
|
|
||||||
|
MainWindow.Instance.PLC.TurnSpeed(speed);
|
||||||
|
MainWindow.Instance.PLC.TurnDirection(false);
|
||||||
|
MainWindow.Instance.PLC.TurnStart(true);
|
||||||
|
iptPosition.Text = MainWindow.Instance.PLC.ReadVisionPos().ToString();
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
AntdUI.Message.warn(this, $"未连接PLC!", autoClose: 3);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 正转抬起
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="sender"></param>
|
||||||
|
/// <param name="e"></param>
|
||||||
|
private void BtnForward_MouseUp(object? sender, MouseEventArgs e)
|
||||||
|
{
|
||||||
|
if (MainWindow.Instance.PLC.Connected)
|
||||||
|
{
|
||||||
|
MainWindow.Instance.PLC.TurnStart(false);
|
||||||
|
iptPosition.Text = MainWindow.Instance.PLC.ReadVisionPos().ToString();
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
AntdUI.Message.warn(this, $"未连接PLC!", autoClose: 3);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 正转按下
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="sender"></param>
|
||||||
|
/// <param name="e"></param>
|
||||||
|
private void BtnForward_MouseDown(object? sender, MouseEventArgs e)
|
||||||
|
{
|
||||||
|
if (MainWindow.Instance.PLC.Connected)
|
||||||
|
{
|
||||||
|
//开启转盘
|
||||||
|
if (string.IsNullOrEmpty(iptSpeed.Text))
|
||||||
|
{
|
||||||
|
AntdUI.Message.warn(this, $"请输入速度!", autoClose: 3);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
int speed = 0;
|
||||||
|
|
||||||
|
try
|
||||||
|
{
|
||||||
|
bool isValid = int.TryParse(iptSpeed.Text, out speed);
|
||||||
|
if (!isValid)
|
||||||
|
{
|
||||||
|
AntdUI.Message.warn(this, $"输入的速度不是有效值!", autoClose: 3);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
catch (Exception ex) { }
|
||||||
|
|
||||||
|
MainWindow.Instance.PLC.TurnSpeed(speed);
|
||||||
|
MainWindow.Instance.PLC.TurnDirection(true);
|
||||||
|
MainWindow.Instance.PLC.TurnStart(true);
|
||||||
|
iptPosition.Text = MainWindow.Instance.PLC.ReadVisionPos().ToString();
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
AntdUI.Message.warn(this, $"未连接PLC!", autoClose: 3);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 选择背景图
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="sender"></param>
|
||||||
|
/// <param name="e"></param>
|
||||||
|
private void BtnSelectBackImg_Click(object? sender, EventArgs e)
|
||||||
|
{
|
||||||
|
using (OpenFileDialog openFileDialog = new OpenFileDialog())
|
||||||
|
{
|
||||||
|
// 设置对话框标题
|
||||||
|
openFileDialog.Title = "选择背景图片";
|
||||||
|
// 限制文件后缀为 .hdvp
|
||||||
|
openFileDialog.Filter = "图片文件|*.jpg;*.jpeg;*.png;*.bmp";
|
||||||
|
// 禁止多选
|
||||||
|
openFileDialog.Multiselect = false;
|
||||||
|
|
||||||
|
// 显示对话框并等待用户操作
|
||||||
|
if (openFileDialog.ShowDialog() == DialogResult.OK)
|
||||||
|
{
|
||||||
|
string filePath = openFileDialog.FileName;
|
||||||
|
|
||||||
|
iptBackImg.Text = filePath;
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 选择算法
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="sender"></param>
|
||||||
|
/// <param name="e"></param>
|
||||||
|
private void BtnSelectModel_Click(object? sender, EventArgs e)
|
||||||
|
{
|
||||||
|
using (OpenFileDialog openFileDialog = new OpenFileDialog())
|
||||||
|
{
|
||||||
|
// 设置对话框标题
|
||||||
|
openFileDialog.Title = "选择算法文件";
|
||||||
|
// 限制文件后缀为 .hdvp
|
||||||
|
openFileDialog.Filter = "算法文件 (*.hdvp)|*.hdvp";
|
||||||
|
// 禁止多选
|
||||||
|
openFileDialog.Multiselect = false;
|
||||||
|
|
||||||
|
// 显示对话框并等待用户操作
|
||||||
|
if (openFileDialog.ShowDialog() == DialogResult.OK)
|
||||||
|
{
|
||||||
|
string filePath = openFileDialog.FileName;
|
||||||
|
|
||||||
|
iptModel.Text = filePath;
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 加载事件
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="sender"></param>
|
||||||
|
/// <param name="e"></param>
|
||||||
|
private void VisualLocalizationWindow_Load(object? sender, EventArgs e)
|
||||||
|
{
|
||||||
|
sltDirection.SelectedIndex = 0;
|
||||||
|
sltCameraName.Items.Clear();
|
||||||
|
if (MainWindow.Instance.Cameras?.Count > 0)
|
||||||
|
{
|
||||||
|
foreach(var cam in MainWindow.Instance.Cameras)
|
||||||
|
{
|
||||||
|
sltCameraName.Items.Add(cam.CameraName);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
AntdUI.Message.warn(this, $"未找到启用相机!", autoClose: 3);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 窗体对象实例
|
||||||
|
/// </summary>
|
||||||
|
private static VisualLocalizationWindow _instance;
|
||||||
|
|
||||||
|
internal static VisualLocalizationWindow Instance
|
||||||
|
{
|
||||||
|
get
|
||||||
|
{
|
||||||
|
if (_instance == null || _instance.IsDisposed)
|
||||||
|
_instance = new VisualLocalizationWindow();
|
||||||
|
return _instance;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 相机回调
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="dt"></param>
|
||||||
|
/// <param name="camera"></param>
|
||||||
|
/// <param name="imageSet"></param>
|
||||||
|
private void OnCameraHImageOutput(DateTime dt, CameraBase camera, MatSet imageSet)
|
||||||
|
{
|
||||||
|
|
||||||
|
imageViewerControl1.Image = imageSet._mat.ToBitmap();
|
||||||
|
HObject obj = OpenCVHelper.MatToHImage(imageSet._mat);
|
||||||
|
HImage hImage = HalconHelper.ConvertHObjectToHImage(obj);
|
||||||
|
// 调用 ProcCall 的方法
|
||||||
|
ProcCall.SetInputIconicParamObject("INPUT_Image", hImage); // 将图像输入Proc
|
||||||
|
|
||||||
|
ProcCall.SetInputIconicParamObject("BackGroundPic", backImage);
|
||||||
|
|
||||||
|
ProcCall.SetInputCtrlParamTuple("DistThreshold", Convert.ToInt32(iptThreshold.Text));
|
||||||
|
ProcCall.Execute();
|
||||||
|
double nNUm = ProcCall.GetOutputCtrlParamTuple("OUTPUT_Flag");
|
||||||
|
|
||||||
|
if (nNUm == 0)
|
||||||
|
{
|
||||||
|
MainWindow.Instance.PLC.TurnStart(false);
|
||||||
|
iptPosition.Text = MainWindow.Instance.PLC.ReadVisionPos().ToString();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
120
DHSoftware/Views/VisualLocalizationWindow.resx
Normal file
120
DHSoftware/Views/VisualLocalizationWindow.resx
Normal 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>
|
Reference in New Issue
Block a user