Esempio n. 1
0
        public void videoCompletedEvent(object sender, EventArgs args)
        {
            ConsoleLogger.logMessage("In videoCompletedEvent");
            if (mRecordingStarted) // Need to send this command early as dispose takes some time
            {
                mWiimotes.addInformationToRecording(END_VIDEO_CODE);
            }

            mVideoPlayer.dispose();

            if (mRecordingStarted)
            {
                mWiimotes.stopRecording();
                mRecordingStarted = false;

                IWiimoteReferenceRecord lScoringReferenceRecord = mCurrentTrainingSegment.getScoringReferenceRecord();

                if (!mCurrentTrainingSegment.TrainingPlayRecord.isRecordingValid())
                {
                    MessageBox.Show("Tap Rapper : There is an issue in recording\r\nPlease check your Wiimote connection",
                                    "Tap Rapper Says", MessageBoxButtons.OK,
                                    MessageBoxIcon.Error);
                    mOutputParent.SetScoreFeedback("Error in Wiimote Recording", 0);
                    return;
                }

                mWiimotes.comparePlayToReference(mCurrentTrainingSegment.TrainingPlayRecord);

                int lNumStars = mCurrentTrainingSegment.TrainingPlayRecord.NumberOfStars;
                if (lNumStars == 1)
                {
                    lNumStars = 2;
                }

                StringBuilder lFeedbackMessage = new StringBuilder();

                switch (lNumStars)
                {
                case 1: lFeedbackMessage.Append(ProjectConstants.TRAINING_FEEDBACK_FOR_ONE_STAR);
                    break;

                case 2: lFeedbackMessage.Append(ProjectConstants.TRAINING_FEEDBACK_FOR_TWO_STARS);
                    break;

                case 3: lFeedbackMessage.Append(ProjectConstants.TRAINING_FEEDBACK_FOR_THREE_STARS);
                    break;

                case 4: lFeedbackMessage.Append(ProjectConstants.TRAINING_FEEDBACK_FOR_FOUR_STARS);
                    break;

                case 5: lFeedbackMessage.Append(ProjectConstants.TRAINING_FEEDBACK_FOR_FIVE_STARS);
                    break;

                default:
                    break;
                }

                mVideoPlayer.addInformation(lScoringReferenceRecord.RecordName, lNumStars);
                mOutputParent.SetScoreFeedback(lFeedbackMessage.ToString(), lNumStars);
            }

            setCurrentPlay();
        }
Esempio n. 2
0
        public void videoCompletedEvent(object sender, EventArgs args)
        {
            ConsoleLogger.logMessage("In videoCompletedEvent");

            mVideoPlayer.dispose();
            if (mRecordingStarted)
            {
                mWiimotes.stopRecording();
                mRecordingStarted = false;

                mWiimotes.comparePlayToReference(mCurrentTrainingSegment.TrainingPlayRecord);

                int lNumStars = mCurrentTrainingSegment.TrainingPlayRecord.NumberOfStars;
                if (lNumStars == 1)
                {
                    lNumStars = 2;
                }

                StringBuilder lFeedbackMessage = new StringBuilder();

//                for (int lIndex = 0; lIndex < lNumStars; lIndex++)
//                    lFeedbackMessage.Append("*  ");
//                lFeedbackMessage.Append("   :   ");

                switch (lNumStars)
                {
                case 1: lFeedbackMessage.Append(ProjectConstants.TRAINING_FEEDBACK_FOR_ONE_STAR);
                    break;

                case 2: lFeedbackMessage.Append(ProjectConstants.TRAINING_FEEDBACK_FOR_TWO_STARS);
                    break;

                case 3: lFeedbackMessage.Append(ProjectConstants.TRAINING_FEEDBACK_FOR_THREE_STARS);
                    break;

                case 4: lFeedbackMessage.Append(ProjectConstants.TRAINING_FEEDBACK_FOR_FOUR_STARS);
                    break;

                case 5: lFeedbackMessage.Append(ProjectConstants.TRAINING_FEEDBACK_FOR_FIVE_STARS);
                    break;

                default:
                    break;
                }

                mVideoPlayer.addInformation(mCurrentTrainingSegment.TrainingReferenceRecord.RecordName, lNumStars);
                SetScoreFeedback(lFeedbackMessage.ToString(), lNumStars);
            }

            if (mCurrentVideoIndex == mVideoInfoList.Count - 1)
            {
                //Last Video done
                return;
            }

            mCurrentVideoIndex++;

            if (mCurrentTrainingSegment.TrainingReferenceRecord.NextVideoPlay.CompareTo(ProjectConstants.TRAINING_AUTOMATIC_NEXT_VIDEO_PLAY) == 0)
            {
                ClickContinueButton();
            }
            else if (mCurrentVideoIndex == mVideoInfoList.Count - 1 || mCurrentTrainingSegment.TrainingReferenceRecord.NextVideoPlay.CompareTo(ProjectConstants.TRAINING_LAST_VIDEO_PLAY) == 0)
            {
                //Code for end
            }

            SetCurentPlayName();
        }