Example #1
0
 /// <summary>
 /// Handles a frame arrived event and renders the frame to the screen.
 /// </summary>
 private void FrameReader_FrameArrived(MediaFrameReader sender, MediaFrameArrivedEventArgs args)
 {
     using (var frame = sender.TryAcquireLatestFrame())
     {
         if (frame != null)
         {
             if (frame.SourceKind == MediaFrameSourceKind.Depth)
             {
                 frameRenderer.ProcessFrame(frame);
             }
         }
     }
 }
 /// <summary>
 /// Handles a frame arrived event and renders the frame to the screen.
 /// </summary>
 private void FrameReader_FrameArrived(MediaFrameReader sender, MediaFrameArrivedEventArgs args)
 {
     // TryAcquireLatestFrame will return the latest frame that has not yet been acquired.
     // This can return null if there is no such frame, or if the reader is not in the
     // "Started" state. The latter can occur if a FrameArrived event was in flight
     // when the reader was stopped.
     using (var frame = sender.TryAcquireLatestFrame())
     {
         if (frame != null)
         {
             if (frame.SourceKind == MediaFrameSourceKind.Color)
             {
                 frameRenderer.ProcessFrame(frame);
             }
         }
     }
 }