Пример #1
0
        /// <summary>
        /// Constructor
        /// Modified by Baptiste Germond
        /// </summary>
        /// <param name="file"></param>
        private ReplayViewModel(String file)
        {
            filePath = file;
            instance = this;
            performanceSoundCommand   = new RelayCommand(performanceSound);
            playPerformanceCommand    = new RelayCommand(Play);
            pausePerformanceCommand   = new RelayCommand(Pause);
            stopPerformanceCommand    = new RelayCommand(Stop);
            videoAvatarDisplayCommand = new RelayCommand(videoAvatarDisplay);
            avatarDisplayCommand      = new RelayCommand(avatarDisplay);
            streamDisplayCommand      = new RelayCommand(videoStreamDisplay);
            quitCommand        = new RelayCommand(quit);
            otherReplayCommand = new RelayCommand(otherReplay);
            Tools.initStopWatch();

            DrawingSheetView.Get().ReplayVideo.MediaEnded += videoEnded;

            SideToolsViewModel.Get().disableTrackingAndTrainingTab();
            ManagePerformanceFiles();
            //ManageSpeedElements();
            Mute();
            pauseButtonCommand();
            if (!skdRead)
            {
                throw new Exception(".skd file is not correct\nPlease try with one avatarSkeletonData.skd file correct");
            }
        }
Пример #2
0
 public static ReplayViewModel Get()
 {
     if (instance == null)
     {
         instance = new ReplayViewModel("../../bin/Debug/");
     }
     return(instance);
 }
Пример #3
0
 public static void Set(String file)
 {
     try
     {
         instance = new ReplayViewModel(file);
     }
     catch (Exception e)
     {
         throw e;
     }
 }
