From 1b2ce8e8b743f052d4325c78cba494342e523478 Mon Sep 17 00:00:00 2001
From: wells.liu <wells.liu@broconcentric.com>
Date: 星期四, 09 七月 2020 18:49:40 +0800
Subject: [PATCH] 板卡 操作及运行界面

---
 src/Bro.UI.Device.Winform/MotionCard/CtrlMotionCardIOStatus.resx            |    2 
 src/Bro.UI.Device.Winform/MotionCard/CtrlMotionCardAxisStatus.Designer.cs   |   10 ++-
 src/Bro.UI.Device.Winform/MotionCard/CtrlMotionCardIOStatus.Designer.cs     |   12 ++--
 src/Bro.UI.Device.Winform/MotionCard/CtrlMotionCardAxisOperation.cs         |   49 +++++++++++----
 src/Bro.UI.Device.Winform/MotionCard/CtrlMotionCardRunBase.cs               |   28 +++++---
 src/Bro.UI.Device.Winform/MotionCard/FrmMotionCardOperationBase.cs          |    2 
 src/Bro.UI.Device.Winform/MotionCard/CtrlMotionCardAxisStatus.resx          |    2 
 src/Bro.UI.Device.Winform/MotionCard/FrmMotionCardOperationBase.Designer.cs |   30 +++++-----
 8 files changed, 82 insertions(+), 53 deletions(-)

diff --git a/src/Bro.UI.Device.Winform/MotionCard/CtrlMotionCardAxisOperation.cs b/src/Bro.UI.Device.Winform/MotionCard/CtrlMotionCardAxisOperation.cs
index 488561c..fcc0e33 100644
--- a/src/Bro.UI.Device.Winform/MotionCard/CtrlMotionCardAxisOperation.cs
+++ b/src/Bro.UI.Device.Winform/MotionCard/CtrlMotionCardAxisOperation.cs
@@ -37,21 +37,8 @@
             groupBoxAxisOperration.Text = $"杩愬姩杞达細{axisIndex}-{axisName}";
         }
 
-        private void buttonPositive_Click(object sender, EventArgs e)
-        {
-            var opConfig = new MotionOperationCollection();
-            MovingOption movingOption = new MovingOption();
-            movingOption.AxisIndex = _axisIndex;
-            movingOption.MoveMode = MotionMode.Jog;
-            movingOption.VelocityPara.Acc = Convert.ToDouble(textBoxJogAcc.Text);
-            movingOption.VelocityPara.Dec = Convert.ToDouble(textBoxJogDec.Text);
-            movingOption.VelocityPara.Velocity= Convert.ToDouble(textBoxJogVel.Text);
 
-            opConfig.MovingOps.Add(movingOption);
-            MotionCard.MoveToPoint(opConfig);
-        }
-
-        private void buttonNegative_Click(object sender, EventArgs e)
+        private void buttonPositive_MouseDown(object sender, EventArgs e)
         {
             var opConfig = new MotionOperationCollection();
             MovingOption movingOption = new MovingOption();
@@ -65,6 +52,40 @@
             MotionCard.MoveToPoint(opConfig);
         }
 
