diff --git a/DH.Commons.Devies/Base/CameraBase.cs b/DH.Commons.Devies/Base/CameraBase.cs new file mode 100644 index 0000000..8673e88 --- /dev/null +++ b/DH.Commons.Devies/Base/CameraBase.cs @@ -0,0 +1,130 @@ +using System.ComponentModel; +using System.Drawing.Imaging; +using OpenCvSharp; + +namespace DH.Devices.Devices +{ + public class CameraBase + { + public volatile int SnapshotCount = 0; + + public virtual bool isEnabled { get; set; } = false; + + [Category("采图模式")] + [Description("是否连续模式。true:连续模式采图;false:触发模式采图")] + [DisplayName("连续模式")] + public bool IsContinueMode { get; set; } = false; + + + public virtual bool isSavePicEnabled { get; set; } = false; + + + + [Category("图片保存")] + [Description("图片保存文件夹")] + [DisplayName("图片保存文件夹")] + public virtual string ImageSaveDirectory { get; set; } + + [Category("图片保存")] + [Description("图片保存格式")] + [DisplayName("图片保存格式")] + public ImageFormat ImageFormat { get; set; } = ImageFormat.Jpeg; + + [Category("采图模式")] + [Description("是否硬触发模式。true:硬触发;false:软触发")] + [DisplayName("硬触发")] + public bool IsHardwareTrigger { get; set; } = false; + + public string SerialNumber { get; set; } = string.Empty; + public string CameraName { get; set; } = string.Empty; + + public string CameraIP { get; set; } = string.Empty; + + public string ComputerIP { get; set; } = string.Empty; + + // public StreamFormat dvpStreamFormat = dvpStreamFormat.; + + [Category("采图模式")] + [Description("是否传感器直接硬触发。true:传感器硬触发,不通过软件触发;false:通过软件触发IO 的硬触发模式")] + [DisplayName("是否传感器直接硬触发")] + public bool IsDirectHardwareTrigger { get; set; } = false; + + + + /// + /// 增益 + /// + [Category("相机设置")] + [DisplayName("增益")] + [Description("Gain:增益,-1:不设置,不同型号相机的增益,请参考mvs")] + public float Gain { get; set; } = -1; + + [Category("图像旋转")] + [Description("默认旋转,相机开启后默认不旋转")] + [DisplayName("默认旋转")] + public virtual float RotateImage { get; set; } = 0; + + [Category("取像配置")] + [Description("曝光")] + [DisplayName("曝光")] + public virtual float Exposure { get; set; } = 200; + + [Category("相机设置")] + [DisplayName("硬触发后的延迟")] + [Description("TriggerDelay:硬触发后的延迟,单位:us 微秒")] + public float TriggerDelay { get; set; } = 0; + + + + /// + /// 滤波时间 + /// + [Category("相机设置")] + [DisplayName("滤波时间")] + [Description("LineDebouncerTime:I/O去抖时间 单位:us")] + public int LineDebouncerTime { get; set; } = 0; + + + + public Action OnHImageOutput { get; set; } + /// + /// 相机连接 + /// + /// 是否成功 + public virtual bool CameraConnect() { return false; } + + /// + /// 相机断开 + /// + /// 是否成功 + public virtual bool CameraDisConnect() { return false; } + + /// + /// 抓取一张图像 + /// + /// 图像 + //internal virtual HObject GrabOneImage(string cameraName) { return null; } + /// + /// 设置曝光时间 + /// + /// 曝光时间 + public virtual void SetExposure(int exposureTime, string cameraName) { } + /// + /// 设置增益 + /// + /// 增益 + public virtual void SetGain(int gain, string cameraName) { } + /// + /// 设置采集模式 + /// + /// 0=连续采集,即异步采集 1=单次采集,即同步采集 + internal virtual void SetAcquisitionMode(int mode) { } + /// + /// 设置采集图像的ROI + /// + internal virtual void SetAcqRegion(int offsetV, int offsetH, int imageH, int imageW, string cameraName) { } + + + + } +} diff --git a/DH.Commons.Devies/DH.Commons.Devies.csproj b/DH.Commons.Devies/DH.Commons.Devies.csproj new file mode 100644 index 0000000..37c8091 --- /dev/null +++ b/DH.Commons.Devies/DH.Commons.Devies.csproj @@ -0,0 +1,31 @@ + + + + net8.0 + enable + enable + AnyCPU;X64 + True + + + + + + + + + + + + + + + + ..\x64\Debug\halcondotnet.dll + + + ..\x64\Debug\hdevenginedotnet.dll + + + + diff --git a/DH.Commons/Enums/ClassHelper.cs b/DH.Commons/Enums/ClassHelper.cs new file mode 100644 index 0000000..6270021 --- /dev/null +++ b/DH.Commons/Enums/ClassHelper.cs @@ -0,0 +1,16 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace DH.Commons.Enums +{ + public class CameraInfo + { + public string CamName { get; set; } + public string Serinum { get; set; } + public string IP { get; set; } + } + +} diff --git a/DH.Devices.Camera/DH.Devices.Camera.csproj b/DH.Devices.Camera/DH.Devices.Camera.csproj index 428287d..c6c8d9e 100644 --- a/DH.Devices.Camera/DH.Devices.Camera.csproj +++ b/DH.Devices.Camera/DH.Devices.Camera.csproj @@ -13,7 +13,6 @@ - @@ -25,6 +24,7 @@ + diff --git a/DH.Devices.Camera/Do3ThinkCamera.cs b/DH.Devices.Camera/Do3ThinkCamera.cs index 4910eac..a45a77c 100644 --- a/DH.Devices.Camera/Do3ThinkCamera.cs +++ b/DH.Devices.Camera/Do3ThinkCamera.cs @@ -1,6 +1,7 @@ using System.Diagnostics; using System.Reflection.Metadata; using System.Xml.Linq; +using DH.Devices.Devices; using DVPCameraType; using OpenCvSharp; using static System.Net.Mime.MediaTypeNames; @@ -20,6 +21,7 @@ namespace DH.Devices.Camera public int m_n_dev_count = 0; private DVPCamera.dvpStreamCallback ImageCallback; + public dvpStreamFormat dvpStreamFormat = dvpStreamFormat.S_RGB24; public int m_CamCount = 0; public Double m_dfDisplayCount = 0; public Do3ThinkCamera() diff --git a/DH.Devices.Camera/HikVisionCamera.cs b/DH.Devices.Camera/HikVisionCamera.cs index 0cb52a0..159b080 100644 --- a/DH.Devices.Camera/HikVisionCamera.cs +++ b/DH.Devices.Camera/HikVisionCamera.cs @@ -5,6 +5,7 @@ using System.Runtime.InteropServices; using System.Xml.Linq; using DH.Commons.Enums; using static MvCamCtrl.NET.MyCamera; +using DH.Devices.Devices; diff --git a/DHSoftware.sln b/DHSoftware.sln index 0b768df..54646c2 100644 --- a/DHSoftware.sln +++ b/DHSoftware.sln @@ -27,6 +27,8 @@ Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Motion", "Motion", "{5C8472 EndProject Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "DH.Devices.Motion", "DH.Devices.Motion\DH.Devices.Motion.csproj", "{144E3775-0BD7-4528-9FB0-A0F4ADC74313}" EndProject +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "DH.Commons.Devies", "DH.Commons.Devies\DH.Commons.Devies.csproj", "{A33108B6-2740-4D28-AD22-B280372980BE}" +EndProject Global GlobalSection(SolutionConfigurationPlatforms) = preSolution Debug|Any CPU = Debug|Any CPU @@ -83,6 +85,14 @@ Global {144E3775-0BD7-4528-9FB0-A0F4ADC74313}.Release|Any CPU.Build.0 = Release|Any CPU {144E3775-0BD7-4528-9FB0-A0F4ADC74313}.Release|x64.ActiveCfg = Release|x64 {144E3775-0BD7-4528-9FB0-A0F4ADC74313}.Release|x64.Build.0 = Release|x64 + {A33108B6-2740-4D28-AD22-B280372980BE}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {A33108B6-2740-4D28-AD22-B280372980BE}.Debug|Any CPU.Build.0 = Debug|Any CPU + {A33108B6-2740-4D28-AD22-B280372980BE}.Debug|x64.ActiveCfg = Debug|X64 + {A33108B6-2740-4D28-AD22-B280372980BE}.Debug|x64.Build.0 = Debug|X64 + {A33108B6-2740-4D28-AD22-B280372980BE}.Release|Any CPU.ActiveCfg = Release|Any CPU + {A33108B6-2740-4D28-AD22-B280372980BE}.Release|Any CPU.Build.0 = Release|Any CPU + {A33108B6-2740-4D28-AD22-B280372980BE}.Release|x64.ActiveCfg = Release|X64 + {A33108B6-2740-4D28-AD22-B280372980BE}.Release|x64.Build.0 = Release|X64 EndGlobalSection GlobalSection(SolutionProperties) = preSolution HideSolutionNode = FALSE @@ -97,6 +107,7 @@ Global {458B2CF6-6F1B-4B8B-BB85-C6FD7F453A5D} = {2560C5A5-0CA2-48AD-B606-6C55BEFD8109} {5C8472C6-EB6A-4D89-B519-7073BBF6A5D2} = {8EC33C16-65CE-4C12-9C8D-DB2425F9F7C0} {144E3775-0BD7-4528-9FB0-A0F4ADC74313} = {5C8472C6-EB6A-4D89-B519-7073BBF6A5D2} + {A33108B6-2740-4D28-AD22-B280372980BE} = {0AB4BB9A-A861-4F80-B549-CD331490942B} EndGlobalSection GlobalSection(ExtensibilityGlobals) = postSolution SolutionGuid = {6FC1A8DF-636E-434C-981E-10F20FAD723B} diff --git a/DHSoftware/DHSoftware.csproj b/DHSoftware/DHSoftware.csproj index 31c37ee..073fe36 100644 --- a/DHSoftware/DHSoftware.csproj +++ b/DHSoftware/DHSoftware.csproj @@ -12,20 +12,13 @@ WinExe - - - - - - - - - - + + + - + diff --git a/DHSoftware/MainWindow.Designer.cs b/DHSoftware/MainWindow.Designer.cs index 3457d7a..b2b9275 100644 --- a/DHSoftware/MainWindow.Designer.cs +++ b/DHSoftware/MainWindow.Designer.cs @@ -47,17 +47,15 @@ panel2 = new AntdUI.Panel(); panel4 = new AntdUI.Panel(); panel6 = new AntdUI.Panel(); + splitContainer1 = new SplitContainer(); + splitContainer2 = new SplitContainer(); tabImgDisplay = new AntdUI.Tabs(); tabPage1 = new AntdUI.TabPage(); - panel5 = new AntdUI.Panel(); - tabs3 = new AntdUI.Tabs(); + tabsStas = new AntdUI.Tabs(); tabPage3 = new AntdUI.TabPage(); richTextBox1 = new RichTextBox(); - divider3 = new AntdUI.Divider(); - panel3 = new AntdUI.Panel(); - tabs2 = new AntdUI.Tabs(); + tabsConfig = new AntdUI.Tabs(); tabPage2 = new AntdUI.TabPage(); - divider1 = new AntdUI.Divider(); panel1 = new AntdUI.Panel(); segmented1 = new AntdUI.Segmented(); titlebar.SuspendLayout(); @@ -66,12 +64,18 @@ panel2.SuspendLayout(); panel4.SuspendLayout(); panel6.SuspendLayout(); + ((System.ComponentModel.ISupportInitialize)splitContainer1).BeginInit(); + splitContainer1.Panel1.SuspendLayout(); + splitContainer1.Panel2.SuspendLayout(); + splitContainer1.SuspendLayout(); + ((System.ComponentModel.ISupportInitialize)splitContainer2).BeginInit(); + splitContainer2.Panel1.SuspendLayout(); + splitContainer2.Panel2.SuspendLayout(); + splitContainer2.SuspendLayout(); tabImgDisplay.SuspendLayout(); - panel5.SuspendLayout(); - tabs3.SuspendLayout(); + tabsStas.SuspendLayout(); tabPage3.SuspendLayout(); - panel3.SuspendLayout(); - tabs2.SuspendLayout(); + tabsConfig.SuspendLayout(); panel1.SuspendLayout(); SuspendLayout(); // @@ -120,7 +124,6 @@ buttonSZ.Radius = 0; buttonSZ.Size = new Size(50, 40); buttonSZ.TabIndex = 0; - buttonSZ.Visible = false; buttonSZ.WaveSize = 0; // // pageHeader1 @@ -139,7 +142,7 @@ // label1 // label1.AutoSize = true; - label1.Location = new Point(61, 10); + label1.Location = new Point(709, 10); label1.Name = "label1"; label1.Size = new Size(64, 21); label1.TabIndex = 1; @@ -148,10 +151,10 @@ // divider2 // divider2.Dock = DockStyle.Top; - divider2.Location = new Point(0, 0); + divider2.Location = new Point(54, 0); divider2.Name = "divider2"; divider2.OrientationMargin = 0F; - divider2.Size = new Size(1024, 10); + divider2.Size = new Size(970, 10); divider2.TabIndex = 0; divider2.Text = ""; // @@ -169,7 +172,6 @@ // panel2 // panel2.Controls.Add(panel4); - panel2.Controls.Add(panel3); panel2.Dock = DockStyle.Fill; panel2.Location = new Point(0, 68); panel2.Name = "panel2"; @@ -180,71 +182,100 @@ // panel4 // panel4.Controls.Add(panel6); - panel4.Controls.Add(panel5); panel4.Dock = DockStyle.Fill; panel4.Location = new Point(0, 0); panel4.Name = "panel4"; - panel4.Size = new Size(661, 500); + panel4.Size = new Size(1024, 500); panel4.TabIndex = 1; panel4.Text = "panel4"; // // panel6 // - panel6.Controls.Add(tabImgDisplay); + panel6.Controls.Add(splitContainer1); panel6.Dock = DockStyle.Fill; panel6.Location = new Point(0, 0); panel6.Name = "panel6"; - panel6.Size = new Size(661, 358); + panel6.Size = new Size(1024, 500); panel6.TabIndex = 1; panel6.Text = "panel6"; // + // splitContainer1 + // + splitContainer1.BackColor = SystemColors.Control; + splitContainer1.Dock = DockStyle.Fill; + splitContainer1.Location = new Point(0, 0); + splitContainer1.Name = "splitContainer1"; + // + // splitContainer1.Panel1 + // + splitContainer1.Panel1.Controls.Add(splitContainer2); + // + // splitContainer1.Panel2 + // + splitContainer1.Panel2.BackColor = SystemColors.ButtonFace; + splitContainer1.Panel2.Controls.Add(tabsConfig); + splitContainer1.Size = new Size(1024, 500); + splitContainer1.SplitterDistance = 580; + splitContainer1.SplitterIncrement = 2; + splitContainer1.SplitterWidth = 10; + splitContainer1.TabIndex = 0; + // + // splitContainer2 + // + splitContainer2.Dock = DockStyle.Fill; + splitContainer2.Location = new Point(0, 0); + splitContainer2.Name = "splitContainer2"; + splitContainer2.Orientation = Orientation.Horizontal; + // + // splitContainer2.Panel1 + // + splitContainer2.Panel1.Controls.Add(tabImgDisplay); + // + // splitContainer2.Panel2 + // + splitContainer2.Panel2.Controls.Add(tabsStas); + splitContainer2.Size = new Size(580, 500); + splitContainer2.SplitterDistance = 320; + splitContainer2.TabIndex = 0; + // // tabImgDisplay // + tabImgDisplay.Controls.Add(tabPage1); tabImgDisplay.Dock = DockStyle.Fill; tabImgDisplay.Location = new Point(0, 0); tabImgDisplay.Name = "tabImgDisplay"; tabImgDisplay.Pages.Add(tabPage1); - tabImgDisplay.Size = new Size(661, 358); + tabImgDisplay.Size = new Size(580, 320); tabImgDisplay.Style = styleCard1; - tabImgDisplay.TabIndex = 0; + tabImgDisplay.TabIndex = 1; tabImgDisplay.Text = "tabs1"; // // tabPage1 // tabPage1.Location = new Point(3, 28); tabPage1.Name = "tabPage1"; - tabPage1.Size = new Size(655, 327); + tabPage1.Size = new Size(574, 289); tabPage1.TabIndex = 0; tabPage1.Text = "检测"; // - // panel5 + // tabsStas // - panel5.Controls.Add(tabs3); - panel5.Controls.Add(divider3); - panel5.Dock = DockStyle.Bottom; - panel5.Location = new Point(0, 358); - panel5.Name = "panel5"; - panel5.Size = new Size(661, 142); - panel5.TabIndex = 0; - panel5.Text = "panel5"; - // - // tabs3 - // - tabs3.Dock = DockStyle.Fill; - tabs3.Location = new Point(0, 10); - tabs3.Name = "tabs3"; - tabs3.Pages.Add(tabPage3); - tabs3.Size = new Size(661, 132); - tabs3.Style = styleCard2; - tabs3.TabIndex = 2; - tabs3.Text = "tabs3"; + tabsStas.Controls.Add(tabPage3); + tabsStas.Dock = DockStyle.Fill; + tabsStas.Location = new Point(0, 0); + tabsStas.Name = "tabsStas"; + tabsStas.Pages.Add(tabPage3); + tabsStas.Size = new Size(580, 176); + tabsStas.Style = styleCard2; + tabsStas.TabIndex = 3; + tabsStas.Text = "tabs3"; // // tabPage3 // tabPage3.Controls.Add(richTextBox1); tabPage3.Location = new Point(3, 28); tabPage3.Name = "tabPage3"; - tabPage3.Size = new Size(655, 101); + tabPage3.Size = new Size(574, 145); tabPage3.TabIndex = 0; tabPage3.Text = "日志"; // @@ -253,61 +284,30 @@ richTextBox1.Dock = DockStyle.Fill; richTextBox1.Location = new Point(0, 0); richTextBox1.Name = "richTextBox1"; - richTextBox1.Size = new Size(655, 101); + richTextBox1.Size = new Size(574, 145); richTextBox1.TabIndex = 0; richTextBox1.Text = ""; // - // divider3 + // tabsConfig // - divider3.Dock = DockStyle.Top; - divider3.Location = new Point(0, 0); - divider3.Name = "divider3"; - divider3.OrientationMargin = 0F; - divider3.Size = new Size(661, 10); - divider3.TabIndex = 1; - divider3.Text = ""; - // - // panel3 - // - panel3.Controls.Add(tabs2); - panel3.Controls.Add(divider1); - panel3.Dock = DockStyle.Right; - panel3.Location = new Point(661, 0); - panel3.Name = "panel3"; - panel3.Size = new Size(363, 500); - panel3.TabIndex = 0; - panel3.Text = "panel3"; - // - // tabs2 - // - tabs2.Dock = DockStyle.Fill; - tabs2.Location = new Point(10, 0); - tabs2.Name = "tabs2"; - tabs2.Pages.Add(tabPage2); - tabs2.Size = new Size(353, 500); - tabs2.Style = styleCard3; - tabs2.TabIndex = 1; - tabs2.Text = "tabs2"; + tabsConfig.Controls.Add(tabPage2); + tabsConfig.Dock = DockStyle.Fill; + tabsConfig.Location = new Point(0, 0); + tabsConfig.Name = "tabsConfig"; + tabsConfig.Pages.Add(tabPage2); + tabsConfig.Size = new Size(434, 500); + tabsConfig.Style = styleCard3; + tabsConfig.TabIndex = 2; + tabsConfig.Text = "tabs2"; // // tabPage2 // tabPage2.Location = new Point(3, 28); tabPage2.Name = "tabPage2"; - tabPage2.Size = new Size(347, 469); + tabPage2.Size = new Size(428, 469); tabPage2.TabIndex = 0; tabPage2.Text = "配置"; // - // divider1 - // - divider1.Dock = DockStyle.Left; - divider1.Location = new Point(0, 0); - divider1.Name = "divider1"; - divider1.OrientationMargin = 0F; - divider1.Size = new Size(10, 500); - divider1.TabIndex = 0; - divider1.Text = ""; - divider1.Vertical = true; - // // panel1 // panel1.Back = SystemColors.MenuHighlight; @@ -418,12 +418,18 @@ panel2.ResumeLayout(false); panel4.ResumeLayout(false); panel6.ResumeLayout(false); + splitContainer1.Panel1.ResumeLayout(false); + splitContainer1.Panel2.ResumeLayout(false); + ((System.ComponentModel.ISupportInitialize)splitContainer1).EndInit(); + splitContainer1.ResumeLayout(false); + splitContainer2.Panel1.ResumeLayout(false); + splitContainer2.Panel2.ResumeLayout(false); + ((System.ComponentModel.ISupportInitialize)splitContainer2).EndInit(); + splitContainer2.ResumeLayout(false); tabImgDisplay.ResumeLayout(false); - panel5.ResumeLayout(false); - tabs3.ResumeLayout(false); + tabsStas.ResumeLayout(false); tabPage3.ResumeLayout(false); - panel3.ResumeLayout(false); - tabs2.ResumeLayout(false); + tabsConfig.ResumeLayout(false); panel1.ResumeLayout(false); ResumeLayout(false); } @@ -441,17 +447,16 @@ private AntdUI.Panel panel2; private AntdUI.Panel panel4; private AntdUI.Panel panel6; - private AntdUI.Panel panel5; - private AntdUI.Panel panel3; + private Label label1; + private AntdUI.Splitter splitter1; + private SplitContainer splitContainer1; + private SplitContainer splitContainer2; private AntdUI.Tabs tabImgDisplay; private AntdUI.TabPage tabPage1; - private AntdUI.Tabs tabs3; + private AntdUI.Tabs tabsStas; private AntdUI.TabPage tabPage3; - private AntdUI.Divider divider3; - private AntdUI.Tabs tabs2; - private AntdUI.TabPage tabPage2; - private AntdUI.Divider divider1; private RichTextBox richTextBox1; - private Label label1; + private AntdUI.Tabs tabsConfig; + private AntdUI.TabPage tabPage2; } } \ No newline at end of file diff --git a/DHSoftware/MainWindow.cs b/DHSoftware/MainWindow.cs index cb7ad8a..673471c 100644 --- a/DHSoftware/MainWindow.cs +++ b/DHSoftware/MainWindow.cs @@ -2,12 +2,14 @@ using AntdUI.Svg; using DH.Commons.Enums; using DH.Devices.Camera; +using DH.Devices.Devices; using DH.Devices.Motion; using DH.Devices.PLC; using DH.Devices.Vision; using DHSoftware.Languages; using DHSoftware.Models; using DHSoftware.Utils; +using DHSoftware.Views; using DVPCameraType; using HalconDotNet; using Microsoft.Win32; @@ -57,84 +59,89 @@ namespace DHSoftware InitData(); //绑定事件 BindEventHandler(); - tabImgDisplay.Pages.Clear(); - List Cameras = new List - { - new Camera - { - DeviceName = "Cam1", - Alias = "相机1", - ImagePath = @"D:\1.jpeg" - }, - new Camera - { - DeviceName = "Cam2", - Alias = "相机2", - ImagePath = @"D:\2.jpeg" - }, - new Camera - { - DeviceName = "Cam3", - Alias = "相机3", - ImagePath = @"D:\3.jpeg" - }, - new Camera - { - DeviceName = "Cam4", - Alias = "相机4", - ImagePath = @"D:\4.jpeg" - }, - new Camera - { - DeviceName = "Cam5", - Alias = "相机5", - ImagePath = @"D:\5.jpeg" - } - }; + UserConfigFrm userControlFrm = new UserConfigFrm(); + // tabImgDisplay.Pages.Clear(); + // tabPage2.Controls.Clear(); + userControlFrm.Dock = DockStyle.Fill; + tabPage2.Controls.Add(userControlFrm); + + // List Cameras = new List + //{ + // new Camera + // { + // DeviceName = "Cam1", + // Alias = "相机1", + // ImagePath = @"D:\1.jpeg" + // }, + // new Camera + // { + // DeviceName = "Cam2", + // Alias = "相机2", + // ImagePath = @"D:\2.jpeg" + // }, + // new Camera + // { + // DeviceName = "Cam3", + // Alias = "相机3", + // ImagePath = @"D:\3.jpeg" + // }, + // new Camera + // { + // DeviceName = "Cam4", + // Alias = "相机4", + // ImagePath = @"D:\4.jpeg" + // }, + // new Camera + // { + // DeviceName = "Cam5", + // Alias = "相机5", + // ImagePath = @"D:\5.jpeg" + // } + //}; - if (Cameras.Count > 0) - { - tabImgDisplay.Controls.Clear(); - foreach (var cam in Cameras) - { - AntdUI.TabPage tabPage = new AntdUI.TabPage(); - tabPage.Name = $"tab{cam.DeviceName}"; - tabPage.Text = cam.Alias; - //ImgDisplayControl imgDisplayControl = new ImgDisplayControl(); - //imgDisplayControl.Name = $"img{cam.DeviceName}"; - //imgDisplayControl.Dock = DockStyle.Fill; - //tabPage.Controls.Add(imgDisplayControl); - PictureBox pictureBox = new PictureBox(); - pictureBox.Name = $"pic{cam.DeviceName}"; - pictureBox.Dock = DockStyle.Fill; - pictureBox.SizeMode = PictureBoxSizeMode.Zoom; - tabPage.Controls.Add(pictureBox); - tabImgDisplay.Pages.Add(tabPage); + // if (Cameras.Count > 0) + // { + // tabImgDisplay.Controls.Clear(); + // foreach (var cam in Cameras) + // { + // AntdUI.TabPage tabPage = new AntdUI.TabPage(); + // tabPage.Name = $"tab{cam.DeviceName}"; + // tabPage.Text = cam.Alias; + // //ImgDisplayControl imgDisplayControl = new ImgDisplayControl(); + // //imgDisplayControl.Name = $"img{cam.DeviceName}"; + // //imgDisplayControl.Dock = DockStyle.Fill; + // //tabPage.Controls.Add(imgDisplayControl); + // PictureBox pictureBox = new PictureBox(); + // pictureBox.Name = $"pic{cam.DeviceName}"; + // pictureBox.Dock = DockStyle.Fill; + // pictureBox.SizeMode = PictureBoxSizeMode.Zoom; + // tabPage.Controls.Add(pictureBox); + // tabImgDisplay.Pages.Add(tabPage); - } + // } - } + // } } private void RefreshTimer_Tick(object sender, EventArgs e) { - // 获取相机1的控件(通过控件名称查找) - var targetControl = FindControlRecursive(tabImgDisplay, "picCam1") as PictureBox; + //// 获取相机1的控件(通过控件名称查找) + //var targetControl = FindControlRecursive(tabImgDisplay, "picCam1") as PictureBox; - if (targetControl != null) - { - // 生成测试路径(示例路径) - string testPath = $@"D:\{testCounter}.png"; // 循环1-5的图片 - testCounter++; + //if (targetControl != null) + //{ + // // 生成测试路径(示例路径) + // string testPath = $@"D:\{testCounter}.png"; // 循环1-5的图片 + // testCounter++; - // 加载并显示图片 - targetControl.Image = Image.FromFile(testPath); - if (testCounter == 5) - { - testCounter = 1; - } - targetControl.Parent.Invalidate(); - } + // // 加载并显示图片 + // targetControl.Image = Image.FromFile(testPath); + // if (testCounter == 5) + // { + // testCounter = 1; + // } + // targetControl.Parent.Invalidate(); + //} } // 递归查找控件的方法 private Control FindControlRecursive(Control parent, string name) @@ -443,7 +450,7 @@ namespace DHSoftware cam.CameraName = $"Cam{i}"; Cameras.Add(cam); cam.CameraConnect(); - cam.OnHImageOutput += OnCameraHImageOutput; + // cam.OnHImageOutput += OnCameraHImageOutput; } @@ -632,7 +639,7 @@ namespace DHSoftware string logStr = $"时间:{DateTime.Now} 轴{axisIndex}新产品{pieceNumber}加入队列{index}----入料计数{PieceCount}\n"; Task.Run(() => { - this.BeginInvoke(new MethodInvoker(delegate () { richTextBox1.AppendText(logStr); })); + //this.BeginInvoke(new MethodInvoker(delegate () { richTextBox1.AppendText(logStr); })); }); DateTime dtNow = DateTime.Now; @@ -944,493 +951,495 @@ namespace DHSoftware /// /// /// - private void OnCameraHImageOutput(DateTime dt, CameraBase camera, Mat imageSet) - { - - //if (camera.CameraName.Equals("cam1", StringComparison.OrdinalIgnoreCase)) - //{ - // Console.WriteLine(); - //} - //if (camera.CameraName.Equals("cam2", StringComparison.OrdinalIgnoreCase)) - //{ - // Console.WriteLine(); - //} - - // 获取该相机的拍照计数 - uint productNumber = (uint)camera.SnapshotCount; - - Task.Run(async () => - { - using (Mat localImageSet = imageSet.Clone()) // 复制 Mat 避免并发问题 - { - // imageSet?.Dispose(); - // 拍照计数与物件编号一致,查找对应的产品 - ProductData product = null; - //内外壁模组多个相机的处理方法 - //计算队列的方法不变 - int index = PieceNumberToIndex(productNumber); - // 找到产品存放在哪个队列里 - ConcurrentDictionary tmpDic = _productLists[index]; - - try - { - int retryTimes = 100; - while (product == null && retryTimes > 0) - { - if (tmpDic.ContainsKey(productNumber)) - { - product = tmpDic[productNumber]; - } - else - { - // Thread.Sleep(20); - await Task.Delay(20); - } - retryTimes--; - } - // 如果产品为空,则销毁图片,提示错误 - if (null == product) - { - List pnList = tmpDic.Keys.ToList(); - - string pnStr = ""; - if (pnList != null && pnList.Count > 0) - { - pnStr = string.Join(",", pnList); - } - - //LogAsync(DateTime.Now, LogLevel.Error, $"{camera.Name} 未找到产品,编号:{productNumber},队列{index}数量:{tmpDic.Count},列表:{pnStr}"); - localImageSet.Dispose(); - this.BeginInvoke(new MethodInvoker(delegate () - { - - int currentScrollPosition = richTextBox1.GetPositionFromCharIndex(richTextBox1.TextLength).Y; - - richTextBox1.AppendText(productNumber + "提前推出" + camera.CameraName); - - // 设置回原来的滚动位置 - richTextBox1.SelectionStart = richTextBox1.TextLength; - richTextBox1.ScrollToCaret(); - })); - //重新生成实例 销毁之前的实例 - - using (StreamWriter sw = new StreamWriter("D://123log.txt", true, Encoding.UTF8)) - { - sw.WriteLine(productNumber + "提前推出" + camera.CameraName); - } - return; - } - - // LogAsync(DateTime.Now, LogLevel.Information, $"{camera.Name} 找到产品{productNumber},队列{index}数量:{tmpDic.Count}"); - - if (!_cameraRelatedDetectionDict.ContainsKey(camera.CameraName)) - { - - localImageSet.Dispose(); - this.BeginInvoke(new MethodInvoker(delegate () - { - - int currentScrollPosition = richTextBox1.GetPositionFromCharIndex(richTextBox1.TextLength).Y; - - richTextBox1.AppendText(productNumber+"提前推出" + camera.CameraName); - - // 设置回原来的滚动位置 - richTextBox1.SelectionStart = richTextBox1.TextLength; - richTextBox1.ScrollToCaret(); - })); - //重新生成实例 销毁之前的实例 - - using (StreamWriter sw = new StreamWriter("D://123log.txt", true, Encoding.UTF8)) - { - sw.WriteLine(productNumber+"提前推出" + camera.CameraName); - } - // LogAsync(DateTime.Now, LogLevel.Warning, $"{camera.Name} 找到产品{productNumber},但是没有推理1"); - - return; - } - - - double totalTime = 0.0; - List resultStates = new List(); - List? detectionDict = _cameraRelatedDetectionDict[camera.CameraName]; - - - for (int i = 0; i < detectionDict.Count; i++) - { - string detectionId = detectionDict[i]; - - DetectionConfig detectConfig = null; - //找到对应的配置 - if (!string.IsNullOrWhiteSpace(detectionId)) - { - detectConfig = DetectionConfigs.FirstOrDefault(u => u.Id == detectionId); - } - else - { - detectConfig = DetectionConfigs.FirstOrDefault(u => u.CameraSourceId == camera.CameraName); - } - - if (detectConfig == null) - { - - //未能获得检测配置 - return; - } + //private void OnCameraHImageOutput(DateTime dt, CameraBase camera, Mat imageSet) + //{ + + // //if (camera.CameraName.Equals("cam1", StringComparison.OrdinalIgnoreCase)) + // //{ + // // Console.WriteLine(); + // //} + // //if (camera.CameraName.Equals("cam2", StringComparison.OrdinalIgnoreCase)) + // //{ + // // Console.WriteLine(); + // //} + + // // 获取该相机的拍照计数 + // uint productNumber = (uint)camera.SnapshotCount; + + // Task.Run(async () => + // { + // using (Mat localImageSet = imageSet.Clone()) // 复制 Mat 避免并发问题 + // { + // // imageSet?.Dispose(); + // // 拍照计数与物件编号一致,查找对应的产品 + // ProductData product = null; + // //内外壁模组多个相机的处理方法 + // //计算队列的方法不变 + // int index = PieceNumberToIndex(productNumber); + // // 找到产品存放在哪个队列里 + // ConcurrentDictionary tmpDic = _productLists[index]; + + // try + // { + // int retryTimes = 100; + // while (product == null && retryTimes > 0) + // { + // if (tmpDic.ContainsKey(productNumber)) + // { + // product = tmpDic[productNumber]; + // } + // else + // { + // // Thread.Sleep(20); + // await Task.Delay(20); + // } + // retryTimes--; + // } + // // 如果产品为空,则销毁图片,提示错误 + // if (null == product) + // { + // List pnList = tmpDic.Keys.ToList(); + + // string pnStr = ""; + // if (pnList != null && pnList.Count > 0) + // { + // pnStr = string.Join(",", pnList); + // } + + // //LogAsync(DateTime.Now, LogLevel.Error, $"{camera.Name} 未找到产品,编号:{productNumber},队列{index}数量:{tmpDic.Count},列表:{pnStr}"); + // localImageSet.Dispose(); + // this.BeginInvoke(new MethodInvoker(delegate () + // { + + // int currentScrollPosition = richTextBox1.GetPositionFromCharIndex(richTextBox1.TextLength).Y; + + // richTextBox1.AppendText(productNumber + "提前推出" + camera.CameraName); + + // // 设置回原来的滚动位置 + // richTextBox1.SelectionStart = richTextBox1.TextLength; + // richTextBox1.ScrollToCaret(); + // })); + // //重新生成实例 销毁之前的实例 + + // using (StreamWriter sw = new StreamWriter("D://123log.txt", true, Encoding.UTF8)) + // { + // sw.WriteLine(productNumber + "提前推出" + camera.CameraName); + // } + // return; + // } + + // // LogAsync(DateTime.Now, LogLevel.Information, $"{camera.Name} 找到产品{productNumber},队列{index}数量:{tmpDic.Count}"); + + // if (!_cameraRelatedDetectionDict.ContainsKey(camera.CameraName)) + // { + + // localImageSet.Dispose(); + // this.BeginInvoke(new MethodInvoker(delegate () + // { + + // int currentScrollPosition = richTextBox1.GetPositionFromCharIndex(richTextBox1.TextLength).Y; + + // richTextBox1.AppendText(productNumber + "提前推出" + camera.CameraName); + + // // 设置回原来的滚动位置 + // richTextBox1.SelectionStart = richTextBox1.TextLength; + // richTextBox1.ScrollToCaret(); + // })); + // //重新生成实例 销毁之前的实例 + + // using (StreamWriter sw = new StreamWriter("D://123log.txt", true, Encoding.UTF8)) + // { + // sw.WriteLine(productNumber + "提前推出" + camera.CameraName); + // } + // // LogAsync(DateTime.Now, LogLevel.Warning, $"{camera.Name} 找到产品{productNumber},但是没有推理1"); + + // return; + // } + + + // double totalTime = 0.0; + // List resultStates = new List(); + // List? detectionDict = _cameraRelatedDetectionDict[camera.CameraName]; + + + // for (int i = 0; i < detectionDict.Count; i++) + // { + // string detectionId = detectionDict[i]; + + // DetectionConfig detectConfig = null; + // //找到对应的配置 + // if (!string.IsNullOrWhiteSpace(detectionId)) + // { + // detectConfig = DetectionConfigs.FirstOrDefault(u => u.Id == detectionId); + // } + // else + // { + // detectConfig = DetectionConfigs.FirstOrDefault(u => u.CameraSourceId == camera.CameraName); + // } - // 1. 预处理 - using (Mat inferenceImage = localImageSet.Clone()) // 仅在此处克隆,确保推理过程中 Mat 有独立副本 - { - DetectStationResult detectResult = new DetectStationResult(); - #region 1.预处理 + // if (detectConfig == null) + // { - using (Mat PreTMat = inferenceImage.Clone()) - { - PreTreated(detectConfig, detectResult, PreTMat); - } + // //未能获得检测配置 + // return; + // } + // // 1. 预处理 + // using (Mat inferenceImage = localImageSet.Clone()) // 仅在此处克隆,确保推理过程中 Mat 有独立副本 + // { + // DetectStationResult detectResult = new DetectStationResult(); + // #region 1.预处理 + // using (Mat PreTMat = inferenceImage.Clone()) + // { + // PreTreated(detectConfig, detectResult, PreTMat); + // } - #endregion - if (detectResult.IsPreTreatNG) - { - detectResult.ResultState = ResultState.DetectNG; - detectResult.IsPreTreatDone = true; - detectResult.IsMLDetectDone = false; - } + // #endregion + // if (detectResult.IsPreTreatNG) + // { + // detectResult.ResultState = ResultState.DetectNG; + // detectResult.IsPreTreatDone = true; + // detectResult.IsMLDetectDone = false; + // } - if (!string.IsNullOrWhiteSpace(detectConfig.ModelPath) && detectConfig.IsEnabled) - { - SimboStationMLEngineSet mlSet = null; - mlSet = SimboStationMLEngineList.FirstOrDefault(t => t.DetectionId == detectConfig.Id); - if (mlSet == null) - { - // LogAsync(DateTime.Now, LogLevel.Exception, $"异常:{detectConfig.Name}未能获取对应配置的模型检测工具"); - detectResult.IsMLDetectDone = false; + // if (!string.IsNullOrWhiteSpace(detectConfig.ModelPath) && detectConfig.IsEnabled) + // { - //HandleDetectDone(detectResult, detectConfig); - return; - } - #region 2.深度学习推理 - //LogAsync(DateTime.Now, LogLevel.Information, $"{detectConfig.Name} 产品{detectResult.TempPid} 模型检测执行"); + // SimboStationMLEngineSet mlSet = null; + // mlSet = SimboStationMLEngineList.FirstOrDefault(t => t.DetectionId == detectConfig.Id); + // if (mlSet == null) + // { + // // LogAsync(DateTime.Now, LogLevel.Exception, $"异常:{detectConfig.Name}未能获取对应配置的模型检测工具"); + // detectResult.IsMLDetectDone = false; - if (!string.IsNullOrWhiteSpace(detectConfig.ModelPath)) - { - Stopwatch mlWatch = new Stopwatch(); - var req = new MLRequest(); - //之前的检测图片都是相机存储成HImage + // //HandleDetectDone(detectResult, detectConfig); + // return; + // } + // #region 2.深度学习推理 + // //LogAsync(DateTime.Now, LogLevel.Information, $"{detectConfig.Name} 产品{detectResult.TempPid} 模型检测执行"); - req.ResizeWidth = (int)detectConfig.ModelWidth; - req.ResizeHeight = (int)detectConfig.ModelHeight; - // req.LabelNames = detectConfig.GetLabelNames(); - // req.Score = IIConfig.Score; - req.mImage = inferenceImage.Clone(); + // if (!string.IsNullOrWhiteSpace(detectConfig.ModelPath)) + // { + // Stopwatch mlWatch = new Stopwatch(); + // var req = new MLRequest(); + // //之前的检测图片都是相机存储成HImage - req.in_lable_path = detectConfig.in_lable_path; - req.confThreshold = detectConfig.ModelconfThreshold; - req.iouThreshold = 0.3f; - req.segmentWidth = 320; - req.out_node_name = "output0"; - switch (detectConfig.ModelType) - { - case MLModelType.ImageClassification: - break; - case MLModelType.ObjectDetection: + // req.ResizeWidth = (int)detectConfig.ModelWidth; + // req.ResizeHeight = (int)detectConfig.ModelHeight; + // // req.LabelNames = detectConfig.GetLabelNames(); + // // req.Score = IIConfig.Score; + // req.mImage = inferenceImage.Clone(); - break; - case MLModelType.SemanticSegmentation: - break; - case MLModelType.InstanceSegmentation: - break; - case MLModelType.ObjectGPUDetection: - - break; - default: - break; - } + // req.in_lable_path = detectConfig.in_lable_path; - // LogAsync(DateTime.Now, LogLevel.Information, $"{detectConfig.Name} 产品{detectResult.TempPid} RunInference BEGIN"); - mlWatch.Start(); - //20230802改成多线程推理 RunInferenceFixed - - var result = mlSet.StationMLEngine.RunInference(req); - // var result = mlSet.StationMLEngine.RunInferenceFixed(req); - mlWatch.Stop(); - // LogAsync(DateTime.Now, LogLevel.Information, $"{detectConfig.Name} 产品{detectResult.TempPid} RunInference END"); + // req.confThreshold = detectConfig.ModelconfThreshold; + // req.iouThreshold = 0.3f; + // req.segmentWidth = 320; + // req.out_node_name = "output0"; + // switch (detectConfig.ModelType) + // { + // case MLModelType.ImageClassification: + // break; + // case MLModelType.ObjectDetection: + // break; + // case MLModelType.SemanticSegmentation: + // break; + // case MLModelType.InstanceSegmentation: + // break; + // case MLModelType.ObjectGPUDetection: + + // break; + // default: + // break; + // } + // // LogAsync(DateTime.Now, LogLevel.Information, $"{detectConfig.Name} 产品{detectResult.TempPid} RunInference BEGIN"); + // mlWatch.Start(); + // //20230802改成多线程推理 RunInferenceFixed + + // var result = mlSet.StationMLEngine.RunInference(req); + // // var result = mlSet.StationMLEngine.RunInferenceFixed(req); + // 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(); - - - - - if (result == null || (result != null && !result.IsSuccess)) - { - detectResult.IsMLDetectDone = false; - } - if (result != null && result.IsSuccess) - { - detectResult.DetectDetails = result.ResultDetails; - if (detectResult.DetectDetails != null) - { - } - else - { - detectResult.IsMLDetectDone = false; - } - } - } - #endregion + // // 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(); + + + + + // if (result == null || (result != null && !result.IsSuccess)) + // { + // detectResult.IsMLDetectDone = false; + // } + // if (result != null && result.IsSuccess) + // { + // detectResult.DetectDetails = result.ResultDetails; + // if (detectResult.DetectDetails != null) + // { + // } + // else + // { + // detectResult.IsMLDetectDone = false; + // } + // } + // } + // #endregion - #region 3.后处理 - #endregion - //根据那些得分大于阈值的推理结果,判断产品是否成功 - #region 4.最终过滤(逻辑过滤) - detectResult.DetectDetails?.ForEach(d => - { - //当前检测项的 过滤条件 - //var conditionList = detectConfig.DetectionFilterList - // .Where(u => u.IsEnabled && u.LabelName == d.LabelName) - // .GroupBy(u => u.ResultState) - // .OrderBy(u => u.Key) - // .ToList(); - //当前检测项的 过滤条件 - var conditionList = detectConfig.DetectionFilterList - .Where(u => u.IsEnabled && u.LabelName == d.LabelName) - .GroupBy(u => u.ResultState) - .OrderBy(u => u.Key) - .ToList(); + // #region 3.后处理 + // #endregion + // //根据那些得分大于阈值的推理结果,判断产品是否成功 + // #region 4.最终过滤(逻辑过滤) + // detectResult.DetectDetails?.ForEach(d => + // { - if (conditionList.Count == 0) - { - d.FinalResult = d.LabelName.ToLower() == "ok" - ? ResultState.OK - : ResultState.DetectNG; - } - else - { - d.FinalResult = detectConfig.IsMixModel - ? ResultState.A_NG - : ResultState.OK; + // //当前检测项的 过滤条件 + // //var conditionList = detectConfig.DetectionFilterList + // // .Where(u => u.IsEnabled && u.LabelName == d.LabelName) + // // .GroupBy(u => u.ResultState) + // // .OrderBy(u => u.Key) + // // .ToList(); + // //当前检测项的 过滤条件 + // var conditionList = detectConfig.DetectionFilterList + // .Where(u => u.IsEnabled && u.LabelName == d.LabelName) + // .GroupBy(u => u.ResultState) + // .OrderBy(u => u.Key) + // .ToList(); + // if (conditionList.Count == 0) + // { - } + // d.FinalResult = d.LabelName.ToLower() == "ok" + // ? ResultState.OK + // : ResultState.DetectNG; + // } + // else + // { + // d.FinalResult = detectConfig.IsMixModel + // ? ResultState.A_NG + // : ResultState.OK; - foreach (IGrouping group in conditionList) - { - //bool b = group.ToList().Any(f => - //{ - // return f.FilterOperation(d); - //}); - - - //if (b) - //{ - // d.FinalResult = group.Key; - // break; - //} - - if (group.Any(f => f.FilterOperation(d))) - { - d.FinalResult = group.Key; - break; - } - //else - //{ - // d.FinalResult = d.InferenceResult = ResultState.OK; - //} - } - }); - #endregion - #region 5.统计缺陷过滤结果或预处理直接NG - //if (detectResult.DetectDetails?.Count > 0) - //{ - // detectResult.ResultState = detectResult.DetectDetails.GroupBy(u => u.FinalResult).OrderBy(u => u.Key).First().First().FinalResult; - // detectResult.ResultLabel = detectResult.ResultLabel; - // detectResult.ResultLabelCategoryId = detectResult.ResultLabel;//TODO:设置优先级 - - - //} - detectResult.ResultState = detectResult.DetectDetails? - .GroupBy(u => u.FinalResult) - .OrderBy(u => u.Key) - .FirstOrDefault()?.Key ?? ResultState.OK; - detectResult.ResultLabel = detectResult.ResultLabel; - detectResult.ResultLabelCategoryId = detectResult.ResultLabel;//TODO:设置优先级 - #endregion - - resultStates.Add(detectResult.ResultState); - - product.ResultCollection.Add(detectResult); + // } + // foreach (IGrouping group in conditionList) + // { + // //bool b = group.ToList().Any(f => + // //{ + // // return f.FilterOperation(d); + // //}); + + + // //if (b) + // //{ + // // d.FinalResult = group.Key; + // // break; + // //} + + // if (group.Any(f => f.FilterOperation(d))) + // { + // d.FinalResult = group.Key; + // break; + // } + // //else + // //{ + // // d.FinalResult = d.InferenceResult = ResultState.OK; + // //} + // } + // }); + // #endregion + // #region 5.统计缺陷过滤结果或预处理直接NG + // //if (detectResult.DetectDetails?.Count > 0) + // //{ + // // detectResult.ResultState = detectResult.DetectDetails.GroupBy(u => u.FinalResult).OrderBy(u => u.Key).First().First().FinalResult; + // // detectResult.ResultLabel = detectResult.ResultLabel; + // // detectResult.ResultLabelCategoryId = detectResult.ResultLabel;//TODO:设置优先级 + + + // //} + // detectResult.ResultState = detectResult.DetectDetails? + // .GroupBy(u => u.FinalResult) + // .OrderBy(u => u.Key) + // .FirstOrDefault()?.Key ?? ResultState.OK; + // detectResult.ResultLabel = detectResult.ResultLabel; + // detectResult.ResultLabelCategoryId = detectResult.ResultLabel;//TODO:设置优先级 + // #endregion + + // resultStates.Add(detectResult.ResultState); + + // product.ResultCollection.Add(detectResult); - } - } + // } - } + // } - product.InferenceOne(); - - // LogAsync(DateTime.Now, LogLevel.Information, $"{camera.Name} 推理完成,产品{productNumber}"); - - if (!product.InferenceFinished()) - { - return; - } - ProductNum_Total++; - CalculateOEE(); - this.BeginInvoke(new MethodInvoker(delegate () - { - - int currentScrollPosition = richTextBox1.GetPositionFromCharIndex(richTextBox1.TextLength).Y; - - richTextBox1.AppendText($"统计结果成功,{productNumber} 吹气!\n"); + // } - // 设置回原来的滚动位置 - richTextBox1.SelectionStart = richTextBox1.TextLength; - richTextBox1.ScrollToCaret(); - })); - #region 6. 统计产品结果 - product.ProductResult = product.ResultCollection.Any(u => u.ResultState != ResultState.OK) - ? ResultState.B_NG - : ResultState.OK; - product.ProductLabelCategory = product.ProductResult.GetEnumDescription(); - product.ProductLabel = product.ProductResult.GetEnumDescription(); - #endregion - #region 7.产品吹气 + // product.InferenceOne(); + + // // LogAsync(DateTime.Now, LogLevel.Information, $"{camera.Name} 推理完成,产品{productNumber}"); + + // if (!product.InferenceFinished()) + // { - #endregion + // return; + // } + // ProductNum_Total++; + // CalculateOEE(); + // this.BeginInvoke(new MethodInvoker(delegate () + // { + + // int currentScrollPosition = richTextBox1.GetPositionFromCharIndex(richTextBox1.TextLength).Y; + + // richTextBox1.AppendText($"统计结果成功,{productNumber} 吹气!\n"); + // // 设置回原来的滚动位置 + // richTextBox1.SelectionStart = richTextBox1.TextLength; + // richTextBox1.ScrollToCaret(); + // })); + // #region 6. 统计产品结果 + // product.ProductResult = product.ResultCollection.Any(u => u.ResultState != ResultState.OK) + // ? ResultState.B_NG + // : ResultState.OK; + // product.ProductLabelCategory = product.ProductResult.GetEnumDescription(); + // product.ProductLabel = product.ProductResult.GetEnumDescription(); + // #endregion + // #region 7.产品吹气 + // #endregion - // 出列 - ProductData temp = null; - int tryTimes = 10; - while (temp == null && tryTimes > 0) - { - if (tmpDic.TryRemove(productNumber, out temp)) - { - break; - } - tryTimes--; - Thread.Sleep(5); - } - if (temp == null) - { - string logStr = $"{DateTime.Now}产品{productNumber}出列失败:true," + - $"当前队列产品数量:{tmpDic.Count}"; - this.BeginInvoke(new MethodInvoker(delegate () - { + // // 出列 + // ProductData temp = null; - int currentScrollPosition = richTextBox1.GetPositionFromCharIndex(richTextBox1.TextLength).Y; + // int tryTimes = 10; + // while (temp == null && tryTimes > 0) + // { + // if (tmpDic.TryRemove(productNumber, out temp)) + // { + // break; + // } - richTextBox1.AppendText(logStr); + // tryTimes--; + // Thread.Sleep(5); + // } + // if (temp == null) + // { + // string logStr = $"{DateTime.Now}产品{productNumber}出列失败:true," + + // $"当前队列产品数量:{tmpDic.Count}"; + // this.BeginInvoke(new MethodInvoker(delegate () + // { - // 设置回原来的滚动位置 - richTextBox1.SelectionStart = richTextBox1.TextLength; - richTextBox1.ScrollToCaret(); - })); - } - else - { - try - { - string logStr = $"{DateTime.Now}产品{productNumber}出列成功:true," + - $"产品结果:{temp.ProductResult.GetEnumDescription()}," + - $"当前队列产品数量:{tmpDic.Count}"; - this.BeginInvoke(new MethodInvoker(delegate () - { + // int currentScrollPosition = richTextBox1.GetPositionFromCharIndex(richTextBox1.TextLength).Y; - int currentScrollPosition = richTextBox1.GetPositionFromCharIndex(richTextBox1.TextLength).Y; + // richTextBox1.AppendText(logStr); - richTextBox1.AppendText(logStr); + // // 设置回原来的滚动位置 + // richTextBox1.SelectionStart = richTextBox1.TextLength; + // richTextBox1.ScrollToCaret(); + // })); + // } + // else + // { + // try + // { + // string logStr = $"{DateTime.Now}产品{productNumber}出列成功:true," + + // $"产品结果:{temp.ProductResult.GetEnumDescription()}," + + // $"当前队列产品数量:{tmpDic.Count}"; + // this.BeginInvoke(new MethodInvoker(delegate () + // { + + // int currentScrollPosition = richTextBox1.GetPositionFromCharIndex(richTextBox1.TextLength).Y; + + // richTextBox1.AppendText(logStr); + + // // 设置回原来的滚动位置 + // richTextBox1.SelectionStart = richTextBox1.TextLength; + // richTextBox1.ScrollToCaret(); + // })); + // //重新生成实例 销毁之前的实例 + // var saveData = temp.GetProductData(); + // using (StreamWriter sw = new StreamWriter("D://123log.txt", true, Encoding.UTF8)) + // { + // sw.WriteLine(logStr); + // } + + // } + // catch (Exception) { } + // finally + // { + // // temp.Dispose(); + // temp = null; + // } + // } + + // // UpdateCT((float)(dtNow - _ctTime).TotalSeconds); + // //_ctTime = dtNow; + // // }); + + + // } + // catch (Exception ex) + // { + // //LogAsync(DateTime.Now, LogLevel.Error, $"流程检测未捕获的异常:{ex.GetExceptionMessage()}"); + // product?.Dispose(); + // } + // } + + // }); + //} - // 设置回原来的滚动位置 - richTextBox1.SelectionStart = richTextBox1.TextLength; - richTextBox1.ScrollToCaret(); - })); - //重新生成实例 销毁之前的实例 - var saveData = temp.GetProductData(); - using (StreamWriter sw = new StreamWriter("D://123log.txt", true, Encoding.UTF8)) - { - sw.WriteLine(logStr); - } - } - catch (Exception) { } - finally - { - // temp.Dispose(); - temp = null; - } - } - - // UpdateCT((float)(dtNow - _ctTime).TotalSeconds); - //_ctTime = dtNow; - // }); - - - } - catch (Exception ex) - { - //LogAsync(DateTime.Now, LogLevel.Error, $"流程检测未捕获的异常:{ex.GetExceptionMessage()}"); - product?.Dispose(); - } - } - - }); - } public void SetResult() { @@ -1488,6 +1497,8 @@ namespace DHSoftware { // Add the code for the "设置" button click here MessageBox.Show("设置按钮按下"); + + } private void HandleLoginButton() @@ -1496,5 +1507,9 @@ namespace DHSoftware MessageBox.Show("登录按钮按下"); } + private void splitter1_SplitterMoved(object sender, SplitterEventArgs e) + { + + } } } diff --git a/DHSoftware/Models/DataUtil.cs b/DHSoftware/Models/DataUtil.cs new file mode 100644 index 0000000..be083ca --- /dev/null +++ b/DHSoftware/Models/DataUtil.cs @@ -0,0 +1,227 @@ +using System.Collections.Generic; + +namespace AntdUIDemo.Models +{ + public class DataUtil + { + public static readonly Dictionary> Menu_decetion = new Dictionary>() + { + { "检测项", new List + { + new MenuItems { Text = "工位1" , Tag = "工位1"}, + new MenuItems { Text = "工位2", Tag = "工位2"}, + new MenuItems { Text = "工位3", Tag = "工位3"}, + } + }, + //{ "布局", new List + // { + // new MenuItems { Text = "Divider 分割线", Tag = "Divider" }, + // new MenuItems { Text = "FlowPanel 流动布局", Tag = "FlowPanel"}, + // new MenuItems { Text = "GridPanel 网格布局", Tag = "GridPanel"}, + // new MenuItems { Text = "Panel 面板", Tag = "Panel"}, + // new MenuItems { Text = "Splitter 分隔面板", Tag = "Splitter"}, + // new MenuItems { Text = "StackPanel 堆叠布局", Tag = "StackPanel"} + // } + //}, + //{ "导航", new List + // { + // new MenuItems { Text = "Breadcrumb 面包屑", Tag = "Breadcrumb"}, + // new MenuItems { Text = "Dropdown 下拉菜单", Tag = "Dropdown"}, + // new MenuItems { Text = "Menu 导航菜单", Tag = "Menu"}, + // new MenuItems { Text = "Pagination 分页", Tag = "Pagination"}, + // new MenuItems { Text = "Steps 步骤条", Tag = "Steps"} + // } + //}, + //{ "数据录入", new List + // { + // new MenuItems { Text = "Checkbox 多选框", Tag = "Checkbox"}, + // new MenuItems { Text = "ColorPicker 颜色选择器", Tag = "ColorPicker"}, + // new MenuItems { Text = "DatePicker 日期选择器", Tag = "DatePicker"}, + // new MenuItems { Text = "DatePickerRange 日期范围选择器", Tag = "DatePickerRange"}, + // new MenuItems { Text = "Input 输入框", Tag = "Input"}, + // new MenuItems { Text = "InputNumber 数字输入框", Tag = "InputNumber"}, + // new MenuItems { Text = "Radio 单选框", Tag = "Radio"}, + // new MenuItems { Text = "Rate 评分", Tag = "Rate"}, + // new MenuItems { Text = "Select 选择器", Tag = "Select"}, + // new MenuItems { Text = "SelectMultiple 多选选择器", Tag = "SelectMultiple"}, + // new MenuItems { Text = "Slider 滑动输入条", Tag = "Slider"}, + // new MenuItems { Text = "SliderRange 滑动范围输入条", Tag = "SliderRange"}, + // new MenuItems { Text = "Switch 开关", Tag = "Switch"}, + // new MenuItems { Text = "TimePicker 时间选择框", Tag = "TimePicker"}, + // new MenuItems { Text = "UploadDragger 上传", Tag = "UploadDragger"} + // } + //}, + //{ "数据展示", new List + // { + // new MenuItems { Text = "Avatar 头像", Tag = "Avatar"}, + // new MenuItems { Text = "Badge 徽标数", Tag = "Badge"}, + // new MenuItems { Text = "Calendar 日历", Tag = "Calendar"}, + // new MenuItems { Text = "Carousel 走马灯", Tag = "Carousel"}, + // new MenuItems { Text = "Collapse 折叠面板", Tag = "Collapse"}, + // new MenuItems { Text = "Label 标签", Tag = "Label"}, + // new MenuItems { Text = "LabelTime 时间标签", Tag = "LabelTime"}, + // new MenuItems { Text = "Popover 气泡卡片", Tag = "Popover"}, + // new MenuItems { Text = "Preview 图片预览", Tag = "Preview"}, + // new MenuItems { Text = "Segmented 分段控制器", Tag = "Segmented"}, + // new MenuItems { Text = "Table 表格", Tag = "Table"}, + // new MenuItems { Text = "Tabs 标签页", Tag = "Tabs"}, + // new MenuItems { Text = "Tag 标签", Tag = "Tag"}, + // new MenuItems { Text = "Timeline 时间轴", Tag = "Timeline"}, + // new MenuItems { Text = "Tooltip 文字提示", Tag = "Tooltip"}, + // new MenuItems { Text = "Tour 漫游式引导" , Tag = "Tour"}, + // new MenuItems { Text = "Tree 树形控件", Tag = "Tree"} + // } + //}, + //{ "反馈", new List + // { + // new MenuItems { Text = "Alert 警告提示", Tag = "Alert"}, + // new MenuItems { Text = "Drawer 抽屉", Tag = "Drawer"}, + // new MenuItems { Text = "Message 全局提示", Tag = "Message"}, + // new MenuItems { Text = "Modal 对话框", Tag = "Modal"}, + // new MenuItems { Text = "Notification 通知提醒框", Tag = "Notification"}, + // new MenuItems { Text = "Progress 进度条", Tag = "Progress"}, + // new MenuItems { Text = "Spin 加载中", Tag = "Spin"} + // } + //}, + //{ "聊天", new List + // { + // new MenuItems { Text = "ChatList 气泡聊天列表", Tag = "ChatList"}, + // new MenuItems { Text = "MsgList 好友消息列表", Tag = "MsgList"} + // } + //}, + //{ "其它", new List + // { + // new MenuItems { Text = "Battery 电池", Tag = "Battery" }, + // new MenuItems { Text = "ContextMenuStrip 快捷菜单", Tag = "ContextMenuStrip" }, + // new MenuItems { Text = "Image3D 图片3D", Tag = "Image3D" }, + // new MenuItems { Text = "PageHeader 页头", Tag= "PageHeader"}, + // new MenuItems { Text = "Signal 信号", Tag = "Signal" } + // } + //} + }; + + public static readonly Dictionary MenuIcons_zhcn = new Dictionary +{ + { "通用", "AppstoreOutlined" }, + { "布局", "LayoutOutlined" }, + { "导航", "CompressOutlined" }, + { "数据录入", "EditOutlined" }, + { "数据展示", "BarChartOutlined" }, + { "反馈", "NotificationOutlined" }, + { "聊天", "MessageOutlined" }, + { "其它", "SettingOutlined" } +}; + + public static readonly Dictionary> MenuItems_enus = new Dictionary>() + { + { "General", new List + { + new MenuItems { Text = "Button" , Tag = "Button"}, + new MenuItems { Text = "FloatButton", Tag = "FloatButton"}, + new MenuItems { Text = "Icon", Tag = "Icon"}, + } + }, + { "Layout", new List + { + new MenuItems { Text = "Divider", Tag = "Divider" }, + new MenuItems { Text = "FlowPanel", Tag = "FlowPanel"}, + new MenuItems { Text = "GridPanel", Tag = "GridPanel"}, + new MenuItems { Text = "Panel", Tag = "Panel"}, + new MenuItems { Text = "Splitter ", Tag = "Splitter"}, + new MenuItems { Text = "StackPanel", Tag = "StackPanel"} + } + }, + { "Navigation", new List + { + new MenuItems { Text = "Breadcrumb", Tag = "Breadcrumb"}, + new MenuItems { Text = "Dropdown", Tag = "Dropdown"}, + new MenuItems { Text = "Menu", Tag = "Menu"}, + new MenuItems { Text = "Pagination", Tag = "Pagination"}, + new MenuItems { Text = "Steps", Tag = "Steps"} + } + }, + { "Data Entry", new List + { + new MenuItems { Text = "Checkbox", Tag = "Checkbox"}, + new MenuItems { Text = "ColorPicker", Tag = "ColorPicker"}, + new MenuItems { Text = "DatePicker", Tag = "DatePicker"}, + new MenuItems { Text = "DatePickerRange", Tag = "DatePickerRange"}, + new MenuItems { Text = "Input", Tag = "Input"}, + new MenuItems { Text = "InputNumber", Tag = "InputNumber"}, + new MenuItems { Text = "Radio", Tag = "Radio"}, + new MenuItems { Text = "Rate", Tag = "Rate"}, + new MenuItems { Text = "Select", Tag = "Select"}, + new MenuItems { Text = "SelectMultiple", Tag = "SelectMultiple"}, + new MenuItems { Text = "Slider", Tag = "Slider"}, + new MenuItems { Text = "SliderRange", Tag = "SliderRange"}, + new MenuItems { Text = "Switch", Tag = "Switch"}, + new MenuItems { Text = "TimePicker", Tag = "TimePicker"}, + new MenuItems { Text = "UploadDragger", Tag = "UploadDragger"} + } + }, + { "Data Display", new List + { + new MenuItems { Text = "Avatar", Tag = "Avatar"}, + new MenuItems { Text = "Badge", Tag = "Badge"}, + new MenuItems { Text = "Calendar", Tag = "Calendar"}, + new MenuItems { Text = "Carousel", Tag = "Carousel"}, + new MenuItems { Text = "Collapse", Tag = "Collapse"}, + new MenuItems { Text = "Label", Tag = "Label"}, + new MenuItems { Text = "LabelTime", Tag = "LabelTime"}, + new MenuItems { Text = "Popover", Tag = "Popover"}, + new MenuItems { Text = "Preview", Tag = "Preview"}, + new MenuItems { Text = "Segmented", Tag = "Segmented"}, + new MenuItems { Text = "Table", Tag = "Table"}, + new MenuItems { Text = "Tabs", Tag = "Tabs"}, + new MenuItems { Text = "Tag", Tag = "Tag"}, + new MenuItems { Text = "Timeline", Tag = "Timeline"}, + new MenuItems { Text = "Tooltip", Tag = "Tooltip"}, + new MenuItems { Text = "Tour" , Tag = "Tour"}, + new MenuItems { Text = "Tree", Tag = "Tree"} + } + }, + { "Feedback", new List + { + new MenuItems { Text = "Alert", Tag = "Alert"}, + new MenuItems { Text = "Drawer", Tag = "Drawer"}, + new MenuItems { Text = "Message", Tag = "Message"}, + new MenuItems { Text = "Modal", Tag = "Modal"}, + new MenuItems { Text = "Notification", Tag = "Notification"}, + new MenuItems { Text = "Progress", Tag = "Progress"}, + new MenuItems { Text = "Spin", Tag = "Spin"} + } + }, + { "Chat", new List + { + new MenuItems { Text = "ChatList", Tag = "ChatList"}, + new MenuItems { Text = "MsgList", Tag = "MsgList"} + } + }, + { "Other", new List + { + new MenuItems { Text = "Battery", Tag = "Battery" }, + new MenuItems { Text = "ContextMenuStrip", Tag = "ContextMenuStrip" }, + new MenuItems { Text = "Image3D", Tag = "Image3D" }, + new MenuItems { Text = "PageHeader", Tag= "PageHeader"}, + new MenuItems { Text = "Signal", Tag = "Signal" } + } + } + }; + + public static readonly Dictionary MenuIcons_enus = new Dictionary +{ + { "General", "AppstoreOutlined" }, + { "Layout", "LayoutOutlined" }, + { "Navigation", "CompressOutlined" }, + { "Data Entry", "EditOutlined" }, + { "Data Display", "BarChartOutlined" }, + { "Feedback", "NotificationOutlined" }, + { "Chat", "MessageOutlined" }, + { "Other", "SettingOutlined" } +}; + + + } + + +} diff --git a/DHSoftware/Models/MenuItems.cs b/DHSoftware/Models/MenuItems.cs new file mode 100644 index 0000000..f7f9b3d --- /dev/null +++ b/DHSoftware/Models/MenuItems.cs @@ -0,0 +1,9 @@ +namespace AntdUIDemo.Models +{ + public class MenuItems + { + public string IconSvg { get; set; } = null; + public string Text { get; set; } = string.Empty; + public string Tag { get; set; } = null; + } +} diff --git a/DHSoftware/Models/User.cs b/DHSoftware/Models/User.cs new file mode 100644 index 0000000..789392d --- /dev/null +++ b/DHSoftware/Models/User.cs @@ -0,0 +1,166 @@ +using AntdUI; + +namespace AntdUIDemo.Models +{ + public class User : NotifyProperty + { + private bool selected = false; + private string name; + private int age = 0; + private string address; + private bool enabled = false; + private CellImage[] cellImages; + private CellTag[] cellTags; + private CellBadge cellBadge; + private CellText cellText; + private CellLink[] cellLinks; + private CellProgress cellProgress; + private CellDivider cellDivider; + //用于设置树形表格,加入自身数组 + private User[] users; + + public bool Selected + { + get { return selected; } + set + { + if (selected == value) return; + selected = value; + OnPropertyChanged(nameof(Selected)); + } + } + + public string Name + { + get { return name; } + set + { + if (name == value) return; + name = value; + OnPropertyChanged(nameof(Name)); + } + } + + public int Age + { + get { return age; } + set + { + if (age == value) return; + age = value; + OnPropertyChanged(nameof(Age)); + } + } + + public string Address + { + get { return address; } + set + { + if (address == value) return; + address = value; + OnPropertyChanged(nameof(Address)); + } + } + + public bool Enabled + { + get { return enabled; } + set + { + if (enabled == value) return; + enabled = value; + OnPropertyChanged(nameof(Enabled)); + } + } + + public CellImage[] CellImages + { + get { return cellImages; } + set + { + if (cellImages == value) return; + cellImages = value; + OnPropertyChanged(nameof(CellImages)); + } + } + + public CellTag[] CellTags + { + get { return cellTags; } + set + { + if (cellTags == value) return; + cellTags = value; + OnPropertyChanged(nameof(CellTags)); + } + } + + public CellBadge CellBadge + { + get { return cellBadge; } + set + { + if (cellBadge == value) return; + cellBadge = value; + OnPropertyChanged(nameof(CellBadge)); + } + } + + public CellText CellText + { + get { return cellText; } + set + { + if (cellText == value) return; + cellText = value; + OnPropertyChanged(nameof(CellText)); + } + } + + public CellLink[] CellLinks + { + get { return cellLinks; } + set + { + if (cellLinks == value) return; + cellLinks = value; + OnPropertyChanged(nameof(CellLinks)); + } + } + + public CellProgress CellProgress + { + get { return cellProgress; } + set + { + if (cellProgress == value) return; + cellProgress = value; + OnPropertyChanged(nameof(CellProgress)); + } + } + + public CellDivider CellDivider + { + get { return cellDivider; } + set + { + if (cellDivider == value) return; + cellDivider = value; + OnPropertyChanged(nameof(CellDivider)); + } + } + + public User[] Users + { + get { return users; } + set + { + if (users == value) return; + users = value; + OnPropertyChanged(nameof(Users)); + } + + } + } +} diff --git a/DHSoftware/Views/CamConfigFrm.Designer.cs b/DHSoftware/Views/CamConfigFrm.Designer.cs index 1513268..442fbd7 100644 --- a/DHSoftware/Views/CamConfigFrm.Designer.cs +++ b/DHSoftware/Views/CamConfigFrm.Designer.cs @@ -2,6 +2,7 @@ { partial class CamConfigFrm { + /// /// 必需的设计器变量。 /// @@ -28,17 +29,135 @@ /// private void InitializeComponent() { + AntdUI.Tabs.StyleLine styleLine1 = new AntdUI.Tabs.StyleLine(); + tabs1 = new AntdUI.Tabs(); + tabPage1 = new AntdUI.TabPage(); + label1 = new Label(); + btnRefreshCamList = new Button(); + dgvCams = new DataGridView(); + CamName = new DataGridViewTextBoxColumn(); + Serinum = new DataGridViewTextBoxColumn(); + IP = new DataGridViewTextBoxColumn(); + COMBO_DEVICES = new ComboBox(); + btnsubmit = new Button(); + tabs1.SuspendLayout(); + tabPage1.SuspendLayout(); + ((System.ComponentModel.ISupportInitialize)dgvCams).BeginInit(); SuspendLayout(); // + // tabs1 + // + tabs1.Controls.Add(tabPage1); + tabs1.Dock = DockStyle.Fill; + tabs1.Location = new Point(0, 0); + tabs1.Name = "tabs1"; + tabs1.Pages.Add(tabPage1); + tabs1.Size = new Size(391, 407); + tabs1.Style = styleLine1; + tabs1.TabIndex = 0; + tabs1.Text = "tabs1"; + // + // tabPage1 + // + tabPage1.Controls.Add(btnsubmit); + tabPage1.Controls.Add(label1); + tabPage1.Controls.Add(btnRefreshCamList); + tabPage1.Controls.Add(dgvCams); + tabPage1.Controls.Add(COMBO_DEVICES); + tabPage1.Location = new Point(3, 28); + tabPage1.Name = "tabPage1"; + tabPage1.Size = new Size(385, 376); + tabPage1.TabIndex = 0; + tabPage1.Text = "相机配置"; + // + // label1 + // + label1.AutoSize = true; + label1.Location = new Point(38, 15); + label1.Name = "label1"; + label1.Size = new Size(56, 17); + label1.TabIndex = 3; + label1.Text = "相机类型"; + // + // btnRefreshCamList + // + btnRefreshCamList.Location = new Point(36, 43); + btnRefreshCamList.Name = "btnRefreshCamList"; + btnRefreshCamList.Size = new Size(286, 33); + btnRefreshCamList.TabIndex = 2; + btnRefreshCamList.Text = "刷新相机列表"; + btnRefreshCamList.UseVisualStyleBackColor = true; + btnRefreshCamList.Click += btnRefreshCamList_Click; + // + // dgvCams + // + dgvCams.AutoSizeColumnsMode = DataGridViewAutoSizeColumnsMode.Fill; + dgvCams.ColumnHeadersHeightSizeMode = DataGridViewColumnHeadersHeightSizeMode.AutoSize; + dgvCams.Columns.AddRange(new DataGridViewColumn[] { CamName, Serinum, IP }); + dgvCams.Location = new Point(38, 82); + dgvCams.Name = "dgvCams"; + dgvCams.Size = new Size(284, 206); + dgvCams.TabIndex = 1; + // + // CamName + // + CamName.HeaderText = "相机名"; + CamName.Name = "CamName"; + // + // Serinum + // + Serinum.HeaderText = "序列号"; + Serinum.Name = "Serinum"; + // + // IP + // + IP.HeaderText = "相机IP"; + IP.Name = "IP"; + // + // COMBO_DEVICES + // + COMBO_DEVICES.DropDownStyle = ComboBoxStyle.DropDownList; + COMBO_DEVICES.FormattingEnabled = true; + COMBO_DEVICES.Location = new Point(100, 12); + COMBO_DEVICES.Name = "COMBO_DEVICES"; + COMBO_DEVICES.Size = new Size(222, 25); + COMBO_DEVICES.TabIndex = 0; + // + // btnsubmit + // + btnsubmit.Location = new Point(236, 312); + btnsubmit.Name = "btnsubmit"; + btnsubmit.Size = new Size(86, 37); + btnsubmit.TabIndex = 4; + btnsubmit.Text = "确定"; + btnsubmit.UseVisualStyleBackColor = true; + btnsubmit.Click += btnsubmit_Click; + // // CamConfigFrm // AutoScaleDimensions = new SizeF(7F, 17F); AutoScaleMode = AutoScaleMode.Font; + Controls.Add(tabs1); Name = "CamConfigFrm"; - Size = new Size(869, 521); + Size = new Size(391, 407); + tabs1.ResumeLayout(false); + tabPage1.ResumeLayout(false); + tabPage1.PerformLayout(); + ((System.ComponentModel.ISupportInitialize)dgvCams).EndInit(); ResumeLayout(false); } #endregion + + private AntdUI.Tabs tabs1; + private AntdUI.TabPage tabPage1; + private ComboBox COMBO_DEVICES; + private Button btnRefreshCamList; + private DataGridView dgvCams; + private Label label1; + private DataGridViewTextBoxColumn CamName; + private DataGridViewTextBoxColumn Serinum; + private DataGridViewTextBoxColumn IP; + private Button btnsubmit; } } diff --git a/DHSoftware/Views/CamConfigFrm.cs b/DHSoftware/Views/CamConfigFrm.cs index 991a44a..0dc527b 100644 --- a/DHSoftware/Views/CamConfigFrm.cs +++ b/DHSoftware/Views/CamConfigFrm.cs @@ -1,20 +1,177 @@ -using System; +using DH.Commons.Enums; +using DVPCameraType; +using System; using System.Collections.Generic; using System.ComponentModel; using System.Data; +using System.Diagnostics; using System.Drawing; using System.Linq; using System.Text; using System.Threading.Tasks; using System.Windows.Forms; +using static System.Windows.Forms.VisualStyles.VisualStyleElement; namespace DHSoftware.Views { + public partial class CamConfigFrm : UserControl { + public int m_n_dev_count = 0; + public static int m_CamCount = 0; + public static dvpCameraInfo[] m_info = new dvpCameraInfo[16]; + + // 在窗体类中声明一个绑定列表(用于动态更新) + private BindingList _cameraList = new BindingList(); public CamConfigFrm() { InitializeComponent(); + // 添加 ComboBox 的项 + COMBO_DEVICES.Items.AddRange(new string[] { " 度申Do3", "海康Hik", "巴斯勒Basler", "虚拟相机" }); + + // 绑定 SelectedIndexChanged 事件 + COMBO_DEVICES.SelectedIndexChanged += ComboBox_SelectedIndexChanged; + + dgvCams.AutoSizeColumnsMode = DataGridViewAutoSizeColumnsMode.Fill; + dgvCams.ColumnHeadersHeightSizeMode = DataGridViewColumnHeadersHeightSizeMode.AutoSize; + dgvCams.DataSource = _cameraList; // 绑定数据源 + dgvCams.Location = new Point(38, 82); + dgvCams.Name = "dgvCams"; + dgvCams.Size = new Size(284, 206); + dgvCams.TabIndex = 1; + } + private void ComboBox_SelectedIndexChanged(object sender, EventArgs e) + { + if (COMBO_DEVICES.SelectedItem == null) return; + + string selectedMethod = COMBO_DEVICES.SelectedItem.ToString(); + switch (selectedMethod) + { + case "度申Do3": + Do3Think(); + break; + case "海康Hik": + HiK(); + break; + case "巴斯勒Basler": + Basler(); + break; + case "虚拟相机": + Virtul(); + break; + default: + MessageBox.Show("未找到对应方法"); + break; + } + } + + // 其他方法定义... + private void Do3Think() + { + InitDevList(); + } + + private void HiK() + { + + } + private void Basler() + { + + } + + private void Virtul() + { + + } + private void btnRefreshCamList_Click(object sender, EventArgs e) + { + //搜索度申相机 + InitDevList(); + } + + /// + /// 搜索度申相机 + /// + // Initialize the device list. + public void InitDevList() + { + + + + + + + + dvpStatus status; + uint i, n = 0; + dvpCameraInfo dev_info = new dvpCameraInfo(); + + // 清空旧数据 + _cameraList.Clear(); + + // Get the number of cameras that has been connected to a computer. + status = DVPCamera.dvpRefresh(ref n); + Debug.Assert(status == dvpStatus.DVP_STATUS_OK); + m_n_dev_count = (int)n; + if (status == dvpStatus.DVP_STATUS_OK) + { + m_CamCount = 0; + for (i = 0; i < n; i++) + { + // Acquire each camera's information one by one. + status = DVPCamera.dvpEnum(i, ref dev_info); + + if (status == dvpStatus.DVP_STATUS_OK) + { + m_info[m_CamCount] = dev_info; + + int item = -1; + //if (!UserDefinedName.Checked) + { + // add FriendlyName + item = COMBO_DEVICES.Items.Add(dev_info.FriendlyName); + CameraInfo info = new CameraInfo + { + CamName = dev_info.FriendlyName, + Serinum = dev_info.SerialNumber, + // IP = dev_info.IP + }; + + _cameraList.Add(info); + + + } + //else + //{ + // // add User Define Name + // item = COMBO_DEVICES.Items.Add(dev_info.UserID); + //} + + m_CamCount++; + } + else + { + Debug.Assert(status == dvpStatus.DVP_STATUS_OK); + } + } + } + + if (n == 0) + { + + } + else + { + + } + + + } + + private void btnsubmit_Click(object sender, EventArgs e) + { + } } } diff --git a/DHSoftware/Views/CamConfigFrm.resx b/DHSoftware/Views/CamConfigFrm.resx index af32865..66ee6fe 100644 --- a/DHSoftware/Views/CamConfigFrm.resx +++ b/DHSoftware/Views/CamConfigFrm.resx @@ -117,4 +117,13 @@ System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + True + + + True + + + True + \ No newline at end of file diff --git a/DHSoftware/Views/CameraConfigControl.Designer.cs b/DHSoftware/Views/CameraConfigControl.Designer.cs new file mode 100644 index 0000000..185e9ed --- /dev/null +++ b/DHSoftware/Views/CameraConfigControl.Designer.cs @@ -0,0 +1,185 @@ +namespace DHSoftware.Views +{ + partial class CameraConfigControl + { + /// + /// 必需的设计器变量。 + /// + private System.ComponentModel.IContainer components = null; + + /// + /// 清理所有正在使用的资源。 + /// + /// 如果应释放托管资源,为 true;否则为 false。 + protected override void Dispose(bool disposing) + { + if (disposing && (components != null)) + { + components.Dispose(); + } + base.Dispose(disposing); + } + + #region 组件设计器生成的代码 + + /// + /// 设计器支持所需的方法 - 不要修改 + /// 使用代码编辑器修改此方法的内容。 + /// + private void InitializeComponent() + { + label1 = new AntdUI.Label(); + comboBox1 = new ComboBox(); + switch1 = new AntdUI.Switch(); + label2 = new AntdUI.Label(); + inputNumber1 = new AntdUI.InputNumber(); + inputNumber2 = new AntdUI.InputNumber(); + label3 = new AntdUI.Label(); + inputNumber3 = new AntdUI.InputNumber(); + label4 = new AntdUI.Label(); + label5 = new AntdUI.Label(); + label6 = new AntdUI.Label(); + switch2 = new AntdUI.Switch(); + SuspendLayout(); + // + // label1 + // + label1.Location = new Point(12, 12); + label1.Name = "label1"; + label1.Size = new Size(58, 23); + label1.TabIndex = 0; + label1.Text = "相机名"; + // + // comboBox1 + // + comboBox1.FormattingEnabled = true; + comboBox1.Location = new Point(76, 10); + comboBox1.Name = "comboBox1"; + comboBox1.Size = new Size(165, 25); + comboBox1.TabIndex = 1; + // + // switch1 + // + switch1.Location = new Point(327, 10); + switch1.Name = "switch1"; + switch1.Size = new Size(57, 23); + switch1.TabIndex = 2; + switch1.Text = "switch1"; + // + // label2 + // + label2.Location = new Point(12, 41); + label2.Name = "label2"; + label2.Size = new Size(58, 38); + label2.TabIndex = 3; + label2.Text = "曝光时间"; + // + // inputNumber1 + // + inputNumber1.Location = new Point(76, 41); + inputNumber1.Maximum = new decimal(new int[] { 10000000, 0, 0, 0 }); + inputNumber1.Minimum = new decimal(new int[] { 1, 0, 0, 0 }); + inputNumber1.Name = "inputNumber1"; + inputNumber1.Size = new Size(165, 38); + inputNumber1.TabIndex = 4; + inputNumber1.Text = "200"; + inputNumber1.Value = new decimal(new int[] { 1, 0, 0, 0 }); + // + // inputNumber2 + // + inputNumber2.Location = new Point(76, 85); + inputNumber2.Maximum = new decimal(new int[] { 16, 0, 0, 0 }); + inputNumber2.Minimum = new decimal(new int[] { 0, 0, 0, 0 }); + inputNumber2.Name = "inputNumber2"; + inputNumber2.Size = new Size(165, 38); + inputNumber2.TabIndex = 6; + inputNumber2.Text = "6"; + // + // label3 + // + label3.Location = new Point(12, 85); + label3.Name = "label3"; + label3.Size = new Size(58, 38); + label3.TabIndex = 5; + label3.Text = "增益"; + // + // inputNumber3 + // + inputNumber3.Increment = new decimal(new int[] { 90, 0, 0, 0 }); + inputNumber3.Location = new Point(76, 129); + inputNumber3.Maximum = new decimal(new int[] { 360, 0, 0, 0 }); + inputNumber3.Minimum = new decimal(new int[] { 0, 0, 0, 0 }); + inputNumber3.Name = "inputNumber3"; + inputNumber3.Size = new Size(165, 38); + inputNumber3.TabIndex = 8; + inputNumber3.Text = "0"; + // + // label4 + // + label4.Location = new Point(12, 129); + label4.Name = "label4"; + label4.Size = new Size(58, 38); + label4.TabIndex = 7; + label4.Text = "旋转"; + // + // label5 + // + label5.Location = new Point(263, 3); + label5.Name = "label5"; + label5.Size = new Size(58, 36); + label5.TabIndex = 9; + label5.Text = "相机启用"; + // + // label6 + // + label6.Location = new Point(263, 45); + label6.Name = "label6"; + label6.Size = new Size(58, 36); + label6.TabIndex = 11; + label6.Text = "保存原图"; + // + // switch2 + // + switch2.Location = new Point(327, 52); + switch2.Name = "switch2"; + switch2.Size = new Size(57, 23); + switch2.TabIndex = 10; + switch2.Text = "switch2"; + // + // CameraConfigControl + // + AutoScaleDimensions = new SizeF(7F, 17F); + AutoScaleMode = AutoScaleMode.Font; + Controls.Add(label6); + Controls.Add(switch2); + Controls.Add(label5); + Controls.Add(inputNumber3); + Controls.Add(label4); + Controls.Add(inputNumber2); + Controls.Add(label3); + Controls.Add(inputNumber1); + Controls.Add(label2); + Controls.Add(switch1); + Controls.Add(comboBox1); + Controls.Add(label1); + Name = "CameraConfigControl"; + Size = new Size(620, 201); + ResumeLayout(false); + } + + #endregion + + private AntdUI.Label label1; + private ComboBox comboBox1; + private AntdUI.Switch switch1; + private AntdUI.Label label2; + private AntdUI.InputNumber inputNumber1; + private AntdUI.InputNumber inputNumber2; + private AntdUI.Label label3; + private AntdUI.InputNumber inputNumber3; + private AntdUI.Label label4; + private AntdUI.Label label5; + private AntdUI.Label label6; + private AntdUI.Switch switch2; + } +} diff --git a/DHSoftware/Views/CameraConfigControl.cs b/DHSoftware/Views/CameraConfigControl.cs new file mode 100644 index 0000000..5fbfa03 --- /dev/null +++ b/DHSoftware/Views/CameraConfigControl.cs @@ -0,0 +1,127 @@ +using AntdUI; +using DH.Devices.Devices; +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 CameraConfigControl : UserControl + { + public CameraConfigControl() + { + InitializeComponent(); + // InitTableColumns(); + InitData(); + } + AntList antList = null; + CameraBase curUser; + //private void InitTableColumns() + //{ + // table_base.Columns = new ColumnCollection() { + // new ColumnCheck("Selected"){Fixed = true}, + // new Column("CameraName", "相机名", ColumnAlign.Center) + // { + // Width="120", + // //设置树节点,名称需和User里的User[]名称保持一致 + // KeyTree = "Users" + // }, + // new Column("CameraIP", "相机IP",ColumnAlign.Center), + // new Column("Gain", "增益"){ + // Width = "120", + // LineBreak = true, + // }, + // new ColumnSwitch("IsHardwareTrigger", "硬触发", ColumnAlign.Center){ + + // }, + // new Column("RotateImage", "旋转",ColumnAlign.Center), + // new Column("Exposure", "曝光",ColumnAlign.Center), + // //new Column("CellBadge", "徽标",ColumnAlign.Center), + // //new Column("CellText", "富文本") + // //{ + // // ColAlign = ColumnAlign.Center,//支持表头位置单独设置 + // //}, + // //new Column("CellProgress", "进度条",ColumnAlign.Center), + // //new Column("CellDivider", "分割线",ColumnAlign.Center), + // //new Column("CellLinks", "链接", ColumnAlign.Center) + // //{ + // // Fixed = true,//冻结列 + // //}, + // }; + //} + private void InitData() + { + antList = new AntList(); + + for (int i = 0; i < 10; i++) + { + antList.Add(new CameraBase + { + CameraName = "相机1", + CameraIP = "", + Gain = 6, + IsHardwareTrigger = true, + RotateImage = 50, + Exposure = 100, + + + //CellLinks = new CellLink[] {new CellLink("https://gitee.com/antdui/AntdUI", "AntdUI"), + //new CellButton(Guid.NewGuid().ToString(),"编辑",TTypeMini.Primary), + //new CellButton(Guid.NewGuid().ToString(), "徽标", TTypeMini.Success) + //{ + // //支持所有单元格控件 + // DropDownItems = new ISelectItem[] + // { + // new AntdUI.SelectItem(TState.Default), + // new AntdUI.SelectItem(TState.Primary), + // new AntdUI.SelectItem(TState.Success), + // new AntdUI.SelectItem(TState.Error), + // new AntdUI.SelectItem(TState.Warn), + // new AntdUI.SelectItem(TState.Processing), + + // }, + // DropDownValueChanged = (value) => + // { + // string badge = value.ToString(); + // //switch(badge) { + // //case "Default": + // // curUser.CellBadge = new CellBadge(TState.Default, badge); break; + // //case "Primary": + // // curUser.CellBadge = new CellBadge(TState.Primary, badge); break; + // //case "Success": + // // curUser.CellBadge = new CellBadge(TState.Success, badge); break; + // //case "Error": + // // curUser.CellBadge = new CellBadge(TState.Error, badge); break; + // //case "Warn": + // // curUser.CellBadge = new CellBadge(TState.Warn, badge); break; + // //case "Processing": + // // curUser.CellBadge = new CellBadge(TState.Processing, badge); break; + // //} + // } + //}, + //new CellButton(Guid.NewGuid().ToString(),"删除",TTypeMini.Error), + //new CellButton(Guid.NewGuid().ToString(),"查看图片",TTypeMini.Primary)}, + //value:0-1 + // CellProgress = new CellProgress(0.5f), + // CellDivider = new CellDivider(), + }); + } + + + + //设置树数据,可为任意行设置 + + // antList[1].Users = subUsers.ToArray(); + // table_base.Binding(antList); + + //设置行禁用 + // table_base.SetRowEnable(0, false, true); + } + } +} diff --git a/DHSoftware/Views/CameraConfigControl.resx b/DHSoftware/Views/CameraConfigControl.resx new file mode 100644 index 0000000..af32865 --- /dev/null +++ b/DHSoftware/Views/CameraConfigControl.resx @@ -0,0 +1,120 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + text/microsoft-resx + + + 2.0 + + + System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + \ No newline at end of file diff --git a/DHSoftware/Views/DetectConfigControl.Designer.cs b/DHSoftware/Views/DetectConfigControl.Designer.cs new file mode 100644 index 0000000..4ab973e --- /dev/null +++ b/DHSoftware/Views/DetectConfigControl.Designer.cs @@ -0,0 +1,291 @@ +namespace DHSoftware.Views +{ + partial class DetectConfigControl + { + /// + /// 必需的设计器变量。 + /// + private System.ComponentModel.IContainer components = null; + + /// + /// 清理所有正在使用的资源。 + /// + /// 如果应释放托管资源,为 true;否则为 false。 + protected override void Dispose(bool disposing) + { + if (disposing && (components != null)) + { + components.Dispose(); + } + base.Dispose(disposing); + } + + #region 组件设计器生成的代码 + + /// + /// 设计器支持所需的方法 - 不要修改 + /// 使用代码编辑器修改此方法的内容。 + /// + private void InitializeComponent() + { + panel1 = new Panel(); + label1 = new AntdUI.Label(); + tbxPrePath = new TextBox(); + btnPreOpen = new AntdUI.Button(); + label5 = new AntdUI.Label(); + comboBox1 = new ComboBox(); + label6 = new AntdUI.Label(); + textBox1 = new TextBox(); + label8 = new AntdUI.Label(); + switch1 = new AntdUI.Switch(); + label7 = new AntdUI.Label(); + switch2 = new AntdUI.Switch(); + label9 = new AntdUI.Label(); + switch3 = new AntdUI.Switch(); + label10 = new AntdUI.Label(); + switch4 = new AntdUI.Switch(); + panel2 = new Panel(); + label2 = new Label(); + button2 = new AntdUI.Button(); + table1 = new AntdUI.Table(); + button1 = new AntdUI.Button(); + button3 = new AntdUI.Button(); + panel1.SuspendLayout(); + panel2.SuspendLayout(); + SuspendLayout(); + // + // panel1 + // + panel1.Controls.Add(button3); + panel1.Controls.Add(panel2); + panel1.Controls.Add(label10); + panel1.Controls.Add(switch4); + panel1.Controls.Add(label9); + panel1.Controls.Add(switch3); + panel1.Controls.Add(label7); + panel1.Controls.Add(switch2); + panel1.Controls.Add(label8); + panel1.Controls.Add(switch1); + panel1.Controls.Add(textBox1); + panel1.Controls.Add(label6); + panel1.Controls.Add(comboBox1); + panel1.Controls.Add(label5); + panel1.Controls.Add(btnPreOpen); + panel1.Controls.Add(tbxPrePath); + panel1.Controls.Add(label1); + panel1.Dock = DockStyle.Fill; + panel1.Location = new Point(0, 0); + panel1.Name = "panel1"; + panel1.Size = new Size(785, 445); + panel1.TabIndex = 0; + // + // label1 + // + label1.Location = new Point(17, 41); + label1.Name = "label1"; + label1.Size = new Size(73, 23); + label1.TabIndex = 9; + label1.Text = "模型路径"; + // + // tbxPrePath + // + tbxPrePath.Location = new Point(96, 41); + tbxPrePath.Name = "tbxPrePath"; + tbxPrePath.Size = new Size(498, 23); + tbxPrePath.TabIndex = 17; + // + // btnPreOpen + // + btnPreOpen.Location = new Point(613, 41); + btnPreOpen.Name = "btnPreOpen"; + btnPreOpen.Size = new Size(46, 23); + btnPreOpen.TabIndex = 22; + btnPreOpen.Text = "..."; + // + // label5 + // + label5.Location = new Point(333, 12); + label5.Name = "label5"; + label5.Size = new Size(73, 23); + label5.TabIndex = 23; + label5.Text = "目标类型"; + // + // comboBox1 + // + comboBox1.FormattingEnabled = true; + comboBox1.Location = new Point(402, 10); + comboBox1.Name = "comboBox1"; + comboBox1.Size = new Size(188, 25); + comboBox1.TabIndex = 24; + // + // label6 + // + label6.Location = new Point(17, 12); + label6.Name = "label6"; + label6.Size = new Size(58, 23); + label6.TabIndex = 25; + label6.Text = "检测名称"; + // + // textBox1 + // + textBox1.Location = new Point(96, 12); + textBox1.Name = "textBox1"; + textBox1.Size = new Size(211, 23); + textBox1.TabIndex = 26; + // + // label8 + // + label8.Location = new Point(17, 70); + label8.Name = "label8"; + label8.Size = new Size(58, 23); + label8.TabIndex = 28; + label8.Text = "模型启用"; + // + // switch1 + // + switch1.Location = new Point(96, 70); + switch1.Name = "switch1"; + switch1.Size = new Size(57, 23); + switch1.TabIndex = 27; + switch1.Text = "switch1"; + // + // label7 + // + label7.Location = new Point(179, 70); + label7.Name = "label7"; + label7.Size = new Size(58, 23); + label7.TabIndex = 30; + label7.Text = "数据保存"; + // + // switch2 + // + switch2.Location = new Point(258, 70); + switch2.Name = "switch2"; + switch2.Size = new Size(57, 23); + switch2.TabIndex = 29; + switch2.Text = "switch2"; + // + // label9 + // + label9.Location = new Point(333, 70); + label9.Name = "label9"; + label9.Size = new Size(73, 23); + label9.TabIndex = 32; + label9.Text = "保存OK原图"; + // + // switch3 + // + switch3.Location = new Point(412, 70); + switch3.Name = "switch3"; + switch3.Size = new Size(57, 23); + switch3.TabIndex = 31; + switch3.Text = "switch3"; + // + // label10 + // + label10.Location = new Point(487, 70); + label10.Name = "label10"; + label10.Size = new Size(73, 23); + label10.TabIndex = 34; + label10.Text = "保存NG原图"; + // + // switch4 + // + switch4.Location = new Point(566, 70); + switch4.Name = "switch4"; + switch4.Size = new Size(57, 23); + switch4.TabIndex = 33; + switch4.Text = "switch4"; + // + // panel2 + // + panel2.Controls.Add(label2); + panel2.Controls.Add(button2); + panel2.Controls.Add(table1); + panel2.Controls.Add(button1); + panel2.Location = new Point(17, 141); + panel2.Name = "panel2"; + panel2.Size = new Size(577, 286); + panel2.TabIndex = 35; + // + // label2 + // + label2.AutoSize = true; + label2.Location = new Point(3, 5); + label2.Name = "label2"; + label2.Size = new Size(56, 17); + label2.TabIndex = 25; + label2.Text = "模型参数"; + // + // button2 + // + button2.Location = new Point(93, 25); + button2.Name = "button2"; + button2.Size = new Size(84, 34); + button2.TabIndex = 24; + button2.Text = "删除"; + // + // table1 + // + table1.Location = new Point(3, 65); + table1.Name = "table1"; + table1.Size = new Size(570, 218); + table1.TabIndex = 22; + table1.Text = "table1"; + // + // button1 + // + button1.Location = new Point(3, 25); + button1.Name = "button1"; + button1.Size = new Size(84, 34); + button1.TabIndex = 23; + button1.Text = "新增"; + // + // button3 + // + button3.Location = new Point(472, 101); + button3.Name = "button3"; + button3.Size = new Size(118, 34); + button3.TabIndex = 37; + button3.Text = "查看文件夹"; + // + // DetectConfigControl + // + AutoScaleDimensions = new SizeF(7F, 17F); + AutoScaleMode = AutoScaleMode.Font; + Controls.Add(panel1); + Name = "DetectConfigControl"; + Size = new Size(785, 445); + panel1.ResumeLayout(false); + panel1.PerformLayout(); + panel2.ResumeLayout(false); + panel2.PerformLayout(); + ResumeLayout(false); + } + + #endregion + + private Panel panel1; + private AntdUI.Label label1; + private TextBox tbxPrePath; + private TextBox textBox1; + private AntdUI.Label label6; + private ComboBox comboBox1; + private AntdUI.Label label5; + private AntdUI.Button btnPreOpen; + private AntdUI.Label label7; + private AntdUI.Switch switch2; + private AntdUI.Label label8; + private AntdUI.Switch switch1; + private AntdUI.Label label10; + private AntdUI.Switch switch4; + private AntdUI.Label label9; + private AntdUI.Switch switch3; + private Panel panel2; + private Label label2; + private AntdUI.Button button2; + private AntdUI.Table table1; + private AntdUI.Button button1; + private AntdUI.Button button3; + } +} diff --git a/DHSoftware/Views/DetectConfigControl.cs b/DHSoftware/Views/DetectConfigControl.cs new file mode 100644 index 0000000..7eff06c --- /dev/null +++ b/DHSoftware/Views/DetectConfigControl.cs @@ -0,0 +1,20 @@ +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 DetectConfigControl : UserControl + { + public DetectConfigControl() + { + InitializeComponent(); + } + } +} diff --git a/DHSoftware/Views/DetectConfigControl.resx b/DHSoftware/Views/DetectConfigControl.resx new file mode 100644 index 0000000..af32865 --- /dev/null +++ b/DHSoftware/Views/DetectConfigControl.resx @@ -0,0 +1,120 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + text/microsoft-resx + + + 2.0 + + + System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + \ No newline at end of file diff --git a/DHSoftware/Views/FloatButtonDemo.Designer.cs b/DHSoftware/Views/FloatButtonDemo.Designer.cs new file mode 100644 index 0000000..46e24f3 --- /dev/null +++ b/DHSoftware/Views/FloatButtonDemo.Designer.cs @@ -0,0 +1,694 @@ +namespace AntdUIDemo.Views +{ + partial class FloatButtonDemo + { + /// + /// 必需的设计器变量。 + /// + private System.ComponentModel.IContainer components = null; + + /// + /// 清理所有正在使用的资源。 + /// + /// 如果应释放托管资源,为 true;否则为 false。 + protected override void Dispose(bool disposing) + { + if (disposing && (components != null)) + { + components.Dispose(); + } + base.Dispose(disposing); + } + + #region 组件设计器生成的代码 + + /// + /// 设计器支持所需的方法 - 不要修改 + /// 使用代码编辑器修改此方法的内容。 + /// + private void InitializeComponent() + { + this.header1 = new AntdUI.PageHeader(); + this.stackPanel1 = new AntdUI.StackPanel(); + this.stackPanel2 = new AntdUI.StackPanel(); + this.buttonCZ = new AntdUI.Button(); + this.buttonClose = new AntdUI.Button(); + this.buttonOpen = new AntdUI.Button(); + this.stackPanel8 = new AntdUI.StackPanel(); + this.switch_enabled = new AntdUI.Switch(); + this.label18 = new AntdUI.Label(); + this.colorPicker = new AntdUI.ColorPicker(); + this.label16 = new AntdUI.Label(); + this.stackPanel6 = new AntdUI.StackPanel(); + this.switch_loading = new AntdUI.Switch(); + this.label2 = new AntdUI.Label(); + this.input_badgesize = new AntdUI.InputNumber(); + this.label15 = new AntdUI.Label(); + this.input_badge = new AntdUI.Input(); + this.label17 = new AntdUI.Label(); + this.stackPanel5 = new AntdUI.StackPanel(); + this.switch_round = new AntdUI.Switch(); + this.label14 = new AntdUI.Label(); + this.select_type = new AntdUI.Select(); + this.label13 = new AntdUI.Label(); + this.input_radius = new AntdUI.InputNumber(); + this.label12 = new AntdUI.Label(); + this.label11 = new AntdUI.Label(); + this.stackPanel7 = new AntdUI.StackPanel(); + this.input_gap = new AntdUI.InputNumber(); + this.label20 = new AntdUI.Label(); + this.stackPanel4 = new AntdUI.StackPanel(); + this.switch_topmost = new AntdUI.Switch(); + this.label6 = new AntdUI.Label(); + this.input_my = new AntdUI.InputNumber(); + this.label8 = new AntdUI.Label(); + this.input_size = new AntdUI.InputNumber(); + this.label9 = new AntdUI.Label(); + this.stackPanel3 = new AntdUI.StackPanel(); + this.switch_vertical = new AntdUI.Switch(); + this.label5 = new AntdUI.Label(); + this.input_mx = new AntdUI.InputNumber(); + this.label7 = new AntdUI.Label(); + this.select_align = new AntdUI.Select(); + this.label10 = new AntdUI.Label(); + this.label4 = new AntdUI.Label(); + this.label3 = new AntdUI.Label(); + this.stackPanel1.SuspendLayout(); + this.stackPanel2.SuspendLayout(); + this.stackPanel8.SuspendLayout(); + this.stackPanel6.SuspendLayout(); + this.stackPanel5.SuspendLayout(); + this.stackPanel7.SuspendLayout(); + this.stackPanel4.SuspendLayout(); + this.stackPanel3.SuspendLayout(); + this.SuspendLayout(); + // + // header1 + // + this.header1.Description = "悬浮于页面上方的按钮。"; + this.header1.DividerShow = true; + this.header1.Dock = System.Windows.Forms.DockStyle.Top; + this.header1.Font = new System.Drawing.Font("Microsoft YaHei UI", 12F); + this.header1.LocalizationDescription = "FloatButton.Description"; + this.header1.LocalizationText = "FloatButton.Text"; + this.header1.Location = new System.Drawing.Point(0, 0); + this.header1.Name = "header1"; + this.header1.Padding = new System.Windows.Forms.Padding(0, 0, 0, 10); + this.header1.Size = new System.Drawing.Size(750, 74); + this.header1.TabIndex = 27; + this.header1.Text = "FloatButton 悬浮按钮"; + this.header1.UseTitleFont = true; + // + // stackPanel1 + // + this.stackPanel1.Controls.Add(this.stackPanel2); + this.stackPanel1.Controls.Add(this.stackPanel8); + this.stackPanel1.Controls.Add(this.stackPanel6); + this.stackPanel1.Controls.Add(this.stackPanel5); + this.stackPanel1.Controls.Add(this.label11); + this.stackPanel1.Controls.Add(this.stackPanel7); + this.stackPanel1.Controls.Add(this.stackPanel4); + this.stackPanel1.Controls.Add(this.stackPanel3); + this.stackPanel1.Controls.Add(this.label4); + this.stackPanel1.Dock = System.Windows.Forms.DockStyle.Fill; + this.stackPanel1.Location = new System.Drawing.Point(0, 104); + this.stackPanel1.Name = "stackPanel1"; + this.stackPanel1.Size = new System.Drawing.Size(750, 388); + this.stackPanel1.TabIndex = 0; + this.stackPanel1.Text = "stackPanel1"; + this.stackPanel1.Vertical = true; + // + // stackPanel2 + // + this.stackPanel2.Controls.Add(this.buttonCZ); + this.stackPanel2.Controls.Add(this.buttonClose); + this.stackPanel2.Controls.Add(this.buttonOpen); + this.stackPanel2.Location = new System.Drawing.Point(3, 291); + this.stackPanel2.Name = "stackPanel2"; + this.stackPanel2.Size = new System.Drawing.Size(744, 38); + this.stackPanel2.TabIndex = 28; + this.stackPanel2.Text = "stackPanel2"; + // + // buttonCZ + // + this.buttonCZ.Font = new System.Drawing.Font("Microsoft YaHei UI", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134))); + this.buttonCZ.LocalizationText = "reset"; + this.buttonCZ.Location = new System.Drawing.Point(165, 3); + this.buttonCZ.Name = "buttonCZ"; + this.buttonCZ.Size = new System.Drawing.Size(75, 32); + this.buttonCZ.TabIndex = 7; + this.buttonCZ.Text = "重 置"; + this.buttonCZ.Type = AntdUI.TTypeMini.Warn; + this.buttonCZ.WaveSize = 0; + // + // buttonClose + // + this.buttonClose.Font = new System.Drawing.Font("Microsoft YaHei UI", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134))); + this.buttonClose.LocalizationText = "close"; + this.buttonClose.Location = new System.Drawing.Point(84, 3); + this.buttonClose.Name = "buttonClose"; + this.buttonClose.Size = new System.Drawing.Size(75, 32); + this.buttonClose.TabIndex = 6; + this.buttonClose.Text = "关 闭"; + this.buttonClose.Type = AntdUI.TTypeMini.Error; + this.buttonClose.WaveSize = 0; + // + // buttonOpen + // + this.buttonOpen.Font = new System.Drawing.Font("Microsoft YaHei UI", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134))); + this.buttonOpen.LocalizationText = "open"; + this.buttonOpen.Location = new System.Drawing.Point(3, 3); + this.buttonOpen.Name = "buttonOpen"; + this.buttonOpen.Size = new System.Drawing.Size(75, 32); + this.buttonOpen.TabIndex = 5; + this.buttonOpen.Text = "打 开"; + this.buttonOpen.Type = AntdUI.TTypeMini.Success; + this.buttonOpen.WaveSize = 0; + // + // stackPanel8 + // + this.stackPanel8.Controls.Add(this.switch_enabled); + this.stackPanel8.Controls.Add(this.label18); + this.stackPanel8.Controls.Add(this.colorPicker); + this.stackPanel8.Controls.Add(this.label16); + this.stackPanel8.Gap = 4; + this.stackPanel8.Location = new System.Drawing.Point(3, 253); + this.stackPanel8.Name = "stackPanel8"; + this.stackPanel8.Size = new System.Drawing.Size(744, 32); + this.stackPanel8.TabIndex = 27; + this.stackPanel8.Text = "stackPanel8"; + // + // switch_enabled + // + this.switch_enabled.Location = new System.Drawing.Point(292, 3); + this.switch_enabled.Name = "switch_enabled"; + this.switch_enabled.Size = new System.Drawing.Size(50, 26); + this.switch_enabled.TabIndex = 32; + this.switch_enabled.Text = "switch1"; + // + // label18 + // + this.label18.Font = new System.Drawing.Font("Microsoft YaHei UI", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134))); + this.label18.Location = new System.Drawing.Point(190, 3); + this.label18.Name = "label18"; + this.label18.Size = new System.Drawing.Size(92, 26); + this.label18.TabIndex = 31; + this.label18.Text = "Enabled"; + // + // colorPicker + // + this.colorPicker.Font = new System.Drawing.Font("Microsoft YaHei UI", 9F); + this.colorPicker.Location = new System.Drawing.Point(105, 3); + this.colorPicker.Name = "colorPicker"; + this.colorPicker.Size = new System.Drawing.Size(75, 26); + this.colorPicker.TabIndex = 30; + this.colorPicker.Text = "colorPicker1"; + this.colorPicker.Value = System.Drawing.Color.FromArgb(((int)(((byte)(22)))), ((int)(((byte)(119)))), ((int)(((byte)(255))))); + this.colorPicker.WaveSize = 0; + // + // label16 + // + this.label16.Font = new System.Drawing.Font("Microsoft YaHei UI", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134))); + this.label16.Location = new System.Drawing.Point(3, 3); + this.label16.Name = "label16"; + this.label16.Size = new System.Drawing.Size(92, 26); + this.label16.TabIndex = 29; + this.label16.Text = "BadgeBack"; + // + // stackPanel6 + // + this.stackPanel6.Controls.Add(this.switch_loading); + this.stackPanel6.Controls.Add(this.label2); + this.stackPanel6.Controls.Add(this.input_badgesize); + this.stackPanel6.Controls.Add(this.label15); + this.stackPanel6.Controls.Add(this.input_badge); + this.stackPanel6.Controls.Add(this.label17); + this.stackPanel6.Gap = 4; + this.stackPanel6.Location = new System.Drawing.Point(3, 215); + this.stackPanel6.Name = "stackPanel6"; + this.stackPanel6.Size = new System.Drawing.Size(744, 32); + this.stackPanel6.TabIndex = 25; + this.stackPanel6.Text = "stackPanel6"; + // + // switch_loading + // + this.switch_loading.Location = new System.Drawing.Point(492, 3); + this.switch_loading.Name = "switch_loading"; + this.switch_loading.Size = new System.Drawing.Size(50, 26); + this.switch_loading.TabIndex = 30; + this.switch_loading.Text = "switch1"; + // + // label2 + // + this.label2.Font = new System.Drawing.Font("Microsoft YaHei UI", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134))); + this.label2.Location = new System.Drawing.Point(390, 3); + this.label2.Name = "label2"; + this.label2.Size = new System.Drawing.Size(92, 26); + this.label2.TabIndex = 29; + this.label2.Text = "Loading"; + // + // input_badgesize + // + this.input_badgesize.DecimalPlaces = 1; + this.input_badgesize.Font = new System.Drawing.Font("Microsoft YaHei UI", 9F); + this.input_badgesize.Increment = new decimal(new int[] { + 1, + 0, + 0, + 65536}); + this.input_badgesize.Location = new System.Drawing.Point(292, 3); + this.input_badgesize.Minimum = new decimal(new int[] { + 0, + 0, + 0, + 0}); + this.input_badgesize.Name = "input_badgesize"; + this.input_badgesize.Size = new System.Drawing.Size(88, 26); + this.input_badgesize.TabIndex = 13; + this.input_badgesize.Text = "0.6"; + this.input_badgesize.Value = new decimal(new int[] { + 6, + 0, + 0, + 65536}); + this.input_badgesize.WaveSize = 0; + // + // label15 + // + this.label15.Font = new System.Drawing.Font("Microsoft YaHei UI", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134))); + this.label15.Location = new System.Drawing.Point(190, 3); + this.label15.Name = "label15"; + this.label15.Size = new System.Drawing.Size(92, 26); + this.label15.TabIndex = 12; + this.label15.Text = "BadgeSize"; + // + // input_badge + // + this.input_badge.Font = new System.Drawing.Font("Microsoft YaHei UI", 9F); + this.input_badge.Location = new System.Drawing.Point(105, 3); + this.input_badge.Name = "input_badge"; + this.input_badge.Size = new System.Drawing.Size(75, 26); + this.input_badge.TabIndex = 5; + this.input_badge.WaveSize = 0; + // + // label17 + // + this.label17.Font = new System.Drawing.Font("Microsoft YaHei UI", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134))); + this.label17.Location = new System.Drawing.Point(3, 3); + this.label17.Name = "label17"; + this.label17.Size = new System.Drawing.Size(92, 26); + this.label17.TabIndex = 4; + this.label17.Text = "Badge"; + // + // stackPanel5 + // + this.stackPanel5.Controls.Add(this.switch_round); + this.stackPanel5.Controls.Add(this.label14); + this.stackPanel5.Controls.Add(this.select_type); + this.stackPanel5.Controls.Add(this.label13); + this.stackPanel5.Controls.Add(this.input_radius); + this.stackPanel5.Controls.Add(this.label12); + this.stackPanel5.Gap = 4; + this.stackPanel5.Location = new System.Drawing.Point(3, 177); + this.stackPanel5.Name = "stackPanel5"; + this.stackPanel5.Size = new System.Drawing.Size(744, 32); + this.stackPanel5.TabIndex = 24; + this.stackPanel5.Text = "stackPanel5"; + // + // switch_round + // + this.switch_round.Location = new System.Drawing.Point(492, 3); + this.switch_round.Name = "switch_round"; + this.switch_round.Size = new System.Drawing.Size(50, 26); + this.switch_round.TabIndex = 24; + this.switch_round.Text = "switch1"; + // + // label14 + // + this.label14.Font = new System.Drawing.Font("Microsoft YaHei UI", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134))); + this.label14.Location = new System.Drawing.Point(390, 3); + this.label14.Name = "label14"; + this.label14.Size = new System.Drawing.Size(92, 26); + this.label14.TabIndex = 23; + this.label14.Text = "Round"; + // + // select_type + // + this.select_type.Font = new System.Drawing.Font("Microsoft YaHei UI", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134))); + this.select_type.List = true; + this.select_type.Location = new System.Drawing.Point(292, 3); + this.select_type.Name = "select_type"; + this.select_type.Size = new System.Drawing.Size(88, 26); + this.select_type.TabIndex = 22; + this.select_type.WaveSize = 0; + // + // label13 + // + this.label13.Font = new System.Drawing.Font("Microsoft YaHei UI", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134))); + this.label13.Location = new System.Drawing.Point(190, 3); + this.label13.Name = "label13"; + this.label13.Size = new System.Drawing.Size(92, 26); + this.label13.TabIndex = 21; + this.label13.Text = "Type"; + // + // input_radius + // + this.input_radius.Font = new System.Drawing.Font("Microsoft YaHei UI", 9F); + this.input_radius.Location = new System.Drawing.Point(105, 3); + this.input_radius.Minimum = new decimal(new int[] { + 0, + 0, + 0, + 0}); + this.input_radius.Name = "input_radius"; + this.input_radius.Size = new System.Drawing.Size(75, 26); + this.input_radius.TabIndex = 18; + this.input_radius.Text = "6"; + this.input_radius.Value = new decimal(new int[] { + 6, + 0, + 0, + 0}); + this.input_radius.WaveSize = 0; + // + // label12 + // + this.label12.Font = new System.Drawing.Font("Microsoft YaHei UI", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134))); + this.label12.Location = new System.Drawing.Point(3, 3); + this.label12.Name = "label12"; + this.label12.Size = new System.Drawing.Size(92, 26); + this.label12.TabIndex = 17; + this.label12.Text = "Radius"; + // + // label11 + // + this.label11.Font = new System.Drawing.Font("Microsoft YaHei UI", 12F); + this.label11.LocalizationText = "button_option"; + this.label11.Location = new System.Drawing.Point(3, 147); + this.label11.Name = "label11"; + this.label11.Size = new System.Drawing.Size(744, 24); + this.label11.TabIndex = 23; + this.label11.Text = "按钮配置"; + // + // stackPanel7 + // + this.stackPanel7.Controls.Add(this.input_gap); + this.stackPanel7.Controls.Add(this.label20); + this.stackPanel7.Gap = 4; + this.stackPanel7.Location = new System.Drawing.Point(3, 109); + this.stackPanel7.Name = "stackPanel7"; + this.stackPanel7.Size = new System.Drawing.Size(744, 32); + this.stackPanel7.TabIndex = 22; + this.stackPanel7.Text = "stackPanel7"; + // + // input_gap + // + this.input_gap.Font = new System.Drawing.Font("Microsoft YaHei UI", 9F); + this.input_gap.Location = new System.Drawing.Point(105, 3); + this.input_gap.Minimum = new decimal(new int[] { + 0, + 0, + 0, + 0}); + this.input_gap.Name = "input_gap"; + this.input_gap.Size = new System.Drawing.Size(75, 26); + this.input_gap.TabIndex = 5; + this.input_gap.Text = "40"; + this.input_gap.Value = new decimal(new int[] { + 40, + 0, + 0, + 0}); + this.input_gap.WaveSize = 0; + // + // label20 + // + this.label20.Font = new System.Drawing.Font("Microsoft YaHei UI", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134))); + this.label20.Location = new System.Drawing.Point(3, 3); + this.label20.Name = "label20"; + this.label20.Size = new System.Drawing.Size(92, 26); + this.label20.TabIndex = 4; + this.label20.Text = "Gap"; + // + // stackPanel4 + // + this.stackPanel4.Controls.Add(this.switch_topmost); + this.stackPanel4.Controls.Add(this.label6); + this.stackPanel4.Controls.Add(this.input_my); + this.stackPanel4.Controls.Add(this.label8); + this.stackPanel4.Controls.Add(this.input_size); + this.stackPanel4.Controls.Add(this.label9); + this.stackPanel4.Gap = 4; + this.stackPanel4.Location = new System.Drawing.Point(3, 71); + this.stackPanel4.Name = "stackPanel4"; + this.stackPanel4.Size = new System.Drawing.Size(744, 32); + this.stackPanel4.TabIndex = 17; + this.stackPanel4.Text = "stackPanel4"; + // + // switch_topmost + // + this.switch_topmost.Checked = true; + this.switch_topmost.Location = new System.Drawing.Point(492, 3); + this.switch_topmost.Name = "switch_topmost"; + this.switch_topmost.Size = new System.Drawing.Size(50, 26); + this.switch_topmost.TabIndex = 15; + this.switch_topmost.Text = "switch1"; + // + // label6 + // + this.label6.Font = new System.Drawing.Font("Microsoft YaHei UI", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134))); + this.label6.Location = new System.Drawing.Point(390, 3); + this.label6.Name = "label6"; + this.label6.Size = new System.Drawing.Size(92, 26); + this.label6.TabIndex = 14; + this.label6.Text = "TopMost"; + // + // input_my + // + this.input_my.Font = new System.Drawing.Font("Microsoft YaHei UI", 9F); + this.input_my.Location = new System.Drawing.Point(292, 3); + this.input_my.Minimum = new decimal(new int[] { + 0, + 0, + 0, + 0}); + this.input_my.Name = "input_my"; + this.input_my.Size = new System.Drawing.Size(88, 26); + this.input_my.TabIndex = 9; + this.input_my.Text = "24"; + this.input_my.Value = new decimal(new int[] { + 24, + 0, + 0, + 0}); + this.input_my.WaveSize = 0; + // + // label8 + // + this.label8.Font = new System.Drawing.Font("Microsoft YaHei UI", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134))); + this.label8.Location = new System.Drawing.Point(190, 3); + this.label8.Name = "label8"; + this.label8.Size = new System.Drawing.Size(92, 26); + this.label8.TabIndex = 8; + this.label8.Text = "MarginY"; + // + // input_size + // + this.input_size.Font = new System.Drawing.Font("Microsoft YaHei UI", 9F); + this.input_size.Location = new System.Drawing.Point(105, 3); + this.input_size.Minimum = new decimal(new int[] { + 0, + 0, + 0, + 0}); + this.input_size.Name = "input_size"; + this.input_size.Size = new System.Drawing.Size(75, 26); + this.input_size.TabIndex = 5; + this.input_size.Text = "40"; + this.input_size.Value = new decimal(new int[] { + 40, + 0, + 0, + 0}); + this.input_size.WaveSize = 0; + // + // label9 + // + this.label9.Font = new System.Drawing.Font("Microsoft YaHei UI", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134))); + this.label9.Location = new System.Drawing.Point(3, 3); + this.label9.Name = "label9"; + this.label9.Size = new System.Drawing.Size(92, 26); + this.label9.TabIndex = 4; + this.label9.Text = "Size"; + // + // stackPanel3 + // + this.stackPanel3.Controls.Add(this.switch_vertical); + this.stackPanel3.Controls.Add(this.label5); + this.stackPanel3.Controls.Add(this.input_mx); + this.stackPanel3.Controls.Add(this.label7); + this.stackPanel3.Controls.Add(this.select_align); + this.stackPanel3.Controls.Add(this.label10); + this.stackPanel3.Gap = 4; + this.stackPanel3.Location = new System.Drawing.Point(3, 33); + this.stackPanel3.Name = "stackPanel3"; + this.stackPanel3.Size = new System.Drawing.Size(744, 32); + this.stackPanel3.TabIndex = 16; + this.stackPanel3.Text = "stackPanel3"; + // + // switch_vertical + // + this.switch_vertical.Checked = true; + this.switch_vertical.Location = new System.Drawing.Point(492, 3); + this.switch_vertical.Name = "switch_vertical"; + this.switch_vertical.Size = new System.Drawing.Size(50, 26); + this.switch_vertical.TabIndex = 19; + this.switch_vertical.Text = "switch1"; + // + // label5 + // + this.label5.Font = new System.Drawing.Font("Microsoft YaHei UI", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134))); + this.label5.Location = new System.Drawing.Point(390, 3); + this.label5.Name = "label5"; + this.label5.Size = new System.Drawing.Size(92, 26); + this.label5.TabIndex = 18; + this.label5.Text = "Vertical"; + // + // input_mx + // + this.input_mx.Font = new System.Drawing.Font("Microsoft YaHei UI", 9F); + this.input_mx.Location = new System.Drawing.Point(292, 3); + this.input_mx.Minimum = new decimal(new int[] { + 0, + 0, + 0, + 0}); + this.input_mx.Name = "input_mx"; + this.input_mx.Size = new System.Drawing.Size(88, 26); + this.input_mx.TabIndex = 17; + this.input_mx.Text = "24"; + this.input_mx.Value = new decimal(new int[] { + 24, + 0, + 0, + 0}); + this.input_mx.WaveSize = 0; + // + // label7 + // + this.label7.Font = new System.Drawing.Font("Microsoft YaHei UI", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134))); + this.label7.Location = new System.Drawing.Point(190, 3); + this.label7.Name = "label7"; + this.label7.Size = new System.Drawing.Size(92, 26); + this.label7.TabIndex = 16; + this.label7.Text = "MarginX"; + // + // select_align + // + this.select_align.Font = new System.Drawing.Font("Microsoft YaHei UI", 9F); + this.select_align.List = true; + this.select_align.Location = new System.Drawing.Point(105, 3); + this.select_align.Name = "select_align"; + this.select_align.Size = new System.Drawing.Size(75, 26); + this.select_align.TabIndex = 5; + this.select_align.WaveSize = 0; + // + // label10 + // + this.label10.Font = new System.Drawing.Font("Microsoft YaHei UI", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134))); + this.label10.Location = new System.Drawing.Point(3, 3); + this.label10.Name = "label10"; + this.label10.Size = new System.Drawing.Size(92, 26); + this.label10.TabIndex = 4; + this.label10.Text = "Align"; + // + // label4 + // + this.label4.Font = new System.Drawing.Font("Microsoft YaHei UI", 12F); + this.label4.LocalizationText = "control_option"; + this.label4.Location = new System.Drawing.Point(3, 3); + this.label4.Name = "label4"; + this.label4.Size = new System.Drawing.Size(744, 24); + this.label4.TabIndex = 15; + this.label4.Text = "控件配置"; + // + // label3 + // + this.label3.Dock = System.Windows.Forms.DockStyle.Top; + this.label3.Font = new System.Drawing.Font("Microsoft YaHei UI", 9F); + this.label3.LocalizationText = "FloatButton.Tip"; + this.label3.Location = new System.Drawing.Point(0, 74); + this.label3.Name = "label3"; + this.label3.Padding = new System.Windows.Forms.Padding(0, 0, 0, 6); + this.label3.Size = new System.Drawing.Size(750, 30); + this.label3.TabIndex = 4; + this.label3.Text = "FloatButton没有工具箱控件,使用代码方式调用。"; + // + // FloatButtonDemo + // + this.Controls.Add(this.stackPanel1); + this.Controls.Add(this.label3); + this.Controls.Add(this.header1); + this.Name = "FloatButtonDemo"; + this.Size = new System.Drawing.Size(750, 492); + this.stackPanel1.ResumeLayout(false); + this.stackPanel2.ResumeLayout(false); + this.stackPanel8.ResumeLayout(false); + this.stackPanel6.ResumeLayout(false); + this.stackPanel5.ResumeLayout(false); + this.stackPanel7.ResumeLayout(false); + this.stackPanel4.ResumeLayout(false); + this.stackPanel3.ResumeLayout(false); + this.ResumeLayout(false); + + } + + #endregion + + private AntdUI.PageHeader header1; + private AntdUI.StackPanel stackPanel1; + private AntdUI.Label label3; + private AntdUI.StackPanel stackPanel4; + private AntdUI.InputNumber input_my; + private AntdUI.Label label8; + private AntdUI.InputNumber input_size; + private AntdUI.Label label9; + private AntdUI.StackPanel stackPanel3; + private AntdUI.Select select_align; + private AntdUI.Label label10; + private AntdUI.Label label4; + private AntdUI.StackPanel stackPanel6; + private AntdUI.InputNumber input_badgesize; + private AntdUI.Label label15; + private AntdUI.Input input_badge; + private AntdUI.Label label17; + private AntdUI.StackPanel stackPanel5; + private AntdUI.Label label11; + private AntdUI.StackPanel stackPanel7; + private AntdUI.InputNumber input_gap; + private AntdUI.Label label20; + private AntdUI.InputNumber input_radius; + private AntdUI.Label label12; + private AntdUI.Switch switch_topmost; + private AntdUI.Label label6; + private AntdUI.Switch switch_vertical; + private AntdUI.Label label5; + private AntdUI.InputNumber input_mx; + private AntdUI.Label label7; + private AntdUI.Switch switch_round; + private AntdUI.Label label14; + private AntdUI.Select select_type; + private AntdUI.Label label13; + private AntdUI.StackPanel stackPanel2; + private AntdUI.StackPanel stackPanel8; + private AntdUI.Switch switch_enabled; + private AntdUI.Label label18; + private AntdUI.ColorPicker colorPicker; + private AntdUI.Label label16; + private AntdUI.Switch switch_loading; + private AntdUI.Label label2; + private AntdUI.Button buttonCZ; + private AntdUI.Button buttonClose; + private AntdUI.Button buttonOpen; + } +} diff --git a/DHSoftware/Views/FloatButtonDemo.cs b/DHSoftware/Views/FloatButtonDemo.cs new file mode 100644 index 0000000..93da584 --- /dev/null +++ b/DHSoftware/Views/FloatButtonDemo.cs @@ -0,0 +1,241 @@ +using AntdUI; +using System; +using System.Drawing; +using System.Windows.Forms; + +namespace AntdUIDemo.Views +{ + public partial class FloatButtonDemo : UserControl + { + private Window window; + private FormFloatButton floatButtonForm = null; + public FloatButtonDemo(Window _window) + { + window = _window; + InitializeComponent(); + //初始化下拉框 + InitSelectItems(); + //设置默认值 + InitData(); + // 绑定事件 + BindEventHandler(); + } + + private void BindEventHandler() + { + buttonOpen.Click += ButtonOpen_Click; + buttonClose.Click += buttonClose_Click; + buttonCZ.Click += buttonCZ_Click; + + select_align.SelectedIndexChanged += select_intvalue_SelectedIndexChanged; + select_type.SelectedIndexChanged += select_intvalue_SelectedIndexChanged; + + switch_round.CheckedChanged += Switch_CheckedChanged; + switch_vertical.CheckedChanged += Switch_CheckedChanged; + switch_topmost.CheckedChanged += Switch_CheckedChanged; + switch_enabled.CheckedChanged += Switch_CheckedChanged; + switch_loading.CheckedChanged += Switch_CheckedChanged; + + input_size.ValueChanged += input_decimalvalue_ValeChanged; + input_mx.ValueChanged += input_decimalvalue_ValeChanged; + input_my.ValueChanged += input_decimalvalue_ValeChanged; + input_gap.ValueChanged += input_decimalvalue_ValeChanged; + input_radius.ValueChanged += input_decimalvalue_ValeChanged; + input_badgesize.ValueChanged += input_decimalvalue_ValeChanged; + + input_badge.TextChanged += input_badge_TextChanged; + + colorPicker.ValueChanged += colorPicker_ValueChanged; + } + + private void ButtonOpen_Click(object sender, EventArgs e) + { + LoadFloatButton(); + } + + // 初始化下拉框 + private void InitSelectItems() + { + //初始化方向 + select_align.Items.Clear(); + foreach (TAlign align in Enum.GetValues(typeof(TAlign))) + { + select_align.Items.Add(align); + } + //初始化类型 + select_type.Items.Clear(); + foreach (TTypeMini type in Enum.GetValues(typeof(TTypeMini))) + { + select_type.Items.Add(type); + } + } + + // 设置默认值 + private void InitData() + { + select_align.SelectedIndex = 7; + select_type.SelectedIndex = 0; + + switch_round.Checked = false; + switch_vertical.Checked = true; + switch_topmost.Checked = false; + switch_enabled.Checked = true; + switch_loading.Checked = false; + + input_size.Value = 40; + input_mx.Value = 24; + input_my.Value = 24; + input_gap.Value = 40; + input_radius.Value = 6; + input_badge.Text = ""; + input_badgesize.Value = 0.6m; + colorPicker.Value = Color.FromArgb(22, 119, 255); + } + + // 加载浮动按钮 + private void LoadFloatButton() + { + if (floatButtonForm == null) + { + floatButtonForm = FloatButton.open(new FloatButton.Config(window, new FloatButton.ConfigBtn[] + { + // 使用 svg 图片 + // ConfigBtn第二个text参数默认设置为IconSvg,或者如下在配置里面设置IconSvg + new FloatButton.ConfigBtn("button1","",true) + { + // isSvg设置为true,text参数会赋值给IconSvg,否则赋值给Text,所以需要单独设置Text + Text = "SVG Picture", + IconSvg = "", + Tooltip = "SVG Button", + Round = switch_round.Checked, + Type = (TTypeMini)select_type.SelectedValue, + Radius = (int)input_radius.Value, + Badge = input_badge.Text==""? null:input_badge.Text, + BadgeSize = (float)input_badgesize.Value, + BadgeBack = colorPicker.Value, + Enabled = switch_enabled.Checked, + Loading = switch_loading.Checked, + }, + // 使用资源图片 + new FloatButton.ConfigBtn("button2", DHSoftware.Properties.Resources.关闭) + { + Text = "Resource Picture", + Tooltip = "Resource Picture Button", + Round = switch_round.Checked, + Type = (TTypeMini)select_type.SelectedValue, + Radius = (int)input_radius.Value, + Badge = input_badge.Text==""? null:input_badge.Text, + BadgeSize = (float)input_badgesize.Value, + BadgeBack = colorPicker.Value, + Enabled = switch_enabled.Checked, + Loading = switch_loading.Checked, + }, + // 使用文本 + new FloatButton.ConfigBtn("button3", "Text") + { + Tooltip = "Text Button", + Round = switch_round.Checked, + Type = (TTypeMini)select_type.SelectedValue, + Radius = (int)input_radius.Value, + Badge = input_badge.Text==""? null:input_badge.Text, + BadgeSize = (float)input_badgesize.Value, + BadgeBack = colorPicker.Value, + Enabled = switch_enabled.Checked, + Loading = switch_loading.Checked, + }, + //获取button示例,可以通过button的属性判断点击了哪个按钮,推荐用Name + }, button => + { + //回调事件 + AntdUI.Message.info(window, "Text:" + button.Text + ", Name:" + button.Name, autoClose: 3); + }) + // 浮动全局配置 + { + //字体 + Font = new Font("Microsoft YaHei UI", 9F, FontStyle.Regular, GraphicsUnit.Point), + //附着控件 + Control = null, + //位置 + Align = (TAlign)select_align.SelectedIndex, + //是否垂直方向 + Vertical = switch_vertical.Checked, + //是否置顶 + TopMost = switch_topmost.Checked, + //尺寸大小 + Size = (int)input_size.Value, + //相对于Align位置X轴偏移 + MarginX = (int)input_mx.Value, + //相对于Align位置Y轴偏移 + MarginY = (int)input_my.Value, + //按钮间距 + Gap = (int)input_gap.Value, + }); + } + } + + // 添加清理逻辑 + public void CloseFloatButtonForm() + { + if (InvokeRequired) + { + Invoke(new Action(CloseFloatButtonForm)); + } + else + { + // Ensure that floatButtonForm is not null before attempting to close it + if (floatButtonForm != null) + { + floatButtonForm.Close(); + floatButtonForm.Dispose(); + floatButtonForm = null; + } + } + } + + #region EventHandler + private void select_intvalue_SelectedIndexChanged(object sender, IntEventArgs e) + { + CloseFloatButtonForm(); + LoadFloatButton(); + } + + private void Switch_CheckedChanged(object sender, BoolEventArgs e) + { + CloseFloatButtonForm(); + LoadFloatButton(); + } + + private void colorPicker_ValueChanged(object sender, ColorEventArgs e) + { + CloseFloatButtonForm(); + LoadFloatButton(); + } + + private void input_badge_TextChanged(object sender, EventArgs e) + { + CloseFloatButtonForm(); + LoadFloatButton(); + } + + private void input_decimalvalue_ValeChanged(object sender, DecimalEventArgs e) + { + CloseFloatButtonForm(); + LoadFloatButton(); + } + + // 重置 + private void buttonCZ_Click(object sender, EventArgs e) + { + InitData(); + CloseFloatButtonForm(); + LoadFloatButton(); + } + + // 关闭 + private void buttonClose_Click(object sender, EventArgs e) + { + CloseFloatButtonForm(); + } + #endregion + } +} diff --git a/DHSoftware/Views/FloatButtonDemo.resx b/DHSoftware/Views/FloatButtonDemo.resx new file mode 100644 index 0000000..1af7de1 --- /dev/null +++ b/DHSoftware/Views/FloatButtonDemo.resx @@ -0,0 +1,120 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + text/microsoft-resx + + + 2.0 + + + System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + \ No newline at end of file diff --git a/DHSoftware/Views/PreTreatUserControl.Designer.cs b/DHSoftware/Views/PreTreatUserControl.Designer.cs new file mode 100644 index 0000000..a1e7d93 --- /dev/null +++ b/DHSoftware/Views/PreTreatUserControl.Designer.cs @@ -0,0 +1,207 @@ +namespace DHSoftware.Views +{ + partial class PreTreatUserControl + { + /// + /// 必需的设计器变量。 + /// + private System.ComponentModel.IContainer components = null; + + /// + /// 清理所有正在使用的资源。 + /// + /// 如果应释放托管资源,为 true;否则为 false。 + protected override void Dispose(bool disposing) + { + if (disposing && (components != null)) + { + components.Dispose(); + } + base.Dispose(disposing); + } + + #region 组件设计器生成的代码 + + /// + /// 设计器支持所需的方法 - 不要修改 + /// 使用代码编辑器修改此方法的内容。 + /// + private void InitializeComponent() + { + btnPreOpen = new AntdUI.Button(); + tbxPrePath = new TextBox(); + label1 = new AntdUI.Label(); + panel1 = new Panel(); + table1 = new AntdUI.Table(); + button1 = new AntdUI.Button(); + button2 = new AntdUI.Button(); + panel2 = new Panel(); + label2 = new Label(); + panel3 = new Panel(); + label3 = new Label(); + button3 = new AntdUI.Button(); + table2 = new AntdUI.Table(); + button4 = new AntdUI.Button(); + panel1.SuspendLayout(); + panel2.SuspendLayout(); + panel3.SuspendLayout(); + SuspendLayout(); + // + // btnPreOpen + // + btnPreOpen.Location = new Point(646, 17); + btnPreOpen.Name = "btnPreOpen"; + btnPreOpen.Size = new Size(46, 23); + btnPreOpen.TabIndex = 21; + btnPreOpen.Text = "..."; + // + // tbxPrePath + // + tbxPrePath.Location = new Point(91, 17); + tbxPrePath.Name = "tbxPrePath"; + tbxPrePath.Size = new Size(549, 23); + tbxPrePath.TabIndex = 20; + // + // label1 + // + label1.Location = new Point(12, 17); + label1.Name = "label1"; + label1.Size = new Size(73, 23); + label1.TabIndex = 19; + label1.Text = "预处理路径"; + // + // panel1 + // + panel1.Controls.Add(panel3); + panel1.Controls.Add(panel2); + panel1.Controls.Add(label1); + panel1.Controls.Add(btnPreOpen); + panel1.Controls.Add(tbxPrePath); + panel1.Dock = DockStyle.Fill; + panel1.Location = new Point(0, 0); + panel1.Name = "panel1"; + panel1.Size = new Size(759, 243); + panel1.TabIndex = 22; + // + // table1 + // + table1.Location = new Point(3, 65); + table1.Name = "table1"; + table1.Size = new Size(258, 126); + table1.TabIndex = 22; + table1.Text = "table1"; + // + // button1 + // + button1.Location = new Point(3, 25); + button1.Name = "button1"; + button1.Size = new Size(84, 34); + button1.TabIndex = 23; + button1.Text = "新增"; + // + // button2 + // + button2.Location = new Point(93, 25); + button2.Name = "button2"; + button2.Size = new Size(84, 34); + button2.TabIndex = 24; + button2.Text = "删除"; + // + // panel2 + // + panel2.Controls.Add(label2); + panel2.Controls.Add(button2); + panel2.Controls.Add(table1); + panel2.Controls.Add(button1); + panel2.Location = new Point(91, 46); + panel2.Name = "panel2"; + panel2.Size = new Size(264, 194); + panel2.TabIndex = 25; + // + // label2 + // + label2.AutoSize = true; + label2.Location = new Point(3, 5); + label2.Name = "label2"; + label2.Size = new Size(56, 17); + label2.TabIndex = 25; + label2.Text = "输入参数"; + // + // panel3 + // + panel3.Controls.Add(label3); + panel3.Controls.Add(button3); + panel3.Controls.Add(table2); + panel3.Controls.Add(button4); + panel3.Location = new Point(379, 46); + panel3.Name = "panel3"; + panel3.Size = new Size(264, 194); + panel3.TabIndex = 26; + // + // label3 + // + label3.AutoSize = true; + label3.Location = new Point(3, 2); + label3.Name = "label3"; + label3.Size = new Size(56, 17); + label3.TabIndex = 25; + label3.Text = "输出参数"; + // + // button3 + // + button3.Location = new Point(93, 25); + button3.Name = "button3"; + button3.Size = new Size(84, 34); + button3.TabIndex = 24; + button3.Text = "删除"; + // + // table2 + // + table2.Location = new Point(3, 65); + table2.Name = "table2"; + table2.Size = new Size(258, 126); + table2.TabIndex = 22; + table2.Text = "table2"; + // + // button4 + // + button4.Location = new Point(3, 25); + button4.Name = "button4"; + button4.Size = new Size(84, 34); + button4.TabIndex = 23; + button4.Text = "新增"; + // + // PreTreatUserControl + // + AutoScaleDimensions = new SizeF(7F, 17F); + AutoScaleMode = AutoScaleMode.Font; + Controls.Add(panel1); + Name = "PreTreatUserControl"; + Size = new Size(759, 243); + panel1.ResumeLayout(false); + panel1.PerformLayout(); + panel2.ResumeLayout(false); + panel2.PerformLayout(); + panel3.ResumeLayout(false); + panel3.PerformLayout(); + ResumeLayout(false); + } + + #endregion + + private AntdUI.Button btnPreOpen; + private TextBox tbxPrePath; + private AntdUI.Label label1; + private Panel panel1; + private AntdUI.Button button2; + private AntdUI.Button button1; + private AntdUI.Table table1; + private Panel panel2; + private Panel panel3; + private Label label3; + private AntdUI.Button button3; + private AntdUI.Table table2; + private AntdUI.Button button4; + private Label label2; + } +} diff --git a/DHSoftware/Views/PreTreatUserControl.cs b/DHSoftware/Views/PreTreatUserControl.cs new file mode 100644 index 0000000..b99d13c --- /dev/null +++ b/DHSoftware/Views/PreTreatUserControl.cs @@ -0,0 +1,20 @@ +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 PreTreatUserControl : UserControl + { + public PreTreatUserControl() + { + InitializeComponent(); + } + } +} diff --git a/DHSoftware/Views/PreTreatUserControl.resx b/DHSoftware/Views/PreTreatUserControl.resx new file mode 100644 index 0000000..af32865 --- /dev/null +++ b/DHSoftware/Views/PreTreatUserControl.resx @@ -0,0 +1,120 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + text/microsoft-resx + + + 2.0 + + + System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + \ No newline at end of file diff --git a/DHSoftware/Views/SizeConfigControl.Designer.cs b/DHSoftware/Views/SizeConfigControl.Designer.cs new file mode 100644 index 0000000..50b7ddb --- /dev/null +++ b/DHSoftware/Views/SizeConfigControl.Designer.cs @@ -0,0 +1,103 @@ +namespace DHSoftware.Views +{ + partial class SizeConfigControl + { + /// + /// 必需的设计器变量。 + /// + private System.ComponentModel.IContainer components = null; + + /// + /// 清理所有正在使用的资源。 + /// + /// 如果应释放托管资源,为 true;否则为 false。 + protected override void Dispose(bool disposing) + { + if (disposing && (components != null)) + { + components.Dispose(); + } + base.Dispose(disposing); + } + + #region 组件设计器生成的代码 + + /// + /// 设计器支持所需的方法 - 不要修改 + /// 使用代码编辑器修改此方法的内容。 + /// + private void InitializeComponent() + { + panel2 = new Panel(); + label2 = new Label(); + button2 = new AntdUI.Button(); + table1 = new AntdUI.Table(); + button1 = new AntdUI.Button(); + panel2.SuspendLayout(); + SuspendLayout(); + // + // panel2 + // + panel2.Controls.Add(label2); + panel2.Controls.Add(button2); + panel2.Controls.Add(table1); + panel2.Controls.Add(button1); + 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 = "模型参数"; + // + // button2 + // + button2.Location = new Point(93, 25); + button2.Name = "button2"; + button2.Size = new Size(84, 34); + button2.TabIndex = 24; + button2.Text = "删除"; + // + // table1 + // + table1.Location = new Point(3, 65); + table1.Name = "table1"; + table1.Size = new Size(773, 218); + table1.TabIndex = 22; + table1.Text = "table1"; + // + // button1 + // + button1.Location = new Point(3, 25); + button1.Name = "button1"; + button1.Size = new Size(84, 34); + button1.TabIndex = 23; + button1.Text = "新增"; + // + // SizeConfigControl + // + AutoScaleDimensions = new SizeF(7F, 17F); + AutoScaleMode = AutoScaleMode.Font; + Controls.Add(panel2); + Name = "SizeConfigControl"; + Size = new Size(785, 292); + panel2.ResumeLayout(false); + panel2.PerformLayout(); + ResumeLayout(false); + } + + #endregion + + private Panel panel2; + private Label label2; + private AntdUI.Button button2; + private AntdUI.Table table1; + private AntdUI.Button button1; + } +} diff --git a/DHSoftware/Views/SizeConfigControl.cs b/DHSoftware/Views/SizeConfigControl.cs new file mode 100644 index 0000000..a720330 --- /dev/null +++ b/DHSoftware/Views/SizeConfigControl.cs @@ -0,0 +1,20 @@ +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(); + } + } +} diff --git a/DHSoftware/Views/SizeConfigControl.resx b/DHSoftware/Views/SizeConfigControl.resx new file mode 100644 index 0000000..af32865 --- /dev/null +++ b/DHSoftware/Views/SizeConfigControl.resx @@ -0,0 +1,120 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + text/microsoft-resx + + + 2.0 + + + System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + \ No newline at end of file diff --git a/DHSoftware/Views/UserConfigFrm.Designer.cs b/DHSoftware/Views/UserConfigFrm.Designer.cs index 941dd2f..296ab4d 100644 --- a/DHSoftware/Views/UserConfigFrm.Designer.cs +++ b/DHSoftware/Views/UserConfigFrm.Designer.cs @@ -28,17 +28,76 @@ /// private void InitializeComponent() { + AntdUI.Tabs.StyleCard styleCard1 = new AntdUI.Tabs.StyleCard(); + menu = new AntdUI.Menu(); + UCFpanel1 = new Panel(); + panel1 = new Panel(); + tabs = new AntdUI.Tabs(); + UCFpanel1.SuspendLayout(); SuspendLayout(); // + // menu + // + menu.Dock = DockStyle.Left; + menu.Location = new Point(0, 0); + menu.Name = "menu"; + menu.Size = new Size(127, 536); + menu.TabIndex = 8; + menu.Text = "menu1"; + menu.SelectChanged += Menu_SelectChanged; + // + // UCFpanel1 + // + UCFpanel1.AutoSize = true; + UCFpanel1.Controls.Add(panel1); + UCFpanel1.Controls.Add(tabs); + UCFpanel1.Controls.Add(menu); + UCFpanel1.Dock = DockStyle.Fill; + UCFpanel1.Location = new Point(0, 0); + UCFpanel1.Name = "UCFpanel1"; + UCFpanel1.Size = new Size(749, 536); + UCFpanel1.TabIndex = 1; + // + // panel1 + // + panel1.BackColor = SystemColors.Highlight; + panel1.Dock = DockStyle.Left; + panel1.Location = new Point(127, 0); + panel1.Name = "panel1"; + panel1.Size = new Size(5, 536); + panel1.TabIndex = 10; + // + // tabs + // + tabs.Dock = DockStyle.Fill; + tabs.ForeColor = SystemColors.Control; + tabs.Location = new Point(127, 0); + tabs.Name = "tabs"; + tabs.Size = new Size(622, 536); + tabs.Style = styleCard1; + tabs.TabIndex = 9; + tabs.Text = "tabs1"; + tabs.Type = AntdUI.TabType.Card; + tabs.SelectedIndexChanged += tabs_SelectedIndexChanged; + // // UserConfigFrm // AutoScaleDimensions = new SizeF(7F, 17F); AutoScaleMode = AutoScaleMode.Font; + AutoSize = true; + Controls.Add(UCFpanel1); Name = "UserConfigFrm"; Size = new Size(749, 536); + UCFpanel1.ResumeLayout(false); ResumeLayout(false); + PerformLayout(); } #endregion + + private AntdUI.Menu menu; + private Panel UCFpanel1; + private AntdUI.Tabs tabs; + private Panel panel1; } } diff --git a/DHSoftware/Views/UserConfigFrm.cs b/DHSoftware/Views/UserConfigFrm.cs index 0d81922..4177522 100644 --- a/DHSoftware/Views/UserConfigFrm.cs +++ b/DHSoftware/Views/UserConfigFrm.cs @@ -1,4 +1,7 @@ -using System; +using AntdUI; +using AntdUIDemo.Models; +using AntdUIDemo.Views; +using System; using System.Collections.Generic; using System.ComponentModel; using System.Data; @@ -7,14 +10,157 @@ using System.Linq; using System.Text; using System.Threading.Tasks; using System.Windows.Forms; +using static System.Windows.Forms.VisualStyles.VisualStyleElement; namespace DHSoftware.Views { public partial class UserConfigFrm : UserControl { + private UserControl currControl; + private bool isUpdatingTabs = false;//用于阻止Tabs更新 public UserConfigFrm() { InitializeComponent(); + + LoadMenu(); + menu.Width = (int)(100 * Config.Dpi); + + } + private void LoadMenu(string filter = "") + { + menu.Items.Clear(); + + string lang = AntdUI.Localization.CurrentLanguage; + var menuItems = DataUtil.Menu_decetion; + //var menuIcons = DataUtil.MenuIcons_zhcn; + //if (lang.StartsWith("en")) + //{ + // menuItems = DataUtil.MenuItems_enus; + // menuIcons = DataUtil.MenuIcons_enus; + //} + + foreach (var rootItem in menuItems) + { + var rootKey = rootItem.Key.ToLower(); + var rootMenu = new AntdUI.MenuItem + { + Text = rootItem.Key, + //IconSvg = menuIcons.TryGetValue(rootItem.Key, out var icon) ? icon : "UnorderedListOutlined", + }; + bool rootVisible = false; // 用于标记是否显示根节点 + + foreach (var item in rootItem.Value) + { + var childText = item.Text.ToLower(); + + // 如果子节点包含搜索文本 + if (childText.Contains(filter)) + { + var menuItem = new AntdUI.MenuItem + { + Text = item.Text, + IconSvg = item.IconSvg, + Tag = item.Tag, + }; + rootMenu.Sub.Add(menuItem); + rootVisible = true; // 如果有子节点包含,则显示根节点 + } + } + + // 如果根节点包含搜索文本,或有可见的子节点,则显示根节点 + if (rootKey.Contains(filter) || rootVisible) + { + menu.Items.Add(rootMenu); + } + } + } + private void SelectMenu() + { + if (isUpdatingTabs) return; + var text = tabs.SelectedTab?.Text; // 使用安全导航操作符,防止 SelectedTab 为 null + if (string.IsNullOrEmpty(text)) // 检查 text 是否为 null 或空 + { + return; // 如果 text 为空,直接退出方法 + } + //首页 + if (text == AntdUI.Localization.Get("home", "主页")) + { + return; + } + var rootIndex = 0; + var subIndex = 0; + var menuItemsCopy = menu.Items.ToList(); // 创建副本 + for (int i = 0; i < menuItemsCopy.Count; i++) + { + for (int j = 0; j < menuItemsCopy[i].Sub.Count; j++) + { + if (menuItemsCopy[i].Sub[j].Tag.ToString() == text) + { + rootIndex = i; + subIndex = j; + break; + } + } + } + menu.SelectIndex(rootIndex, subIndex, true); + } + private void Menu_SelectChanged(object sender, MenuSelectEventArgs e) + { + string name = (string)e.Value.Tag; + + // 清理上一个浮动按钮窗体 + if (currControl is FloatButtonDemo floatButtonDemo) + { + floatButtonDemo.CloseFloatButtonForm(); + } + + // 检查是否已存在同名 TabPage + foreach (var tab in tabs.Pages) + { + if (tab is AntdUI.TabPage existingTab && existingTab.Text == name) + { + isUpdatingTabs = true; + tabs.SelectedTab = existingTab; + isUpdatingTabs = false; + currControl = existingTab.Controls.Count > 0 ? existingTab.Controls[0] as UserControl : null; + return; + } + } + int width = tabs.Width; + int height = tabs.Height; + // 创建新 TabPage + UserControl control =new UserDetetion(width, height); + switch (name) + { + case "工位1": + // control = + break; + } + + if (control != null) + { + control.Dock = DockStyle.Fill; + // AutoDpi(control); // 如果有 DPI 适配逻辑 + + var tabPage = new AntdUI.TabPage + { + Dock = DockStyle.Fill, + Text = name, + }; + tabPage.Controls.Add(control); + tabs.Pages.Add(tabPage); + + isUpdatingTabs = true; + tabs.SelectedTab = tabPage; + isUpdatingTabs = false; + currControl = control; + } + } + + + private void tabs_SelectedIndexChanged(object sender, IntEventArgs e) + { + SelectMenu(); } } } diff --git a/DHSoftware/Views/UserDetetion.Designer.cs b/DHSoftware/Views/UserDetetion.Designer.cs new file mode 100644 index 0000000..69319b4 --- /dev/null +++ b/DHSoftware/Views/UserDetetion.Designer.cs @@ -0,0 +1,69 @@ +namespace DHSoftware.Views +{ + partial class UserDetetion + { + /// + /// 必需的设计器变量。 + /// + private System.ComponentModel.IContainer components = null; + + /// + /// 清理所有正在使用的资源。 + /// + /// 如果应释放托管资源,为 true;否则为 false。 + protected override void Dispose(bool disposing) + { + if (disposing && (components != null)) + { + components.Dispose(); + } + base.Dispose(disposing); + } + + #region 组件设计器生成的代码 + + /// + /// 设计器支持所需的方法 - 不要修改 + /// 使用代码编辑器修改此方法的内容。 + /// + private void InitializeComponent() + { + collapse1 = new AntdUI.Collapse(); + panel1 = new Panel(); + SuspendLayout(); + // + // collapse1 + // + collapse1.Dock = DockStyle.Fill; + collapse1.Location = new Point(0, 0); + collapse1.Name = "collapse1"; + collapse1.Size = new Size(842, 568); + collapse1.TabIndex = 0; + collapse1.Text = "collapse1"; + // + // panel1 + // + panel1.BackColor = SystemColors.GradientActiveCaption; + panel1.Dock = DockStyle.Left; + panel1.Location = new Point(0, 0); + panel1.Name = "panel1"; + panel1.Size = new Size(2, 568); + panel1.TabIndex = 0; + // + // UserDetetion + // + AutoScaleDimensions = new SizeF(7F, 17F); + AutoScaleMode = AutoScaleMode.Font; + Controls.Add(panel1); + Controls.Add(collapse1); + Name = "UserDetetion"; + Size = new Size(842, 568); + ResumeLayout(false); + } + + #endregion + + private AntdUI.Collapse collapse1; + private Panel panel1; + } +} diff --git a/DHSoftware/Views/UserDetetion.cs b/DHSoftware/Views/UserDetetion.cs new file mode 100644 index 0000000..480b1ba --- /dev/null +++ b/DHSoftware/Views/UserDetetion.cs @@ -0,0 +1,88 @@ +using AntdUI; +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 UserDetetion : UserControl + { + //根据检测配置 将对应的相机配置、中处理预处理、尺寸测量 + public UserDetetion(int parentWidth, int parentHeight) + { + InitializeComponent(); + AntdUI.CollapseItem group1 = new CollapseItem(); + group1.Height = parentHeight / 3; + group1.Text = "相机配置"; + AntdUI.CollapseItem group2 = new CollapseItem(); + group2.Text = "预处理中处理"; + group2.Height = parentHeight -300; + AntdUI.CollapseItem group3 = new CollapseItem(); + group3.Text = "尺寸测量"; + group3.Height = parentHeight/3; + + + + // 父容器(如 Panel)设置自动滚动 + System.Windows.Forms.Panel panel = new System.Windows.Forms.Panel + { + Dock = DockStyle.Fill, + AutoScroll = true // 关键:启用滚动条 + }; + + + // 父容器(如 Panel)设置自动滚动 + System.Windows.Forms.FlowLayoutPanel panel2 = new System.Windows.Forms.FlowLayoutPanel + { + Dock = DockStyle.Fill, + AutoScroll = true // 关键:启用滚动条 + }; + + // 父容器(如 Panel)设置自动滚动 + System.Windows.Forms.Panel panel3 = new System.Windows.Forms.Panel + { + Dock = DockStyle.Fill, + AutoScroll = true // 关键:启用滚动条 + }; + + + CameraConfigControl camConfigFrm = new CameraConfigControl(); + camConfigFrm.Dock = DockStyle.Fill; + panel.Controls.Add(camConfigFrm); + + PreTreatUserControl ptuc = new PreTreatUserControl(); + ptuc.AutoScroll = true; + panel2.Controls.Add(ptuc); + DetectConfigControl detect = new DetectConfigControl(); + // detect.Dock = DockStyle.Fill; + detect.AutoScroll = true; + panel2.Controls.Add(detect); + + + SizeConfigControl Sizefc = new SizeConfigControl(); + Sizefc.Dock = DockStyle.Fill; + panel3.Controls.Add(Sizefc); + + + + + group1.Controls.Add(panel); + group2.Controls.Add(panel2); + group3.Controls.Add(panel3); + + + //collapse1.Items.Add(group1); + collapse1.Items.Add(group1); + collapse1.Items.Add(group2); + collapse1.Items.Add(group3); + + + } + } +} diff --git a/DHSoftware/Views/UserDetetion.resx b/DHSoftware/Views/UserDetetion.resx new file mode 100644 index 0000000..af32865 --- /dev/null +++ b/DHSoftware/Views/UserDetetion.resx @@ -0,0 +1,120 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + text/microsoft-resx + + + 2.0 + + + System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + \ No newline at end of file