Exemple #1
0
 /// <summary>
 /// The internal call that assumes a graphics object has been dimensioned.
 /// </summary>
 /// <param name="g"></param>
 /// <param name="snapshot"></param>
 protected virtual void OnDrawSnapshot(Graphics g, SkeletonSnapshot snapshot)
 {
     g.SmoothingMode = System.Drawing.Drawing2D.SmoothingMode.AntiAlias;
     foreach (SkeletonBody body in snapshot.SkeletonBodies)
     {
         OnDrawSkeletion(g, body);
     }
 }
        /// <summary>
        /// This handler is responsible for converting the SkeletonFrameReadyEventArgs into a serializable SkeletonBody
        /// that can be added to the recording.
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        void SkeletonFrameReady(object sender, SkeletonFrameReadyEventArgs e)
        {
            // A SkeletonFrame object will provide multiple skeletons.
            SkeletonFrame allSkeletons = e.SkeletonFrame;

            // The skeletons list selects the skeletons that are tracked, but does not bother with the others.
            List <SkeletonData> skeletons = new List <SkeletonData>((from s in allSkeletons.Skeletons
                                                                     where s.TrackingState == SkeletonTrackingState.Tracked
                                                                     select s));



            // Only throw an event if we are actively tracking at least one skeleton.
            if (skeletons != null && skeletons.Count > 0)
            {
                // A SkeletonSnapshot represents multiple instances.
                SkeletonSnapshot snapshot = new SkeletonSnapshot(skeletons);

                this.SkeletonReady(this, new SkeletonEventArgs(snapshot));
            }
        }
Exemple #3
0
 /// <summary>
 /// Creates a new instance of the Skeleton snapshot
 /// </summary>
 /// <param name="snapshot"></param>
 public SkeletonEventArgs(SkeletonSnapshot snapshot)
 {
     _snapshot = snapshot;
 }
Exemple #4
0
 public void Clear()
 {
     _currentSnapshot = null;
     DrawContent();
 }
Exemple #5
0
 /// <summary>
 /// Updates the current snapshot and forces that snapshot to be drawn to the view.
 /// </summary>
 /// <param name="snapshot"></param>
 public void DrawSnapshot(SkeletonSnapshot snapshot)
 {
     _currentSnapshot = snapshot;
     DrawContent();
 }