+        private void buttonPositive_MouseUp(object sender, MouseEventArgs e)
+        {
+            MotionCard.MoveStop(_axisIndex, 0);
+        }
+
+        private void buttonNegative_MouseUp(object sender, MouseEventArgs e)
+        {
+            MotionCard.MoveStop(_axisIndex, 0);
+        }
+
+        private void buttonNegative_MouseDown(object sender, EventArgs e)
+        {
+            var opConfig = new MotionOperationCollection();
+            MovingOption movingOption = new MovingOption();
+            movingOption.AxisIndex = _axisIndex;
+            movingOption.MoveMode = MotionMode.Jog;
+            movingOption.VelocityPara.Acc = Convert.ToDouble(textBoxJogAcc.Text);
+            movingOption.VelocityPara.Dec = Convert.ToDouble(textBoxJogDec.Text);
+            movingOption.VelocityPara.Velocity = -Convert.ToDouble(textBoxJogVel.Text);
+
+            opConfig.MovingOps.Add(movingOption);
+            MotionCard.MoveToPoint(opConfig);
+        }
+
+        private void buttonPositive_Click(object sender, EventArgs e)
+        {
+
+        }
+
+        private void buttonNegative_Click(object sender, EventArgs e)
+        {
+
+        }
+
         private void buttonStart_Click(object sender, EventArgs e)
         {
             var opConfig = new MotionOperationCollection();
diff --git a/src/Bro.UI.Device.Winform/MotionCard/CtrlMotionCardAxisStatus.Designer.cs b/src/Bro.UI.Device.Winform/MotionCard/CtrlMotionCardAxisStatus.Designer.cs
index e35b793..b5ff08a 100644
--- a/src/Bro.UI.Device.Winform/MotionCard/CtrlMotionCardAxisStatus.Designer.cs
+++ b/src/Bro.UI.Device.Winform/MotionCard/CtrlMotionCardAxisStatus.Designer.cs
@@ -44,7 +44,7 @@
             this.label4 = new System.Windows.Forms.Label();
             this.label3 = new System.Windows.Forms.Label();
             this.label2 = new System.Windows.Forms.Label();
-            this.timer1 = new System.Windows.Forms.Timer(this.components);
+            this.timerAxisStatus = new System.Windows.Forms.Timer(this.components);
             this.groupBoxAxisStatus.SuspendLayout();
             this.SuspendLayout();
             // 
@@ -194,9 +194,11 @@
             this.label2.TabIndex = 2;
             this.label2.Text = "瑙勫垝浣嶇疆锛�";
             // 
-            // timer1
+            // timerAxisStatus
             // 
-            this.timer1.Tick += new System.EventHandler(this.RefreshStatus);
+            this.timerAxisStatus.Enabled = true;
+            this.timerAxisStatus.Interval = 200;
+            this.timerAxisStatus.Tick += new System.EventHandler(this.RefreshStatus);
             // 
             // CtrlMotionCardAxisStatus
             // 
@@ -228,6 +230,6 @@
         private System.Windows.Forms.Label label4;
         private System.Windows.Forms.Label label3;
         private System.Windows.Forms.Label label2;
-        private System.Windows.Forms.Timer timer1;
+        private System.Windows.Forms.Timer timerAxisStatus;
     }
 }
diff --git a/src/Bro.UI.Device.Winform/MotionCard/CtrlMotionCardAxisStatus.resx b/src/Bro.UI.Device.Winform/MotionCard/CtrlMotionCardAxisStatus.resx
index 1f666f2..83e9b35 100644
--- a/src/Bro.UI.Device.Winform/MotionCard/CtrlMotionCardAxisStatus.resx
+++ b/src/Bro.UI.Device.Winform/MotionCard/CtrlMotionCardAxisStatus.resx
@@ -117,7 +117,7 @@
   <resheader name="writer">
     <value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
   </resheader>
-  <metadata name="timer1.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
+  <metadata name="timerAxisStatus.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
     <value>17, 17</value>
   </metadata>
 </root>
\ No newline at end of file
diff --git a/src/Bro.UI.Device.Winform/MotionCard/CtrlMotionCardIOStatus.Designer.cs b/src/Bro.UI.Device.Winform/MotionCard/CtrlMotionCardIOStatus.Designer.cs
index f89c6b7..60a09b0 100644
--- a/src/Bro.UI.Device.Winform/MotionCard/CtrlMotionCardIOStatus.Designer.cs
+++ b/src/Bro.UI.Device.Winform/MotionCard/CtrlMotionCardIOStatus.Designer.cs
@@ -64,7 +64,7 @@
             this.ioIn6 = new Bro.UI.Model.Winform.IOIndicatorCtrl();
             this.ioIn5 = new Bro.UI.Model.Winform.IOIndicatorCtrl();
             this.ioIn1 = new Bro.UI.Model.Winform.IOIndicatorCtrl();
-            this.timer1 = new System.Windows.Forms.Timer(this.components);
+            this.timerIOStatus = new System.Windows.Forms.Timer(this.components);
             this.tableLayoutPanel1.SuspendLayout();
             this.groupBoxIOOut.SuspendLayout();
             this.groupBoxIOIn.SuspendLayout();
@@ -425,11 +425,11 @@
             this.ioIn1.Size = new System.Drawing.Size(90, 24);
             this.ioIn1.TabIndex = 4;
             // 
-            // timer1
+            // timerIOStatus
             // 
-            this.timer1.Enabled = true;
-            this.timer1.Interval = 200;
-            this.timer1.Tick += new System.EventHandler(this.RefreshIOStatus);
+            this.timerIOStatus.Enabled = true;
+            this.timerIOStatus.Interval = 200;
+            this.timerIOStatus.Tick += new System.EventHandler(this.RefreshIOStatus);
             // 
             // CtrlMotionCardIOStatus
             // 
