领胜LDS 键盘AOI检测项目
wells.liu
2020-07-06 b016e35f170a6e1a98d39f125762f97af677fd20
src/Bro.UI.Device.Winform/MotionCard/CtrlMotionCardAxisOperation.cs
@@ -7,6 +7,10 @@
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
{
@@ -17,11 +21,68 @@
            InitializeComponent();
        }
        public CtrlMotionCardAxisOperation(int axisIndex,string axisName)
        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_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)
        {
            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 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.StateChange(DeviceState.DSPause);
        }
    }
}