示例#1
0
        ///<summary>
        ///Releasing the media elements when closing the replay window
        ///Switch to recording mode
        ///Written by Baptiste Germond
        ///</summary>
        private void quit()
        {
            isReplaying    = false;
            statisticsPath = "";
            if (skeletonScrolling != null)
            {
                skeletonScrolling.Stop();
                skeletonScrolling = null;
            }
            (TrainingSideTool.Get().FindResource("StopReplayButtonAction") as Storyboard).Begin();
            DrawingSheetView.Get().ReplayVideo.Close();
            DrawingSheetView.Get().ReplayVideo.Source = null;
            DrawingSheetView.Get().ReplayAudio.Close();
            DrawingSheetView.Get().ReplayAudio.Source = null;
            ReplayView.Get().SoundCheckbox.IsChecked = false;
            SideToolsViewModel.Get().enableTrackingAndTrainingTab();
            TrainingSideToolViewModel.Get().recordingMode();
            DrawingSheetAvatarViewModel.Get().normalMode();

            // reactivate the sensors
            KinectDevice.sensor.SkeletonStream.Enable();
            if (faceTrack)
            {
                KinectDevice.faceTracking = true;
            }
            TrackingSideToolViewModel.get().SpeedRate = speedRateActive;

            // reactivate the audience
            if (TrainingSideToolViewModel.audienceOn)
            {
                TrainingSideToolViewModel.audienceOn = false;
                GeneralSideTool.Get().AudienceControlCheckBox.IsChecked = true;
            }
        }
示例#2
0
 /// <summary>
 /// Manage the loading of the file the user choose
 /// Added by Baptiste Germond
 /// </summary>
 private void ManagePerformanceFiles()
 {
     if (File.Exists(filePath))
     {
         if (Path.GetFileName(filePath) == "stream.avi")
         {
             folderPath = filePath.Remove(filePath.Length - 10);
             DrawingSheetView.Get().ShowReplayVideoSheet();
             filePathVideoStream = filePath;
             activate(ReplayView.Get().Stream, GeneralSideTool.Get().Stream);
             DrawingSheetView.Get().ReplayVideo.Source = new Uri(filePathVideoStream, UriKind.Relative);
             skeletonScrolling = null;
             DrawingSheetView.Get().CanvasFeedback.Visibility = Visibility.Visible;
             tryAddOtherSources("stream.avi");
             isReplaying = true;
         }
         else if (Path.GetFileName(filePath) == "avatarSkeletonData.skd")
         {
             try
             {
                 folderPath = filePath.Remove(filePath.Length - 22);
                 skdRead    = true;
                 DrawingSheetView.Get().Show3DSheet();
                 filePathAvatar = filePath;
                 activate(ReplayView.Get().Avatar, GeneralSideTool.Get().Avatar);
                 voiceData = filePath.Replace("avatarSkeletonData.skd", "tonePeakData.xml");
                 if (!File.Exists(voiceData))
                 {
                     voiceData = "";
                 }
                 faceData = filePath.Replace("avatarSkeletonData.skd", "faceData.xml");
                 if (!File.Exists(faceData))
                 {
                     faceData = "";
                 }
                 skeletonScrolling = new ReplayAvatar(filePathAvatar, faceData, voiceData, this);
                 tryAddOtherSources("avatarSkeletonData.skd");
                 isReplaying = true;
             }
             catch (XmlLoadingException)
             {
                 throw;
             }
         }
         if (isReplaying)
         {
             ReplayView.Get().TitleReplay.Content = Path.GetFileName((Path.GetDirectoryName(filePath)));
         }
     }
 }
示例#3
0
        /// <summary>
        /// Update the skeleton list depending on the user movement
        /// </summary>
        /// <param name="curItem"></param>
        private void SkeletonListUpdateInter(String curItem)
        {
            string pathFace = pathFile.Replace("skd", "xml");

            if (File.Exists(pathFace))
            {
                SkeletonList = ReplayAvatar.LoadSkeletonsFromXML(pathFile, pathFace);
            }
            else
            {
                SkeletonList = ReplayAvatar.LoadSkeletonsFromXML(pathFile, "");
            }
            skeletonNumber = 0;
            faceNumber     = 0;
        }
示例#4
0
        /// <summary>
        /// Update the skeleton list with a new path.
        /// </summary>
        /// <param name="curItem"></param>
        private void SkeletonListUpdate(String curItem)
        {
            pathFile = videosMap[curItem] + "/" + curItem + ".skd";
            string pathFace = pathFile.Replace("skd", "xml");

            if (File.Exists(pathFace))
            {
                SkeletonList = ReplayAvatar.LoadSkeletonsFromXML(pathFile, pathFace);
            }
            else
            {
                SkeletonList = ReplayAvatar.LoadSkeletonsFromXML(pathFile, "");
            }
            skeletonNumber = 0;
            faceNumber     = 0;
        }
示例#5
0
        /// <summary>
        /// Adding the other replay available with the replay the user chose
        /// Added by Baptiste Germond
        /// </summary>
        public void tryAddOtherSources(string fileBase)
        {
            bool audioLoad = false;

            foreach (string s in Directory.GetFiles(Path.GetDirectoryName(filePath)))
            {
                string fileName = Path.GetFileName(s);
                if (fileName != fileBase)
                {
                    if (fileName == "avatarSkeletonData.skd")
                    {
                        // the replay needs an instance of ReplayAvatar, so if the first file chose is not the .skd
                        // we have to create one
                        skdRead           = true;
                        skeletonScrolling = new ReplayAvatar(s, this);
                        addOtherVideoSources(ReplayView.Get().Avatar);
                        filePathAvatar = s;
                    }
                    else if (fileName == "stream.avi")
                    {
                        addOtherVideoSources(ReplayView.Get().Stream);
                        filePathVideoStream = s;
                    }
                    else if (fileName == "audio.wav" && !audioLoad)
                    {
                        AddAudio(s);
                        audioLoad = true;
                    }
                    else if (fileName == "feedback.txt")
                    {
                        initialiseFeedbacksQueue(s);
                    }
                    else if (fileName == "charts.xml")
                    {
                        statisticsPath = s;
                    }
                }
            }
            if (!audioLoad)
            {
                ReplayView.Get().SoundCheckbox.IsEnabled = false;
                DrawingSheetView.Get().ReplayAudio.Source = null;
                audioSource = false;
            }
        }