@@ -482,6 +482,6 @@
         private Model.Winform.IOIndicatorCtrl ioOut6;
         private Model.Winform.IOIndicatorCtrl ioOut5;
         private Model.Winform.IOIndicatorCtrl ioOut1;
-        private System.Windows.Forms.Timer timer1;
+        private System.Windows.Forms.Timer timerIOStatus;
     }
 }
diff --git a/src/Bro.UI.Device.Winform/MotionCard/CtrlMotionCardIOStatus.resx b/src/Bro.UI.Device.Winform/MotionCard/CtrlMotionCardIOStatus.resx
index 1f666f2..2a16bac 100644
--- a/src/Bro.UI.Device.Winform/MotionCard/CtrlMotionCardIOStatus.resx
+++ b/src/Bro.UI.Device.Winform/MotionCard/CtrlMotionCardIOStatus.resx
@@ -117,7 +117,7 @@
   <resheader name="writer">
     <value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
   </resheader>
-  <metadata name="timer1.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
+  <metadata name="timerIOStatus.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
     <value>17, 17</value>
   </metadata>
 </root>
\ No newline at end of file
diff --git a/src/Bro.UI.Device.Winform/MotionCard/CtrlMotionCardRunBase.cs b/src/Bro.UI.Device.Winform/MotionCard/CtrlMotionCardRunBase.cs
index 1583630..23144a3 100644
--- a/src/Bro.UI.Device.Winform/MotionCard/CtrlMotionCardRunBase.cs
+++ b/src/Bro.UI.Device.Winform/MotionCard/CtrlMotionCardRunBase.cs
@@ -9,6 +9,7 @@
 using System.Windows.Forms;
 using Bro.Common.Interface;
 using Bro.Common.Base;
+using Bro.Common.Model;
 
 namespace Bro.UI.Device.Winform
 {
@@ -27,6 +28,13 @@
             InitialLayout();
         }
 
+        public IDevice Device { get; set; }
+
+        protected MotionCardBase MotionCard
+        {
+            get => Device as MotionCardBase;
+        }
+
         private void MotionCard_OnMonitorInvoke(DateTime arg1, string arg2, IDevice arg3, IMonitorSet arg4)
         {
             throw new NotImplementedException();
@@ -36,25 +44,23 @@
         {
             foreach (var axisConfig in MotionCard.IConfig.AxisSettings.FindAll(u => u.IsAxisEnabled))
             {
-                var axisMovingStatus = MotionCard.AxisMovingOptionValues.FirstOrDefault(u=>u.AxisIndex== axisConfig.AxisIndex);
-                if (axisMovingStatus!=null)
+                var axisMovingStatus = MotionCard.AxisMovingOptionValues.FirstOrDefault(u => u.AxisIndex == axisConfig.AxisIndex);
+                if (axisMovingStatus == null)
                 {
-                    CtrlMotionCardAxisStatus ctrlMotionCardAxisStatus = new CtrlMotionCardAxisStatus(axisMovingStatus);
-                    ctrlMotionCardAxisStatus.Dock = DockStyle.Fill;
-                    flowLayoutPanel1.Controls.Add(ctrlMotionCardAxisStatus);
+                    axisMovingStatus = new AxisMovingStatus();
                 }
+                CtrlMotionCardAxisStatus ctrlMotionCardAxisStatus = new CtrlMotionCardAxisStatus(axisMovingStatus);
+                //ctrlMotionCardAxisStatus.Dock = DockStyle.Fill;
+                flowLayoutPanel1.Controls.Add(ctrlMotionCardAxisStatus);
+
             }
 
-            CtrlMotionCardIOStatus ctrlMotionCardIOStatus = new CtrlMotionCardIOStatus();
+            CtrlMotionCardIOStatus ctrlMotionCardIOStatus = new CtrlMotionCardIOStatus(MotionCard.MonitorValues);
+            //ctrlMotionCardIOStatus.Dock = DockStyle.Fill;
             flowLayoutPanel2.Controls.Add(ctrlMotionCardIOStatus);
         }
 
-        public IDevice Device { get; set; }
 
-        protected MotionCardBase MotionCard
-        {
-            get => Device as MotionCardBase;
-        }
 
         private void buttonMotionCardOperation_Click(object sender, EventArgs e)
         {
diff --git a/src/Bro.UI.Device.Winform/MotionCard/FrmMotionCardOperationBase.Designer.cs b/src/Bro.UI.Device.Winform/MotionCard/FrmMotionCardOperationBase.Designer.cs
index ce4360e..d52b7a4 100644
--- a/src/Bro.UI.Device.Winform/MotionCard/FrmMotionCardOperationBase.Designer.cs
+++ b/src/Bro.UI.Device.Winform/MotionCard/FrmMotionCardOperationBase.Designer.cs
@@ -63,7 +63,7 @@
             this.tableLayoutPanel1.Name = "tableLayoutPanel1";
             this.tableLayoutPanel1.RowCount = 1;
             this.tableLayoutPanel1.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Percent, 100F));