Пример #4
0
 /// <summary>
 /// Reset the instance of this class and the skeleton scrolling.
 /// </summary>
 public void resetInstance()
 {
     instance = null;
 }
        /// <summary>
        /// Show and place feedbacks in the canvas for the replay videostream
        /// </summary>
        /// <param name="avatar">use only in the live videostream</param>
        public void ShowFeedbacksOnVideoStream(Skeleton avatar = null)
        {
            if (ReplayViewModel.isReplaying && ReplayView.Get().Stream.IsChecked.Value)
            {
                List <String> feedbacksToDisplay = ReplayViewModel.Get().currentFeedbackList;

                if (feedbacksToDisplay != null)
                {
                    foreach (String message in feedbacksToDisplay)
                    {
                        switch (message)
                        {
                        // agitation
                        case ("Too agitated!"):
                            ((System.Windows.Controls.Image)dsv.CanvasFeedback.Children[correspondIndiceName["Agitation"]]).Height = dsv.ActualHeight / 4;
                            Canvas.SetTop(((System.Windows.Controls.Image)dsv.CanvasFeedback.Children[correspondIndiceName["Agitation"]]),
                                          dsv.ActualHeight / 5 - ((System.Windows.Controls.Image)dsv.CanvasFeedback.Children[correspondIndiceName["Agitation"]]).ActualHeight / 2);
                            Canvas.SetLeft(((System.Windows.Controls.Image)dsv.CanvasFeedback.Children[correspondIndiceName["Agitation"]]),
                                           dsv.ActualWidth / 7 - ((System.Windows.Controls.Image)dsv.CanvasFeedback.Children[correspondIndiceName["Agitation"]]).ActualWidth / 2);
                            dsv.CanvasFeedback.Children[correspondIndiceName["Agitation"]].Visibility = Visibility.Visible;
                            break;

                        // arms and hands
                        case ("Arms Crossed"):
                            ((System.Windows.Controls.Image)dsv.CanvasFeedback.Children[correspondIndiceName["Arms_Crossed"]]).Height = dsv.ActualHeight / 4;
                            Canvas.SetTop(((System.Windows.Controls.Image)dsv.CanvasFeedback.Children[correspondIndiceName["Arms_Crossed"]]),
                                          dsv.ActualHeight / 2 - ((System.Windows.Controls.Image)dsv.CanvasFeedback.Children[correspondIndiceName["Arms_Crossed"]]).ActualHeight / 2);
                            Canvas.SetLeft(((System.Windows.Controls.Image)dsv.CanvasFeedback.Children[correspondIndiceName["Arms_Crossed"]]),
                                           dsv.ActualWidth / 7 - ((System.Windows.Controls.Image)dsv.CanvasFeedback.Children[correspondIndiceName["Arms_Crossed"]]).ActualWidth / 2);
                            dsv.CanvasFeedback.Children[correspondIndiceName["Arms_Crossed"]].Visibility = Visibility.Visible;
                            break;

                        case ("Hands are joined"):
                            ((System.Windows.Controls.Image)dsv.CanvasFeedback.Children[correspondIndiceName["Hand_Joined"]]).Height = dsv.ActualHeight / 4;
                            Canvas.SetTop(((System.Windows.Controls.Image)dsv.CanvasFeedback.Children[correspondIndiceName["Hand_Joined"]]),
                                          dsv.ActualHeight / 5 * 4 - ((System.Windows.Controls.Image)dsv.CanvasFeedback.Children[correspondIndiceName["Hand_Joined"]]).ActualHeight / 2);
                            Canvas.SetLeft(((System.Windows.Controls.Image)dsv.CanvasFeedback.Children[correspondIndiceName["Hand_Joined"]]),
                                           dsv.ActualWidth / 7 - ((System.Windows.Controls.Image)dsv.CanvasFeedback.Children[correspondIndiceName["Hand_Joined"]]).ActualWidth / 2);
                            dsv.CanvasFeedback.Children[correspondIndiceName["Hand_Joined"]].Visibility = Visibility.Visible;
                            break;

                        // looking direction
                        case ("Look to the center"):
                            ((System.Windows.Controls.Image)dsv.CanvasFeedback.Children[correspondIndiceName["Center_Arrow"]]).Height = dsv.CanvasFeedback.ActualHeight / 6;
                            Canvas.SetTop(((System.Windows.Controls.Image)dsv.CanvasFeedback.Children[correspondIndiceName["Center_Arrow"]]),
                                          dsv.ActualHeight / 6 - ((System.Windows.Controls.Image)dsv.CanvasFeedback.Children[correspondIndiceName["Center_Arrow"]]).ActualHeight / 2);
                            Canvas.SetLeft(((System.Windows.Controls.Image)dsv.CanvasFeedback.Children[correspondIndiceName["Center_Arrow"]]),
                                           dsv.ActualWidth / 2 - ((System.Windows.Controls.Image)dsv.CanvasFeedback.Children[correspondIndiceName["Center_Arrow"]]).ActualWidth / 2);
                            dsv.CanvasFeedback.Children[correspondIndiceName["Center_Arrow"]].Visibility = Visibility.Visible;
                            break;

                        case ("Look to the left"):
                            ((System.Windows.Controls.Image)dsv.CanvasFeedback.Children[correspondIndiceName["Left_Arrow"]]).Height = dsv.CanvasFeedback.ActualHeight / 6;
                            Canvas.SetTop(((System.Windows.Controls.Image)dsv.CanvasFeedback.Children[correspondIndiceName["Left_Arrow"]]),
                                          dsv.ActualHeight / 6 - ((System.Windows.Controls.Image)dsv.CanvasFeedback.Children[correspondIndiceName["Left_Arrow"]]).ActualHeight / 2);
                            Canvas.SetLeft(((System.Windows.Controls.Image)dsv.CanvasFeedback.Children[correspondIndiceName["Left_Arrow"]]),
                                           dsv.ActualWidth / 4 - ((System.Windows.Controls.Image)dsv.CanvasFeedback.Children[correspondIndiceName["Left_Arrow"]]).ActualWidth / 2);
                            dsv.CanvasFeedback.Children[correspondIndiceName["Left_Arrow"]].Visibility = Visibility.Visible;
                            break;

                        case ("Look to the right"):
                            ((System.Windows.Controls.Image)dsv.CanvasFeedback.Children[correspondIndiceName["Right_Arrow"]]).Height = dsv.CanvasFeedback.ActualHeight / 6;
                            Canvas.SetTop(((System.Windows.Controls.Image)dsv.CanvasFeedback.Children[correspondIndiceName["Right_Arrow"]]),
                                          dsv.ActualHeight / 6 - ((System.Windows.Controls.Image)dsv.CanvasFeedback.Children[correspondIndiceName["Right_Arrow"]]).ActualHeight / 2);
                            Canvas.SetLeft(((System.Windows.Controls.Image)dsv.CanvasFeedback.Children[correspondIndiceName["Right_Arrow"]]),
                                           dsv.ActualWidth * 3 / 4 - ((System.Windows.Controls.Image)dsv.CanvasFeedback.Children[correspondIndiceName["Right_Arrow"]]).ActualWidth / 2);
                            dsv.CanvasFeedback.Children[correspondIndiceName["Right_Arrow"]].Visibility = Visibility.Visible;
                            break;

                        // emotion
                        case ("Happy"):
                            ((System.Windows.Controls.Image)dsv.CanvasFeedback.Children[correspondIndiceName["Happy"]]).Height = dsv.CanvasFeedback.ActualHeight / 5;
                            Canvas.SetRight(((System.Windows.Controls.Image)dsv.CanvasFeedback.Children[correspondIndiceName["Happy"]]), dsv.CanvasFeedback.ActualHeight / 6);
                            Canvas.SetTop(((System.Windows.Controls.Image)dsv.CanvasFeedback.Children[correspondIndiceName["Happy"]]), dsv.CanvasFeedback.ActualHeight / 3);
                            dsv.CanvasFeedback.Children[correspondIndiceName["Happy"]].Visibility = Visibility.Visible;
                            break;

                        case ("Surprised"):
                            ((System.Windows.Controls.Image)dsv.CanvasFeedback.Children[correspondIndiceName["Surprised"]]).Height = dsv.CanvasFeedback.ActualHeight / 5;
                            Canvas.SetRight(((System.Windows.Controls.Image)dsv.CanvasFeedback.Children[correspondIndiceName["Surprised"]]), dsv.CanvasFeedback.ActualHeight / 6);
                            Canvas.SetTop(((System.Windows.Controls.Image)dsv.CanvasFeedback.Children[correspondIndiceName["Surprised"]]), dsv.CanvasFeedback.ActualHeight / 3);
                            dsv.CanvasFeedback.Children[correspondIndiceName["Surprised"]].Visibility = Visibility.Visible;
                            break;
                        }
                    }
                }
            }
            dsv.CanvasFeedback.UpdateLayout();
        }