Exemplo n.º 1
0
        // control event handle
        private void OnEvent(object sender, MouseButtonEventArgs e)
        {
            if (!isConnectted)
            {
                return;
            }

            UInt64 cmdIndex = 0;
            Button obj      = (Button)sender;
            String con      = obj.Content.ToString();

            switch (con)
            {
            case "X+":
            case "Joint1+":
            {
                currentCmd.isJoint = isJoint;
                currentCmd.cmd     = e.ButtonState == MouseButtonState.Pressed ? (byte)JogCmdType.JogAPPressed : (byte)JogCmdType.JogIdle;
                DobotDll.SetJOGCmd(ref currentCmd, false, ref cmdIndex);
            }
            break;

            case "X-":
            case "Joint1-":
            {
                currentCmd.isJoint = isJoint;
                currentCmd.cmd     = e.ButtonState == MouseButtonState.Pressed ? (byte)JogCmdType.JogANPressed : (byte)JogCmdType.JogIdle;
                DobotDll.SetJOGCmd(ref currentCmd, false, ref cmdIndex);
            }
            break;

            case "Y+":
            case "Joint2+":
            {
                currentCmd.isJoint = isJoint;
                currentCmd.cmd     = e.ButtonState == MouseButtonState.Pressed ? (byte)JogCmdType.JogBPPressed : (byte)JogCmdType.JogIdle;
                DobotDll.SetJOGCmd(ref currentCmd, false, ref cmdIndex);
            }
            break;

            case "Y-":
            case "Joint2-":
            {
                currentCmd.isJoint = isJoint;
                currentCmd.cmd     = e.ButtonState == MouseButtonState.Pressed ? (byte)JogCmdType.JogBNPressed : (byte)JogCmdType.JogIdle;
                DobotDll.SetJOGCmd(ref currentCmd, false, ref cmdIndex);
            }
            break;

            case "Z+":
            case "Joint3+":
            {
                currentCmd.isJoint = isJoint;
                currentCmd.cmd     = e.ButtonState == MouseButtonState.Pressed ? (byte)JogCmdType.JogCPPressed : (byte)JogCmdType.JogIdle;
                DobotDll.SetJOGCmd(ref currentCmd, false, ref cmdIndex);
            }
            break;

            case "Z-":
            case "Joint3-":
            {
                currentCmd.isJoint = isJoint;
                currentCmd.cmd     = e.ButtonState == MouseButtonState.Pressed ? (byte)JogCmdType.JogCNPressed : (byte)JogCmdType.JogIdle;
                DobotDll.SetJOGCmd(ref currentCmd, false, ref cmdIndex);
            }
            break;

            case "R+":
            case "Joint4+":
            {
                currentCmd.isJoint = isJoint;
                currentCmd.cmd     = e.ButtonState == MouseButtonState.Pressed ? (byte)JogCmdType.JogDPPressed : (byte)JogCmdType.JogIdle;
                DobotDll.SetJOGCmd(ref currentCmd, false, ref cmdIndex);
            }
            break;

            case "R-":
            case "Joint4-":
            {
                currentCmd.isJoint = isJoint;
                currentCmd.cmd     = e.ButtonState == MouseButtonState.Pressed ? (byte)JogCmdType.JogDNPressed : (byte)JogCmdType.JogIdle;
                DobotDll.SetJOGCmd(ref currentCmd, false, ref cmdIndex);
            }
            break;

            case "Gripper+":
            {
            }
            break;

            case "Gripper-":
            {
            }
            break;

            default:
                break;
            }
        }