-            this.tableLayoutPanel1.Size = new System.Drawing.Size(484, 681);
+            this.tableLayoutPanel1.Size = new System.Drawing.Size(574, 681);
             this.tableLayoutPanel1.TabIndex = 0;
             // 
             // tabControl1
@@ -74,7 +74,7 @@
             this.tabControl1.Location = new System.Drawing.Point(3, 3);
             this.tabControl1.Name = "tabControl1";
             this.tabControl1.SelectedIndex = 0;
-            this.tabControl1.Size = new System.Drawing.Size(478, 675);
+            this.tabControl1.Size = new System.Drawing.Size(568, 675);
             this.tabControl1.TabIndex = 12;
             // 
             // tabPage1
@@ -83,7 +83,7 @@
             this.tabPage1.Location = new System.Drawing.Point(4, 22);
             this.tabPage1.Name = "tabPage1";
             this.tabPage1.Padding = new System.Windows.Forms.Padding(3);
-            this.tabPage1.Size = new System.Drawing.Size(470, 649);
+            this.tabPage1.Size = new System.Drawing.Size(560, 649);
             this.tabPage1.TabIndex = 0;
             this.tabPage1.Text = "蹇嵎鎿嶄綔";
             this.tabPage1.UseVisualStyleBackColor = true;
@@ -93,7 +93,7 @@
             this.flowLayoutPanel1.Dock = System.Windows.Forms.DockStyle.Fill;
             this.flowLayoutPanel1.Location = new System.Drawing.Point(3, 3);
             this.flowLayoutPanel1.Name = "flowLayoutPanel1";
-            this.flowLayoutPanel1.Size = new System.Drawing.Size(464, 643);
+            this.flowLayoutPanel1.Size = new System.Drawing.Size(554, 643);
             this.flowLayoutPanel1.TabIndex = 0;
             // 
             // tabPage2
@@ -102,7 +102,7 @@
             this.tabPage2.Location = new System.Drawing.Point(4, 22);
             this.tabPage2.Name = "tabPage2";
             this.tabPage2.Padding = new System.Windows.Forms.Padding(3);
-            this.tabPage2.Size = new System.Drawing.Size(470, 649);
+            this.tabPage2.Size = new System.Drawing.Size(560, 649);
             this.tabPage2.TabIndex = 1;
             this.tabPage2.Text = "閫氱敤鎿嶄綔";
             this.tabPage2.UseVisualStyleBackColor = true;
@@ -119,7 +119,7 @@
             this.tableLayoutPanel3.RowCount = 2;
             this.tableLayoutPanel3.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Absolute, 120F));
             this.tableLayoutPanel3.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Percent, 100F));
-            this.tableLayoutPanel3.Size = new System.Drawing.Size(464, 643);
+            this.tableLayoutPanel3.Size = new System.Drawing.Size(554, 643);
             this.tableLayoutPanel3.TabIndex = 0;
             // 
             // groupBoxPara
@@ -128,7 +128,7 @@
             this.groupBoxPara.Dock = System.Windows.Forms.DockStyle.Fill;
             this.groupBoxPara.Location = new System.Drawing.Point(3, 123);
             this.groupBoxPara.Name = "groupBoxPara";
-            this.groupBoxPara.Size = new System.Drawing.Size(458, 517);
+            this.groupBoxPara.Size = new System.Drawing.Size(548, 517);
             this.groupBoxPara.TabIndex = 13;
             this.groupBoxPara.TabStop = false;
             this.groupBoxPara.Text = "鍙傛暟";
@@ -139,7 +139,7 @@
             this.propGrid.Location = new System.Drawing.Point(3, 17);
             this.propGrid.Margin = new System.Windows.Forms.Padding(2, 3, 2, 3);
             this.propGrid.Name = "propGrid";
-            this.propGrid.Size = new System.Drawing.Size(452, 497);
+            this.propGrid.Size = new System.Drawing.Size(542, 497);
             this.propGrid.TabIndex = 1;
             // 
             // groupBoxCommBtn
