Exemplo n.º 1
0
        // We want to control how depth data gets converted into false-color data
        // for more intuitive visualization, so we keep 32-bit color frame buffer versions of
        // these, to be updated whenever we receive and process a 16-bit frame.
        /*const int RED_IDX = 2;
        const int GREEN_IDX = 1;
        const int BLUE_IDX = 0;
        byte[] depthFrame32 = new byte[320 * 240 * 4];*/
        public ExerciseView(Exercise ex)
        {
            InitializeComponent();

            this.ex = ex;

            statusText.Text = ex.statusMessage;

            passSound = new SoundPlayer("Sounds/ExercisePass.wav");
            passSound.LoadAsync();
            failSound = new SoundPlayer("Sounds/ExerciseFail.wav");
            failSound.LoadAsync();

            #if DEBUG
            lastTime = DateTime.Now;

            fpsLabel = new Label();
            fpsLabel.Content = "FPS:";
            fpsLabel.FontSize = (double)Application.Current.Resources["SmallButtonFont"];
            fpsLabel.HorizontalContentAlignment = HorizontalAlignment.Center;
            fpsLabel.HorizontalAlignment = HorizontalAlignment.Left;
            bottomPanel.Children.Insert(0, fpsLabel);
            #endif

            #if AUDIOUI
            SharedContent.Sr.registerSpeechCommand(SharedContent.Commands.Stop, selectedResponse);
            #endif

            //SharedContent.Nui.DepthFrameReady += new EventHandler<ImageFrameReadyEventArgs>(nuiDepthFrameReady);
            SharedContent.Nui.SkeletonFrameReady += new EventHandler<SkeletonFrameReadyEventArgs>(nuiSkeletonFrameReady);
            SharedContent.Nui.VideoFrameReady += new EventHandler<ImageFrameReadyEventArgs>(nuiColorFrameReady);
        }
Exemplo n.º 2
0
        public static Exercise[] GetExercises()
        {
            shoulderAbduction = shoulderAbduction ?? ExerciseFactory.CreateRightShoulderAbductionExercise();
            bicepCurl = bicepCurl ?? ExerciseFactory.CreateRightBicepCurlExercise();

            return new Exercise[] { shoulderAbduction, bicepCurl };
        }
Exemplo n.º 3
0
        public ExercisePreview(Exercise ex)
        {
            InitializeComponent();

            this.ex = ex;

            #if AUDIOUI
            SharedContent.Sr.registerSpeechCommand(SharedContent.Commands.Play, selectedResponse);
            SharedContent.Sr.registerSpeechCommand(SharedContent.Commands.Pause, selectedResponse);
            SharedContent.Sr.registerSpeechCommand(SharedContent.Commands.Stop, selectedResponse);
            SharedContent.Sr.registerSpeechCommand(SharedContent.Commands.Continue, selectedResponse);
            #endif
        }
        public ExerciseFeedback(Exercise ex)
        {
            InitializeComponent();

            stepViewer.Height = (double)Application.Current.Resources["AppHeight"] -
                (double)Application.Current.Resources["BigButtonHeight"];

            #if AUDIOUI
            SharedContent.Sr.registerSpeechCommand(SharedContent.Commands.Back, selectedResponse);
            SharedContent.Sr.registerSpeechCommand(SharedContent.Commands.Retry, selectedResponse);
            #endif

            this.ex = ex;
            ExerciseStep[] steps = ex.exerciseSteps;
            foreach (ExerciseStep step in steps)
            {
                Uri source;
                switch (step.stepStatus)
                {
                    case ExerciseStepStatus.Complete:
                        source = new Uri("Images/CheckboxPass.bmp", UriKind.Relative);
                        break;
                    case ExerciseStepStatus.Failed:
                        source = new Uri("Images/CheckboxFail.bmp", UriKind.Relative);
                        break;
                    default:
                        source = new Uri("Images/Checkbox.bmp", UriKind.Relative);
                        break;
                }
                LabelAndImage lai = new LabelAndImage(new BitmapImage(source), step.stepName, HorizontalAlignment.Left,
                    (double)Application.Current.Resources["SmallButtonHeight"], (double)Application.Current.Resources["BigButtonWidth"],
                    (double)Application.Current.Resources["SmallButtonFont"]);
                stepPanel.Children.Add(lai);
            }

            switch (ex.exerciseStatus)
            {
                case ExerciseStatus.Complete:
                    statusLabel.Content = "COMPLETE!";
                    break;
                case ExerciseStatus.Failed:
                    statusLabel.Content = "FAIL";
                    break;
            }
        }
Exemplo n.º 5
0
        public CalibratingView(Exercise ex)
        {
            InitializeComponent();

            this.ex = ex;

            secondPassedSound = new SoundPlayer("Sounds/Countdown.wav");
            secondPassedSound.LoadAsync();
            snapshotSound = new SoundPlayer("Sounds/Camera.wav");
            snapshotSound.LoadAsync();
            
            secondsLeft = SharedContent.CalibrationSeconds * ex.getPosesToBeCalibrated().Count();
            secondsLabel.Content = String.Format("{0}", SharedContent.CalibrationSeconds);
            capturing = false;
            hasCaptured = false;

            timer = new DispatcherTimer();
            timer.Interval = new TimeSpan(0, 0, 1);
            timer.Tick += timerSecondPassed;
            timer.Start();

            currentPoseBeingCalibrated = 0;
            drawPose();
        }