Пример #1
0
        private void UpdatePoseInfo(bool allServo)
        {
            UpdateInfo();

            data.PoseInfo pi = ucActionDetail.GetSelectedPose();
            if (pi == null)
            {
                UpdateInfo("没有选定姿势", MyUtil.UTIL.InfoType.alert);
                return;
            }

            bool lastPose = ucActionDetail.LastSelected;

            pi.enabled = true;
            byte headLed;

            if (rbHeadLedTurnOn.IsChecked == true)
            {
                headLed = CONST.LED.TURN_ON;
            }
            else if (rbHeadLedTurnOff.IsChecked == true)
            {
                headLed = CONST.LED.TURN_OFF;
            }
            else
            {
                headLed = CONST.LED.NO_CHANGE;
            }

            byte mp3Folder, mp3File, mp3Vol;

            if (cbxStopMp3.IsChecked == true)
            {
                mp3Folder = 0xFF;
                mp3File   = 0xFF;
                mp3Vol    = CONST.AI.STOP_MUSIC_VOL; // Special code for mp3Vol = 0xFE -> Stop play
            }
            else
            {
                if (!getMp3Folder(out mp3Folder))
                {
                    return;
                }
                if (!getMp3File(out mp3File, true))
                {
                    return;
                }
                if (!getMp3Vol(out mp3Vol))
                {
                    return;
                }
            }

            if (!getActionTime(out UInt16 servoTime, out UInt16 waitTime))
            {
                return;
            }

            if (UBT.UpdatePose(pi.actionId, pi.poseId, servo, allServo, headLed, mp3Folder, mp3File, mp3Vol, servoTime, waitTime))
            {
                UBT.actionTable.action[pi.actionId].CheckPoses();
                ucActionList.Refresh();
                ucActionDetail.Refresh();
                if (lastPose)
                {
                    ActoinList_InsertPose(InsertMode.END);
                }
            }
        }