Пример #1
0
        public static void HandTraining_GestureRecognized(object sender, EventArgs e)
        {
            string curItem  = ((VideosList)TrainingWithAvatarView.Get().VideosList.SelectedItem).Name;
            bool   complete = ((HandTraining)sender).Complete;
            bool   slow     = ((HandTraining)sender).Slow;
            int    count    = ((HandTraining)sender).Count;

            //test audio

            /*
             * switch (count)
             * {
             *  case 1:
             *      TrainingWithAvatarViewModel.Get().PlayWAVFile("intro.wav");
             *      break;
             *  case 2:
             *      TrainingWithAvatarViewModel.Get().PlayWAVFile("Two.wav");
             *      break;
             *  case 3:
             *      TrainingWithAvatarViewModel.Get().PlayWAVFile("Three.wav");
             *      break;
             * }
             */

            if (complete)
            {
                string newPathFile = Path.Combine(Path.GetDirectoryName(TrainingWithAvatarViewModel.Get().PathFile), curItem + "_Good_Job.skd");
                TrainingWithAvatarViewModel.Get().PathFile = newPathFile;
            }
            else if (slow)
            {
                string newPathFile = Path.Combine(Path.GetDirectoryName(TrainingWithAvatarViewModel.Get().PathFile), curItem + "_Too_Slow.skd");
                TrainingWithAvatarViewModel.Get().PathFile = newPathFile;
            }
        }
Пример #2
0
        public static void HypeTraining_GestureRecognized(object sender, EventArgs e)
        {
            string curItem  = ((VideosList)TrainingWithAvatarView.Get().VideosList.SelectedItem).Name;
            bool   complete = ((HypeTraining)sender).Complete;
            bool   spread   = ((HypeTraining)sender).Spread;
            bool   stretch  = ((HypeTraining)sender).Stretch;
            bool   up       = ((HypeTraining)sender).Up;

            if (complete)
            {
                string newPathFile = Path.Combine(Path.GetDirectoryName(TrainingWithAvatarViewModel.Get().PathFile), curItem + "_Good_Job.skd");
                TrainingWithAvatarViewModel.Get().PathFile = newPathFile;
            }
            else if (spread)
            {
                string newPathFile = Path.Combine(Path.GetDirectoryName(TrainingWithAvatarViewModel.Get().PathFile), curItem + "_Spread_your_arms.skd");
                TrainingWithAvatarViewModel.Get().PathFile = newPathFile;
            }
            else if (stretch)
            {
                string newPathFile = Path.Combine(Path.GetDirectoryName(TrainingWithAvatarViewModel.Get().PathFile), curItem + "_Stretch_your_arms.skd");
                TrainingWithAvatarViewModel.Get().PathFile = newPathFile;
            }
            else if (up)
            {
                string newPathFile = Path.Combine(Path.GetDirectoryName(TrainingWithAvatarViewModel.Get().PathFile), curItem + "_Raise_your_arms.skd");
                TrainingWithAvatarViewModel.Get().PathFile = newPathFile;
            }
        }
Пример #3
0
        /// <summary>
        /// Create the video dictionary with readable files
        /// Load all the movement into the software
        /// </summary>
        public void initializeVideosMap()
        {
            bool enable = KinectDevice.faceTracking;

            //Contains the names of the movements and the paths to the folders
            videosMap      = new Dictionary <string, string>();
            videosNameList = new List <VideosList>();

            if (Directory.Exists(folderPath))
            {
                string[] folderName = Directory.GetDirectories(folderPath);
                for (int i = 0; i < folderName.Length; i++)
                {
                    string name = Path.GetFileName(folderName[i]);
                    videosMap.Add(name, folderName[i]);

                    string tmp          = folderPath + name + "/" + name + ".xml";
                    bool   isSelectable = (!File.Exists(tmp) || File.Exists(tmp) && enable) ? true : false;
                    string color        = isSelectable ? "WhiteSmoke" : "Gray";
                    VideosNameList.Add(new VideosList {
                        Name = name, IsSelectable = isSelectable, Color = color
                    });
                }

                twav.VideosList.ItemsSource = VideosNameList;
            }

            textFaceTrackingDisable = enable ? String.Empty : "To have acces to all trainings, please activate the face tracking.";
            TrainingWithAvatarView.Get().FaceTrackingDisable.Text = textFaceTrackingDisable;

            if (!enable)
            {
                TrainingWithAvatarView.Get().FaceTrackingDisable.MouseLeftButtonDown += new MouseButtonEventHandler(FaceTrackingDisable_MouseLeftButtonDown);
            }
        }
