Ejemplo n.º 1
0
        /// <summary>
        /// Deal with Button Clicked Events
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void ButtonClickedEvent(object sender, RoutedEventArgs e)
        {
            FrameworkElement feSource = e.OriginalSource as FrameworkElement;

            switch (feSource.Name)
            {
            case "BeginButton":
                Button     beginButton = feSource as Button;
                Storyboard countdown   = this.FindResource("Countdown") as Storyboard;

                // Start the animation and change the button content
                if (beginButton.Content.Equals("Begin Test"))
                {
                    countdown.Begin();
                    beginButton.Content = "End Test";
                }
                else
                {
                    // If the animation is running stop the storyboard
                    // otherwise the animation is done so stop measuring needs to be called.
                    if (countdown.GetCurrentState().Equals(ClockState.Active))
                    {
                        countdown.Stop();
                    }
                    else
                    {
                        SkeletonViewer.StopMeasuring();

                        // once the SkeletonViewer's RiskAnalyzer has finished running, we can give the results
                        // to the AnalyzedSkeletonDisplay object and determine the skeleton frame to use for
                        // display
                        this.AnalysisResultsDisplay.RiskAnalyzer = SkeletonViewer.RiskAnalyzer;

                        // TODO: when we close the results display, the visibility should change for the
                        // depthviewer/skeletonviewer
                        this.AnalysisResultsDisplay.JointMapping = SkeletonViewer.FullyTrackedMapping;
                        this.AnalysisResultsDisplay.AddAnalyzedKinectSkeleton();

                        // hide the depthviewer/skeletonviewer and show the analysis results display
                        this.AnalysisResultsDisplay.Visibility = Visibility.Visible;
                    }

                    // Change button content
                    beginButton.Content = "Begin Test";
                }
                // set event to handled
                e.Handled = true;
                break;
            }
        }
Ejemplo n.º 2
0
 /// <summary>
 /// Event fired when the storyboard animation is complete
 /// </summary>
 /// <param name="sender"></param>
 /// <param name="e"></param>
 private void StartAnalyzer(object sender, EventArgs e)
 {
     SkeletonViewer.StartMeasuring();
 }