From 8aec9ba7fa4e98ba32f452edad09ad41c6790708 Mon Sep 17 00:00:00 2001 From: "xhm\\HP" <1173131411@qq.com> Date: Sat, 22 Mar 2025 16:16:34 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E6=94=B9=E4=B8=80=E7=82=B9=E7=95=8C?= =?UTF-8?q?=E9=9D=A2?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- DH.Commons/Base/CameraBase.cs | 29 ++++- DH.Commons/Base/GloablConfig.cs | 12 ++ DH.Commons/Enums/Enum.cs | 15 ++- DHSoftware/Views/CameraControl.Designer.cs | 111 +++++++++++----- DHSoftware/Views/CameraControl.cs | 48 ++++++- DHSoftware/Views/MotionEdit.Designer.cs | 139 ++++++++++----------- DHSoftware/Views/MotionEdit.cs | 8 +- DHSoftware/Views/MotionEdit.resx | 4 +- 8 files changed, 247 insertions(+), 119 deletions(-) create mode 100644 DH.Commons/Base/GloablConfig.cs diff --git a/DH.Commons/Base/CameraBase.cs b/DH.Commons/Base/CameraBase.cs index c46eb10..07eee8a 100644 --- a/DH.Commons/Base/CameraBase.cs +++ b/DH.Commons/Base/CameraBase.cs @@ -2,6 +2,7 @@ using System.ComponentModel; using System.Drawing.Imaging; using AntdUI; +using DH.Commons.Enums; using OpenCvSharp; namespace DH.Commons.Base @@ -10,11 +11,13 @@ namespace DH.Commons.Base { // 私有字段 + 带通知的属性(与DetectionLabel风格一致) private bool _isEnabled = false; + private bool _isallPicEnabled = true;//默认全画幅 private bool _isContinueMode = false; private bool _isSavePicEnabled = false; private string _imageSaveDirectory; + private EnumCamType _CamType; private ImageFormat _imageFormat = ImageFormat.Jpeg; - private bool _isHardwareTrigger = false; + private bool _isHardwareTrigger = true; private string _serialNumber = string.Empty; private string _cameraName = string.Empty; private string _cameraIP = string.Empty; @@ -56,7 +59,16 @@ namespace DH.Commons.Base OnPropertyChanged(nameof(IsEnabled)); } } - + public virtual bool IsAllPicEnabled + { + get => _isallPicEnabled; + set + { + if (_isallPicEnabled == value) return; + _isallPicEnabled = value; + OnPropertyChanged(nameof(IsAllPicEnabled)); + } + } public virtual bool IsSavePicEnabled { get => _isSavePicEnabled; @@ -95,6 +107,19 @@ namespace DH.Commons.Base OnPropertyChanged(nameof(ImageFormat)); } } + [Category("设备配置")] + [DisplayName("相机类型")] + [Description("相机类型")] + public EnumCamType CamType + { + get => _CamType; + set + { + if (_CamType == value) return; + _CamType = value; + OnPropertyChanged(nameof(CamType)); + } + } [Category("采图模式")] [DisplayName("硬触发")] diff --git a/DH.Commons/Base/GloablConfig.cs b/DH.Commons/Base/GloablConfig.cs new file mode 100644 index 0000000..ce0e51d --- /dev/null +++ b/DH.Commons/Base/GloablConfig.cs @@ -0,0 +1,12 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace DH.Commons.Base +{ + internal class GloablConfig + { + } +} diff --git a/DH.Commons/Enums/Enum.cs b/DH.Commons/Enums/Enum.cs index 07a5af3..8c17014 100644 --- a/DH.Commons/Enums/Enum.cs +++ b/DH.Commons/Enums/Enum.cs @@ -36,7 +36,14 @@ namespace DH.Commons.Enums infernce } - + public enum EnumCamType + { + [Description("度申相机")] + 度申Do3think = 0, + [Description("海康相机")] + 海康hik , + + } public enum EnumPLCType @@ -93,7 +100,11 @@ namespace DH.Commons.Enums 工件最小值=27, 工具最大值=28, 启用心跳=29, - 心跳地址=30 + 心跳地址=30, + 挡料电机回原点, + 挡料电机回原点速度, + + } diff --git a/DHSoftware/Views/CameraControl.Designer.cs b/DHSoftware/Views/CameraControl.Designer.cs index 1cfa034..21cd9ef 100644 --- a/DHSoftware/Views/CameraControl.Designer.cs +++ b/DHSoftware/Views/CameraControl.Designer.cs @@ -56,6 +56,10 @@ label9 = new AntdUI.Label(); label10 = new AntdUI.Label(); label11 = new AntdUI.Label(); + sthAllPic = new AntdUI.Switch(); + label12 = new AntdUI.Label(); + sltCamType = new AntdUI.Select(); + label13 = new AntdUI.Label(); ((System.ComponentModel.ISupportInitialize)pictureBox1).BeginInit(); SuspendLayout(); // @@ -78,88 +82,88 @@ // // label1 // - label1.Location = new Point(28, 114); + label1.Location = new Point(28, 140); label1.Name = "label1"; - label1.Size = new Size(59, 23); + label1.Size = new Size(59, 36); label1.TabIndex = 14; label1.Text = "曝 光"; // // label2 // - label2.Location = new Point(28, 156); + label2.Location = new Point(28, 183); label2.Name = "label2"; - label2.Size = new Size(59, 23); + label2.Size = new Size(59, 36); label2.TabIndex = 15; label2.Text = "增 益"; // // label3 // - label3.Location = new Point(28, 198); + label3.Location = new Point(28, 226); label3.Name = "label3"; - label3.Size = new Size(59, 23); + label3.Size = new Size(59, 36); label3.TabIndex = 16; label3.Text = "旋转角度"; // // iptExposure // - iptExposure.Location = new Point(93, 100); + iptExposure.Location = new Point(93, 140); iptExposure.Name = "iptExposure"; - iptExposure.Size = new Size(94, 37); + iptExposure.Size = new Size(94, 36); iptExposure.TabIndex = 17; iptExposure.Tag = ""; iptExposure.Text = "0"; // // iptGain // - iptGain.Location = new Point(93, 143); + iptGain.Location = new Point(93, 183); iptGain.Name = "iptGain"; - iptGain.Size = new Size(94, 37); + iptGain.Size = new Size(94, 36); iptGain.TabIndex = 18; iptGain.Text = "0"; // // iptRevolve // - iptRevolve.Location = new Point(93, 186); + iptRevolve.Location = new Point(93, 226); iptRevolve.Name = "iptRevolve"; - iptRevolve.Size = new Size(94, 37); + iptRevolve.Size = new Size(94, 36); iptRevolve.TabIndex = 19; iptRevolve.Text = "0"; // // label4 // - label4.Location = new Point(28, 242); + label4.Location = new Point(28, 269); label4.Name = "label4"; - label4.Size = new Size(59, 23); + label4.Size = new Size(59, 36); label4.TabIndex = 20; label4.Text = "采图模式"; // // sltAcquisitionMode // sltAcquisitionMode.List = true; - sltAcquisitionMode.Location = new Point(93, 229); + sltAcquisitionMode.Location = new Point(93, 269); sltAcquisitionMode.Name = "sltAcquisitionMode"; sltAcquisitionMode.Size = new Size(94, 36); sltAcquisitionMode.TabIndex = 21; // // label5 // - label5.Location = new Point(28, 287); + label5.Location = new Point(28, 314); label5.Name = "label5"; - label5.Size = new Size(59, 23); + label5.Size = new Size(59, 36); label5.TabIndex = 22; label5.Text = "触发模式"; // // sltTriggerMode // sltTriggerMode.List = true; - sltTriggerMode.Location = new Point(93, 274); + sltTriggerMode.Location = new Point(93, 314); sltTriggerMode.Name = "sltTriggerMode"; sltTriggerMode.Size = new Size(94, 36); sltTriggerMode.TabIndex = 26; // // label7 // - label7.Location = new Point(19, 396); + label7.Location = new Point(19, 476); label7.Name = "label7"; label7.Size = new Size(29, 23); label7.TabIndex = 28; @@ -167,7 +171,7 @@ // // iptROIW // - iptROIW.Location = new Point(93, 414); + iptROIW.Location = new Point(93, 494); iptROIW.Name = "iptROIW"; iptROIW.Size = new Size(94, 37); iptROIW.TabIndex = 31; @@ -175,7 +179,7 @@ // // iptROIY // - iptROIY.Location = new Point(93, 371); + iptROIY.Location = new Point(93, 451); iptROIY.Name = "iptROIY"; iptROIY.Size = new Size(94, 37); iptROIY.TabIndex = 30; @@ -183,7 +187,7 @@ // // iptROIX // - iptROIX.Location = new Point(93, 328); + iptROIX.Location = new Point(93, 408); iptROIX.Name = "iptROIX"; iptROIX.Size = new Size(94, 37); iptROIX.TabIndex = 29; @@ -192,7 +196,7 @@ // // iptROIH // - iptROIH.Location = new Point(93, 457); + iptROIH.Location = new Point(93, 537); iptROIH.Name = "iptROIH"; iptROIH.Size = new Size(94, 37); iptROIH.TabIndex = 32; @@ -203,7 +207,7 @@ pictureBox1.BorderStyle = BorderStyle.FixedSingle; pictureBox1.Location = new Point(219, 23); pictureBox1.Name = "pictureBox1"; - pictureBox1.Size = new Size(659, 429); + pictureBox1.Size = new Size(659, 489); pictureBox1.TabIndex = 33; pictureBox1.TabStop = false; // @@ -214,7 +218,7 @@ btnSizeAdd.Ghost = true; btnSizeAdd.IconRatio = 0F; btnSizeAdd.IconSvg = ""; - btnSizeAdd.Location = new Point(280, 458); + btnSizeAdd.Location = new Point(282, 532); btnSizeAdd.Name = "btnSizeAdd"; btnSizeAdd.Size = new Size(80, 38); btnSizeAdd.TabIndex = 34; @@ -227,7 +231,7 @@ button1.Ghost = true; button1.IconRatio = 0F; button1.IconSvg = ""; - button1.Location = new Point(438, 458); + button1.Location = new Point(440, 532); button1.Name = "button1"; button1.Size = new Size(80, 38); button1.TabIndex = 35; @@ -240,7 +244,7 @@ button2.Ghost = true; button2.IconRatio = 0F; button2.IconSvg = ""; - button2.Location = new Point(593, 458); + button2.Location = new Point(595, 532); button2.Name = "button2"; button2.Size = new Size(80, 38); button2.TabIndex = 36; @@ -253,7 +257,7 @@ button3.Ghost = true; button3.IconRatio = 0F; button3.IconSvg = ""; - button3.Location = new Point(741, 458); + button3.Location = new Point(743, 532); button3.Name = "button3"; button3.Size = new Size(80, 38); button3.TabIndex = 37; @@ -278,7 +282,7 @@ // // label8 // - label8.Location = new Point(58, 328); + label8.Location = new Point(58, 408); label8.Name = "label8"; label8.Size = new Size(29, 37); label8.TabIndex = 40; @@ -286,7 +290,7 @@ // // label9 // - label9.Location = new Point(58, 371); + label9.Location = new Point(58, 451); label9.Name = "label9"; label9.Size = new Size(29, 37); label9.TabIndex = 41; @@ -294,7 +298,7 @@ // // label10 // - label10.Location = new Point(43, 414); + label10.Location = new Point(43, 494); label10.Name = "label10"; label10.Size = new Size(44, 37); label10.TabIndex = 42; @@ -302,16 +306,53 @@ // // label11 // - label11.Location = new Point(43, 458); + label11.Location = new Point(43, 538); label11.Name = "label11"; label11.Size = new Size(44, 36); label11.TabIndex = 43; label11.Text = "高度:"; // + // sthAllPic + // + sthAllPic.CheckedText = "启用"; + sthAllPic.Location = new Point(93, 356); + sthAllPic.Name = "sthAllPic"; + sthAllPic.Size = new Size(94, 33); + sthAllPic.TabIndex = 45; + sthAllPic.UnCheckedText = "关闭"; + // + // label12 + // + label12.Location = new Point(28, 366); + label12.Name = "label12"; + label12.Size = new Size(59, 23); + label12.TabIndex = 44; + label12.Text = "全 画 幅"; + // + // sltCamType + // + sltCamType.List = true; + sltCamType.Location = new Point(93, 97); + sltCamType.Name = "sltCamType"; + sltCamType.Size = new Size(94, 36); + sltCamType.TabIndex = 47; + // + // label13 + // + label13.Location = new Point(28, 99); + label13.Name = "label13"; + label13.Size = new Size(59, 36); + label13.TabIndex = 46; + label13.Text = "相机类型"; + // // CameraControl // AutoScaleDimensions = new SizeF(7F, 17F); AutoScaleMode = AutoScaleMode.Font; + Controls.Add(sltCamType); + Controls.Add(label13); + Controls.Add(sthAllPic); + Controls.Add(label12); Controls.Add(label11); Controls.Add(label10); Controls.Add(label9); @@ -341,7 +382,7 @@ Controls.Add(swhEnable); Controls.Add(label18); Name = "CameraControl"; - Size = new Size(909, 505); + Size = new Size(909, 601); ((System.ComponentModel.ISupportInitialize)pictureBox1).EndInit(); ResumeLayout(false); } @@ -376,5 +417,9 @@ private AntdUI.Label label9; private AntdUI.Label label10; private AntdUI.Label label11; + private AntdUI.Switch sthAllPic; + private AntdUI.Label label12; + private AntdUI.Select sltCamType; + private AntdUI.Label label13; } } diff --git a/DHSoftware/Views/CameraControl.cs b/DHSoftware/Views/CameraControl.cs index 4545ae2..0c99e1b 100644 --- a/DHSoftware/Views/CameraControl.cs +++ b/DHSoftware/Views/CameraControl.cs @@ -10,6 +10,8 @@ using System.Windows.Forms; using AntdUI; using DH.Commons.Base; using DH.Commons.Enums; +using static System.Windows.Forms.VisualStyles.VisualStyleElement; +using Window = AntdUI.Window; namespace DHSoftware.Views { @@ -17,17 +19,42 @@ namespace DHSoftware.Views { Window window; CameraBase CameraBase; - public CameraControl(Window _window,CameraBase cameraBase) + public CameraControl(Window _window, CameraBase cameraBase) { - window= _window; + window = _window; CameraBase = cameraBase; InitializeComponent(); - + sltCamType.TextChanged += SltCamTpye_TextChanged; InitData(); BindData(); } + private void SltCamTpye_TextChanged(object? sender, EventArgs e) + { + if (sender is Select slt && !string.IsNullOrEmpty(slt.Text)) + { + // 将文本转换为枚举值 + if (Enum.TryParse(slt.Text, out var plcType)) + { + switch (plcType) + { + case EnumCamType.度申Do3think: + case EnumCamType.海康hik: + + break; + + + default: + break; + } + } + else + { + + } + } + } private void SltAcquisitionMode_SelectedIndexChanged(object sender, IntEventArgs e) @@ -40,7 +67,7 @@ namespace DHSoftware.Views case (int)CameraAcquisitionMode.触发模式: sltTriggerMode.Enabled = true; break; - default: + default: break; } } @@ -48,10 +75,12 @@ namespace DHSoftware.Views private void BindData() { - - sthPic.DataBindings.Add(nameof(sthPic.Checked), CameraBase, nameof(CameraBase.IsSavePicEnabled), + sltCamType.DataBindings.Add("Text", CameraBase, "CamType", true, DataSourceUpdateMode.OnPropertyChanged, ""); + sthPic.DataBindings.Add(nameof(sthPic.Checked), CameraBase, nameof(CameraBase.IsSavePicEnabled), true, DataSourceUpdateMode.OnPropertyChanged); + sthAllPic.DataBindings.Add(nameof(sthAllPic.Checked), CameraBase, nameof(CameraBase.IsAllPicEnabled), + true, DataSourceUpdateMode.OnPropertyChanged); // 启用状态绑定 swhEnable.DataBindings.Add(nameof(swhEnable.Checked), CameraBase, nameof(CameraBase.IsEnabled), true, DataSourceUpdateMode.OnPropertyChanged); @@ -89,6 +118,12 @@ namespace DHSoftware.Views private void InitData() { + // 获取枚举字段名列表(原描述改为字段名) + sltCamType.Items.Clear(); + foreach (EnumCamType value in Enum.GetValues(typeof(EnumCamType))) + { + sltCamType.Items.Add(value.ToString()); + } // 初始化下拉框选项 sltAcquisitionMode.Items.AddRange(new[] { "连续模式", "触发模式" }); sltTriggerMode.Items.AddRange(new[] { "软触发", "硬触发" }); @@ -97,5 +132,6 @@ namespace DHSoftware.Views sltAcquisitionMode.SelectedIndex = CameraBase.IsContinueMode ? 0 : 1; sltTriggerMode.SelectedIndex = CameraBase.IsHardwareTrigger ? 1 : 0; } + } } diff --git a/DHSoftware/Views/MotionEdit.Designer.cs b/DHSoftware/Views/MotionEdit.Designer.cs index 90cb2f7..136b497 100644 --- a/DHSoftware/Views/MotionEdit.Designer.cs +++ b/DHSoftware/Views/MotionEdit.Designer.cs @@ -37,16 +37,10 @@ divider1 = new AntdUI.Divider(); label1 = new AntdUI.Label(); panel1 = new AntdUI.Panel(); - sltDataType = new AntdUI.Select(); - label3 = new AntdUI.Label(); - iptAddress = new AntdUI.Input(); - label7 = new AntdUI.Label(); stackPanel3 = new AntdUI.StackPanel(); - iptEndIndex = new AntdUI.Input(); sltEnd = new AntdUI.Select(); label6 = new AntdUI.Label(); stackPanel2 = new AntdUI.StackPanel(); - iptStartIndex = new AntdUI.Input(); sltStart = new AntdUI.Select(); label5 = new AntdUI.Label(); sltBoolValue = new AntdUI.Select(); @@ -54,6 +48,12 @@ sltIntType = new AntdUI.Select(); iptValue = new AntdUI.Input(); label4 = new AntdUI.Label(); + iptAddress = new AntdUI.Input(); + label7 = new AntdUI.Label(); + sltDataType = new AntdUI.Select(); + label3 = new AntdUI.Label(); + iptStartIndex = new AntdUI.InputNumber(); + iptEndIndex = new AntdUI.InputNumber(); stackPanel1.SuspendLayout(); panel1.SuspendLayout(); stackPanel3.SuspendLayout(); @@ -168,46 +168,6 @@ panel1.Size = new Size(445, 572); panel1.TabIndex = 1; panel1.Text = "panel1"; - - // - // sltDataType - // - sltDataType.Dock = DockStyle.Top; - sltDataType.List = true; - sltDataType.Location = new Point(18, 196); - sltDataType.Name = "sltDataType"; - sltDataType.Size = new Size(409, 38); - sltDataType.TabIndex = 45; - // - // label3 - // - label3.Dock = DockStyle.Top; - label3.Font = new Font("Microsoft YaHei UI", 12F, FontStyle.Regular, GraphicsUnit.Point, 134); - label3.Location = new Point(18, 172); - label3.Name = "label3"; - label3.Size = new Size(409, 24); - label3.TabIndex = 44; - label3.Text = "数据类型"; - // - // iptAddress - // - iptAddress.Dock = DockStyle.Top; - iptAddress.Font = new Font("Microsoft YaHei UI", 9F, FontStyle.Regular, GraphicsUnit.Point, 134); - iptAddress.Location = new Point(18, 258); - iptAddress.Name = "iptAddress"; - iptAddress.Radius = 3; - iptAddress.Size = new Size(409, 38); - iptAddress.TabIndex = 54; - // - // label7 - // - label7.Dock = DockStyle.Top; - label7.Font = new Font("Microsoft YaHei UI", 12F, FontStyle.Regular, GraphicsUnit.Point, 134); - label7.Location = new Point(18, 234); - label7.Name = "label7"; - label7.Size = new Size(409, 24); - label7.TabIndex = 53; - label7.Text = "地址"; // // stackPanel3 // @@ -221,17 +181,6 @@ stackPanel3.TabIndex = 61; stackPanel3.Text = "stackPanel3"; // - // iptEndIndex - // - iptEndIndex.Dock = DockStyle.Left; - iptEndIndex.Font = new Font("Microsoft YaHei UI", 9F, FontStyle.Regular, GraphicsUnit.Point, 134); - iptEndIndex.Location = new Point(277, 3); - iptEndIndex.Name = "iptEndIndex"; - iptEndIndex.PlaceholderText = "执行顺序标识(0开始)"; - iptEndIndex.Radius = 3; - iptEndIndex.Size = new Size(132, 39); - iptEndIndex.TabIndex = 36; - // // sltEnd // sltEnd.Dock = DockStyle.Left; @@ -264,17 +213,6 @@ stackPanel2.TabIndex = 59; stackPanel2.Text = "stackPanel2"; // - // iptStartIndex - // - iptStartIndex.Dock = DockStyle.Left; - iptStartIndex.Font = new Font("Microsoft YaHei UI", 9F, FontStyle.Regular, GraphicsUnit.Point, 134); - iptStartIndex.Location = new Point(277, 3); - iptStartIndex.Name = "iptStartIndex"; - iptStartIndex.PlaceholderText = "执行顺序标识(0开始)"; - iptStartIndex.Radius = 3; - iptStartIndex.Size = new Size(132, 39); - iptStartIndex.TabIndex = 36; - // // sltStart // sltStart.Dock = DockStyle.Left; @@ -346,6 +284,67 @@ label4.TabIndex = 55; label4.Text = "值"; // + // iptAddress + // + iptAddress.Dock = DockStyle.Top; + iptAddress.Font = new Font("Microsoft YaHei UI", 9F, FontStyle.Regular, GraphicsUnit.Point, 134); + iptAddress.Location = new Point(18, 258); + iptAddress.Name = "iptAddress"; + iptAddress.Radius = 3; + iptAddress.Size = new Size(409, 38); + iptAddress.TabIndex = 54; + // + // label7 + // + label7.Dock = DockStyle.Top; + label7.Font = new Font("Microsoft YaHei UI", 12F, FontStyle.Regular, GraphicsUnit.Point, 134); + label7.Location = new Point(18, 234); + label7.Name = "label7"; + label7.Size = new Size(409, 24); + label7.TabIndex = 53; + label7.Text = "地址"; + // + // sltDataType + // + sltDataType.Dock = DockStyle.Top; + sltDataType.List = true; + sltDataType.Location = new Point(18, 196); + sltDataType.Name = "sltDataType"; + sltDataType.Size = new Size(409, 38); + sltDataType.TabIndex = 45; + // + // label3 + // + label3.Dock = DockStyle.Top; + label3.Font = new Font("Microsoft YaHei UI", 12F, FontStyle.Regular, GraphicsUnit.Point, 134); + label3.Location = new Point(18, 172); + label3.Name = "label3"; + label3.Size = new Size(409, 24); + label3.TabIndex = 44; + label3.Text = "数据类型"; + // + // iptStartIndex + // + iptStartIndex.Location = new Point(277, 3); + iptStartIndex.Maximum = new decimal(new int[] { 99999999, 0, 0, 0 }); + iptStartIndex.Minimum = new decimal(new int[] { 2, 0, 0, int.MinValue }); + iptStartIndex.Name = "iptStartIndex"; + iptStartIndex.Size = new Size(129, 39); + iptStartIndex.TabIndex = 37; + iptStartIndex.Text = "-1"; + iptStartIndex.Value = new decimal(new int[] { 1, 0, 0, int.MinValue }); + // + // iptEndIndex + // + iptEndIndex.Location = new Point(277, 3); + iptEndIndex.Maximum = new decimal(new int[] { 99999999, 0, 0, 0 }); + iptEndIndex.Minimum = new decimal(new int[] { 2, 0, 0, int.MinValue }); + iptEndIndex.Name = "iptEndIndex"; + iptEndIndex.Size = new Size(129, 39); + iptEndIndex.TabIndex = 38; + iptEndIndex.Text = "-1"; + iptEndIndex.Value = new decimal(new int[] { 1, 0, 0, int.MinValue }); + // // MotionEdit // AutoScaleDimensions = new SizeF(7F, 17F); @@ -374,11 +373,9 @@ private AntdUI.Select sltDataType; private AntdUI.Label label3; private AntdUI.StackPanel stackPanel3; - private AntdUI.Input iptEndIndex; private AntdUI.Select sltEnd; private AntdUI.Label label6; private AntdUI.StackPanel stackPanel2; - private AntdUI.Input iptStartIndex; private AntdUI.Select sltStart; private AntdUI.Label label5; private AntdUI.Select sltBoolValue; @@ -388,5 +385,7 @@ private AntdUI.Label label4; private AntdUI.Input iptAddress; private AntdUI.Label label7; + private AntdUI.InputNumber iptStartIndex; + private AntdUI.InputNumber iptEndIndex; } } diff --git a/DHSoftware/Views/MotionEdit.cs b/DHSoftware/Views/MotionEdit.cs index 89bdb36..1997406 100644 --- a/DHSoftware/Views/MotionEdit.cs +++ b/DHSoftware/Views/MotionEdit.cs @@ -73,9 +73,9 @@ namespace DHSoftware.Views plcItem.Value = sltDataType.SelectedIndex == 2 ? sltBoolValue.Text : iptValue.Text; plcItem.NumTpye = sltDataType.SelectedIndex == 2 ? string.Empty : sltIntType.Text; plcItem.StartExecute = sltStart.Text == "执行" ? true : false; - plcItem.StartIndex = sltStart.Text == "执行" ? Convert.ToInt32(iptStartIndex.Text) : -1; + plcItem.StartIndex = sltStart.Text == "执行" ? Convert.ToInt32(iptStartIndex.Value) : -1; plcItem.EndExecute = sltEnd.Text == "执行" ? true : false; - plcItem.EndIndex = sltEnd.Text == "执行" ? Convert.ToInt32(iptEndIndex.Text) : -1; + plcItem.EndIndex = sltEnd.Text == "执行" ? Convert.ToInt32(iptEndIndex.Value) : -1; submit = true; this.Dispose(); @@ -113,8 +113,8 @@ namespace DHSoftware.Views sltIntType.SelectedValue = sltDataType.SelectedIndex == 2 ? string.Empty : plcItem.NumTpye; sltStart.SelectedValue = plcItem.StartExecute == true ? "执行" : "取消"; sltEnd.SelectedValue = plcItem.EndExecute == true ? "执行" : "取消"; - iptStartIndex.Text = plcItem.StartExecute == true ? plcItem.StartIndex.ToString() : "-1"; - iptEndIndex.Text = plcItem.EndExecute == true ? plcItem.EndIndex.ToString() : "-1"; + iptStartIndex.Value = plcItem.StartExecute == true ? plcItem.StartIndex : -1; + iptEndIndex.Value = plcItem.EndExecute == true ? plcItem.EndIndex : -1; } diff --git a/DHSoftware/Views/MotionEdit.resx b/DHSoftware/Views/MotionEdit.resx index 8b2ff64..af32865 100644 --- a/DHSoftware/Views/MotionEdit.resx +++ b/DHSoftware/Views/MotionEdit.resx @@ -1,7 +1,7 @@