Пример #4
0
        public static void PowerTraining_GestureRecognized(object sender, EventArgs e)
        {
            string curItem  = ((VideosList)TrainingWithAvatarView.Get().VideosList.SelectedItem).Name;
            double distance = ((PowerTraining)sender).Distance;

            if (distance > 0.01)
            {
                string newPathFile = Path.Combine(Path.GetDirectoryName(TrainingWithAvatarViewModel.Get().PathFile), curItem + "_Good_Job.skd");
                TrainingWithAvatarViewModel.Get().PathFile = newPathFile;
            }
            else
            {
                string newPathFile = Path.Combine(Path.GetDirectoryName(TrainingWithAvatarViewModel.Get().PathFile), curItem + "_Lean_Back.skd");
                TrainingWithAvatarViewModel.Get().PathFile = newPathFile;
            }
        }
Пример #5
0
        private TrainingWithAvatarViewModel()
        {
            instance = this;

            folderPath = "../../Training/";

            twav = TrainingWithAvatarView.Get();
            initialize();

            instance = this;

            _gesture.GestureRecognized        += Gesture_GestureRecognized;
            _handgesture.GestureRecognized    += HandTraining_GestureRecognized;
            _powergesture.GestureRecognized   += PowerTraining_GestureRecognized;
            _welcomegesture.GestureRecognized += WelcomeTraining_GestureRecognized;
            _salutegesture.GestureRecognized  += SaluteTraining_GestureRecognized;
            _hypegesture.GestureRecognized    += HypeTraining_GestureRecognized;
            _facegesture.GestureRecognized    += FaceTraining_GestureRecognized;
        }
Пример #6
0
        public static void SaluteTraining_GestureRecognized(object sender, EventArgs e)
        {
            string curItem   = ((VideosList)TrainingWithAvatarView.Get().VideosList.SelectedItem).Name;
            bool   complete  = ((SaluteTraining)sender).Complete;
            bool   slow      = ((SaluteTraining)sender).Slow;
            bool   stay      = ((SaluteTraining)sender).Stay;
            bool   angle     = ((SaluteTraining)sender).AngleB;
            bool   alignment = ((SaluteTraining)sender).Alignment;
            bool   hand      = ((SaluteTraining)sender).LeftHand;

            if (complete)
            {
                string newPathFile = Path.Combine(Path.GetDirectoryName(TrainingWithAvatarViewModel.Get().PathFile), curItem + "_Good_Job.skd");
                TrainingWithAvatarViewModel.Get().PathFile = newPathFile;
            }
            else if (slow)
            {
                string newPathFile = Path.Combine(Path.GetDirectoryName(TrainingWithAvatarViewModel.Get().PathFile), curItem + "_Too_Slow.skd");
                TrainingWithAvatarViewModel.Get().PathFile = newPathFile;
            }
            else if (hand)
            {
                string newPathFile = Path.Combine(Path.GetDirectoryName(TrainingWithAvatarViewModel.Get().PathFile), curItem + "_Keep_your_left_hand_close_to_the_hip.skd");
                TrainingWithAvatarViewModel.Get().PathFile = newPathFile;
            }
            else if (stay)
            {
                string newPathFile = Path.Combine(Path.GetDirectoryName(TrainingWithAvatarViewModel.Get().PathFile), curItem + "_Stay_2_seconds.skd");
                TrainingWithAvatarViewModel.Get().PathFile = newPathFile;
            }
            else if (angle)
            {
                string newPathFile = Path.Combine(Path.GetDirectoryName(TrainingWithAvatarViewModel.Get().PathFile), curItem + "_The_arm_angle_must_be_45_degrees.skd");
                TrainingWithAvatarViewModel.Get().PathFile = newPathFile;
            }
            else if (alignment)
            {
                string newPathFile = Path.Combine(Path.GetDirectoryName(TrainingWithAvatarViewModel.Get().PathFile), curItem + "_The_arm_must_be_aligned_with_the_shoulders.skd");
                TrainingWithAvatarViewModel.Get().PathFile = newPathFile;
            }
        }
