示例#1
0
        private void buttonJumpPos_Click(object sender, EventArgs e)
        {
            if (string.IsNullOrEmpty(comboBoxTestPos.Text) || !comboBoxTestPos.Text.Contains("-"))
            {
                MessageBox.Show("JUMP移动异常:点位名称异常");
                return;
            }

            var pos = comboBoxTestPos.Text.Split('-')[1];

            if (_platform.Positions.Exists(p => p.Name == pos))
            {
                try
                {
                    var lastpos = _platform.Positions.First(p => p.Name == pos);

                    var jh = double.Parse(comboBoxJumpHeight.Text);

                    var moveForm = new PlatformMoveForm()
                    {
                        Platform   = _platform,
                        ObjPos     = _platform.Positions.First(p => p.Name == pos),
                        MoveMode   = "Jump",
                        JumpHeight = (int)jh,

                        StartPosition = FormStartPosition.CenterParent,
                    };
                    moveForm.ShowDialog();

                    return;
                    //
                    //if (MessageBox.Show($"JUMP移动到 {pos} {lastpos} 缩回高度 {jh:F2}?",
                    //        "JUMP移动", MessageBoxButtons.YesNo) == DialogResult.No)
                    //{
                    //    return;
                    //}

                    //var ret = _platform.ExitAuto().Jump(pos, double.Parse(comboBoxJumpHeight.Text));
                    //if (!ret)
                    //{
                    //    MessageBox.Show($"JUMP移动异常");
                    //}
                }
                catch (Exception ex)
                {
                    MessageBox.Show($"JUMP移动异常:{ex.Message}");
                }
            }
        }
示例#2
0
        private void buttonMovePos_Click(object sender, EventArgs e)
        {
            if (string.IsNullOrEmpty(comboBoxTestPos.Text) || !comboBoxTestPos.Text.Contains("-"))
            {
                MessageBox.Show("绝对运动 点位名称异常");
                return;
            }


            var pos = comboBoxTestPos.Text.Split('-')[1];

            if (_platform.Positions.Exists(p => p.Name == pos))
            {
                var moveForm = new PlatformMoveForm()
                {
                    Platform   = _platform,
                    ObjPos     = _platform.Positions.First(p => p.Name == pos),
                    MoveMode   = "MoveP",
                    JumpHeight = 0,

                    StartPosition = FormStartPosition.CenterParent,
                };
                moveForm.ShowDialog();

                //
                return;
                //try
                //{
                //    var lastpos = _platform.Positions.First(p => p.Name == pos);
                //    if (MessageBox.Show($"移动到 {pos} {lastpos}?",
                //            "绝对运动", MessageBoxButtons.YesNo) == DialogResult.No)
                //    {
                //        return;
                //    }

                //    var ret = _platform.ExitAuto().MoveAbs(pos);
                //    if (!ret)
                //    {
                //        MessageBox.Show($"绝对运动异常");
                //    }
                //}
                //catch (Exception ex)
                //{
                //    MessageBox.Show($"绝对运动异常:{ex.Message}");
                //}
            }
        }