@@ -153,7 +153,7 @@
             this.groupBoxCommBtn.Dock = System.Windows.Forms.DockStyle.Fill;
             this.groupBoxCommBtn.Location = new System.Drawing.Point(3, 3);
             this.groupBoxCommBtn.Name = "groupBoxCommBtn";
-            this.groupBoxCommBtn.Size = new System.Drawing.Size(458, 114);
+            this.groupBoxCommBtn.Size = new System.Drawing.Size(548, 114);
             this.groupBoxCommBtn.TabIndex = 1;
             this.groupBoxCommBtn.TabStop = false;
             this.groupBoxCommBtn.Text = "鍏叡鎿嶄綔";
@@ -167,9 +167,9 @@
             this.btnStart.Font = new System.Drawing.Font("瀹嬩綋", 9F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
             this.btnStart.Image = ((System.Drawing.Image)(resources.GetObject("btnStart.Image")));
             this.btnStart.ImageAlign = System.Drawing.ContentAlignment.MiddleRight;
-            this.btnStart.Location = new System.Drawing.Point(309, 23);
+            this.btnStart.Location = new System.Drawing.Point(374, 23);
             this.btnStart.Name = "btnStart";
-            this.btnStart.Size = new System.Drawing.Size(143, 54);
+            this.btnStart.Size = new System.Drawing.Size(168, 54);
             this.btnStart.TabIndex = 5;
             this.btnStart.Text = "  鍚�  鍔�";
             this.btnStart.TextImageRelation = System.Windows.Forms.TextImageRelation.ImageBeforeText;
@@ -188,7 +188,7 @@
             // 
             // buttonEmergencyStop
             // 
-            this.buttonEmergencyStop.Location = new System.Drawing.Point(86, 56);
+            this.buttonEmergencyStop.Location = new System.Drawing.Point(108, 56);
             this.buttonEmergencyStop.Name = "buttonEmergencyStop";
             this.buttonEmergencyStop.Size = new System.Drawing.Size(70, 25);
             this.buttonEmergencyStop.TabIndex = 4;
@@ -198,7 +198,7 @@
             // 
             // buttonServoEnable
             // 
-            this.buttonServoEnable.Location = new System.Drawing.Point(86, 21);
+            this.buttonServoEnable.Location = new System.Drawing.Point(108, 21);
             this.buttonServoEnable.Name = "buttonServoEnable";
             this.buttonServoEnable.Size = new System.Drawing.Size(70, 25);
             this.buttonServoEnable.TabIndex = 4;
@@ -218,7 +218,7 @@
             // 
             // buttonPositionReset
             // 
-            this.buttonPositionReset.Location = new System.Drawing.Point(168, 21);
+            this.buttonPositionReset.Location = new System.Drawing.Point(213, 21);
             this.buttonPositionReset.Name = "buttonPositionReset";
             this.buttonPositionReset.Size = new System.Drawing.Size(70, 25);
             this.buttonPositionReset.TabIndex = 4;
@@ -230,7 +230,7 @@
             // 
             this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 12F);
             this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
-            this.ClientSize = new System.Drawing.Size(484, 681);
+            this.ClientSize = new System.Drawing.Size(574, 681);
             this.Controls.Add(this.tableLayoutPanel1);
             this.Name = "FrmMotionCardOperationBase";
             this.tableLayoutPanel1.ResumeLayout(false);
diff --git a/src/Bro.UI.Device.Winform/MotionCard/FrmMotionCardOperationBase.cs b/src/Bro.UI.Device.Winform/MotionCard/FrmMotionCardOperationBase.cs
index 6118331..7aa4294 100644
--- a/src/Bro.UI.Device.Winform/MotionCard/FrmMotionCardOperationBase.cs
+++ b/src/Bro.UI.Device.Winform/MotionCard/FrmMotionCardOperationBase.cs
@@ -40,7 +40,7 @@
             foreach (var axisConfig in MotionCard.IConfig.AxisSettings.FindAll(u => u.IsAxisEnabled))
             {
                 CtrlMotionCardAxisOperation axisOperation = new CtrlMotionCardAxisOperation(Device, axisConfig.AxisIndex, axisConfig.AxisName);
-                axisOperation.Dock = DockStyle.Fill;
+                //axisOperation.Dock = DockStyle.Fill;
                 flowLayoutPanel1.Controls.Add(axisOperation);
 
             }

--
Gitblit v1.8.0