Пример #7
0
        //When the waving gesture is recognized, we determine what file should be played to respond to the user
        public static void Gesture_GestureRecognized(object sender, EventArgs e)
        {
            string curItem = ((VideosList)TrainingWithAvatarView.Get().VideosList.SelectedItem).Name;
            int    nbFrame = ((WaveGesture)sender).FrameGesture;

            if (nbFrame > 40 && nbFrame < 60)
            {
                string newPathFile = Path.Combine(Path.GetDirectoryName(TrainingWithAvatarViewModel.Get().PathFile), curItem + "_Good_Job.skd");
                TrainingWithAvatarViewModel.Get().PathFile = newPathFile;
            }
            else if (nbFrame > 60)
            {
                string newPathFile = Path.Combine(Path.GetDirectoryName(TrainingWithAvatarViewModel.Get().PathFile), curItem + "_Do_It_Quicker.skd");
                TrainingWithAvatarViewModel.Get().PathFile = newPathFile;
            }
            else if (nbFrame < 40)
            {
                string newPathFile = Path.Combine(Path.GetDirectoryName(TrainingWithAvatarViewModel.Get().PathFile), curItem + "_Do_It_Slower.skd");
                TrainingWithAvatarViewModel.Get().PathFile = newPathFile;
            }
        }
Пример #8
0
        public static void FaceTraining_GestureRecognized(object sender, EventArgs e)
        {
            string curItem    = ((VideosList)TrainingWithAvatarView.Get().VideosList.SelectedItem).Name;
            bool   complete   = ((FaceTraining)sender).Complete;
            bool   lookingDir = ((FaceTraining)sender).LookingDir;
            bool   up         = ((FaceTraining)sender).Up;

            if (complete)
            {
                TrainingWithAvatarViewModel.Get().PathFile = Path.Combine(Path.GetDirectoryName(TrainingWithAvatarViewModel.Get().PathFile), curItem + "_Good_Job.skd");
                TrainingWithAvatarViewModel.Get().SkeletonListUpdateInter(curItem);
            }
            else if (lookingDir)
            {
                TrainingWithAvatarViewModel.Get().PathFile = Path.Combine(Path.GetDirectoryName(TrainingWithAvatarViewModel.Get().PathFile), curItem + "_Look_in_the_direction_of_the_arm.skd");
                TrainingWithAvatarViewModel.Get().SkeletonListUpdateInter(curItem);
            }
            else if (up)
            {
                TrainingWithAvatarViewModel.Get().PathFile = Path.Combine(Path.GetDirectoryName(TrainingWithAvatarViewModel.Get().PathFile), curItem + "_Raise_your_arm_above_your_shoulder.skd");
                TrainingWithAvatarViewModel.Get().SkeletonListUpdateInter(curItem);
            }
        }
Пример #9
0
        public static void WelcomeTraining_GestureRecognized(object sender, EventArgs e)
        {
            string curItem  = ((VideosList)TrainingWithAvatarView.Get().VideosList.SelectedItem).Name;
            bool   complete = ((WelcomeTraining)sender).Complete;
            bool   slow     = ((WelcomeTraining)sender).Slow;
            bool   dropped  = ((WelcomeTraining)sender).Dropped;

            if (complete)
            {
                string newPathFile = Path.Combine(Path.GetDirectoryName(TrainingWithAvatarViewModel.Get().PathFile), curItem + "_Good_Job.skd");
                TrainingWithAvatarViewModel.Get().PathFile = newPathFile;
            }
            else if (slow)
            {
                string newPathFile = Path.Combine(Path.GetDirectoryName(TrainingWithAvatarViewModel.Get().PathFile), curItem + "_Too_Slow.skd");
                TrainingWithAvatarViewModel.Get().PathFile = newPathFile;
            }
            else if (dropped)
            {
                string newPathFile = Path.Combine(Path.GetDirectoryName(TrainingWithAvatarViewModel.Get().PathFile), curItem + "_Raise_your_elbows.skd");
                TrainingWithAvatarViewModel.Get().PathFile = newPathFile;
            }
        }