Exemple #1
0
        private void RenderFrame(object sender, DoWorkEventArgs e)
        {
            ProcessInfraredFrameEventArgs args      = (ProcessInfraredFrameEventArgs)e.Argument;
            InfraredFrameReference        reference = args.frame;

            using (InfraredFrame frame = reference.AcquireFrame())
            {
                if (frame != null)
                {
                    //////Debug.WriteLine("Depth frame arrived");
                    try
                    {
                        e.Result = new IFrame(frame);
                    }
                    catch (Exception)
                    {
                    }
                }
            }
        }
Exemple #2
0
        /// <summary>
        /// This is what gets called when a new Depth Frame comes in
        /// </summary>
        private void Reader_FrameArrived(object sender, InfraredFrameArrivedEventArgs e)
        {
            if (!isWorking)
            {
                isWorking = true;
                BackgroundWorker bw;

                ProcessInfraredFrameEventArgs args = new ProcessInfraredFrameEventArgs();

                args.frame = e.FrameReference;

                //set up background worker
                bw                     = new BackgroundWorker();
                bw.DoWork             += RenderFrame;
                bw.RunWorkerCompleted += Render_Complete;
                bw.RunWorkerAsync(args);
            }
            else
            {
                ////Debug.WriteLine("Depth fram already working.");
            }
        }