From 799808db1ace43141760a1fe74b2cbf28ddb2e39 Mon Sep 17 00:00:00 2001 From: wells <123> Date: 星期五, 10 七月 2020 18:41:25 +0800 Subject: [PATCH] 合并 --- src/Bro.UI.Device.Winform/MotionCard/CtrlMotionCardAxisOperation.cs | 90 ++++++++++++++++++++++++++++++++++++++++++++ 1 files changed, 89 insertions(+), 1 deletions(-) diff --git a/src/Bro.UI.Device.Winform/MotionCard/CtrlMotionCardAxisOperation.cs b/src/Bro.UI.Device.Winform/MotionCard/CtrlMotionCardAxisOperation.cs index f429d01..f6ab955 100644 --- a/src/Bro.UI.Device.Winform/MotionCard/CtrlMotionCardAxisOperation.cs +++ b/src/Bro.UI.Device.Winform/MotionCard/CtrlMotionCardAxisOperation.cs @@ -7,8 +7,12 @@ using System.Text; using System.Threading.Tasks; using System.Windows.Forms; +using Bro.Common.Interface; +using Bro.Common.Base; +using Bro.Common.Model; +using static Bro.Common.Helper.EnumHelper; -namespace Bro.UI.Device.Winform.MotionCard +namespace Bro.UI.Device.Winform { public partial class CtrlMotionCardAxisOperation : UserControl { @@ -17,5 +21,89 @@ InitializeComponent(); } + private IDevice Device { get; set; } + private int _axisIndex { get; set; } + + protected MotionCardBase MotionCard + { + get => Device as MotionCardBase; + } + + public CtrlMotionCardAxisOperation(IDevice device, int axisIndex, string axisName) + { + InitializeComponent(); + Device = device; + _axisIndex = axisIndex; + groupBoxAxisOperration.Text = $"杩愬姩杞达細{axisIndex}-{axisName}"; + } + + + private void buttonPositive_MouseDown(object sender, MouseEventArgs 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_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, MouseEventArgs 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(); + MovingOption movingOption = new MovingOption(); + movingOption.AxisIndex = _axisIndex; + movingOption.Destination = Convert.ToInt32(textBoxP2PPrfPosition.Text); + movingOption.MoveMode = MotionMode.Normal; + movingOption.VelocityPara.Acc = Convert.ToDouble(textBoxP2PAcc.Text); + movingOption.VelocityPara.Dec = Convert.ToDouble(textBoxP2PDec.Text); + movingOption.VelocityPara.Velocity = Convert.ToDouble(textBoxP2PVel.Text); + + opConfig.MovingOps.Add(movingOption); + MotionCard.MoveToPoint(opConfig); + } + + private void buttonStop_Click(object sender, EventArgs e) + { + MotionCard.MoveStop(_axisIndex, 0); + } } } -- Gitblit v1.8.0