领胜LDS 键盘AOI检测项目
wells.liu
2020-07-09 f1a4349ec1420828a02e2fd28b02afb8519c1929
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Drawing;
using System.Data;
using System.Linq;
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
{
    public partial class CtrlMotionCardAxisOperation : UserControl
    {
        public CtrlMotionCardAxisOperation()
        {
            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);
        }
    }
}