Exemplo n.º 1
0
        public void Start()
        {
            if (Started)
            {
                throw new Exception("KinectReplay already started");
            }

            Started = true;

            if (colorReplay != null)
            {
                colorReplay.Start();
                colorReplay.FrameReady += frame => synchronizationContext.Send(state =>
                {
                    if (ColorImageFrameReady != null)
                    {
                        ColorImageFrameReady(this, new ReplayColorImageFrameReadyEventArgs {
                            ColorImageFrame = frame
                        });
                    }
                }, null);
            }

            if (depthReplay != null)
            {
                depthReplay.Start();
                depthReplay.FrameReady += frame => synchronizationContext.Send(state =>
                {
                    if (DepthImageFrameReady != null)
                    {
                        DepthImageFrameReady(this, new ReplayDepthImageFrameReadyEventArgs {
                            DepthImageFrame = frame
                        });
                    }
                }, null);
            }

            if (skeletonReplay != null)
            {
                skeletonReplay.Start();
                skeletonReplay.FrameReady += frame => synchronizationContext.Send(state =>
                {
                    if (SkeletonFrameReady != null)
                    {
                        SkeletonFrameReady(this, new ReplaySkeletonFrameReadyEventArgs {
                            SkeletonFrame = frame
                        });
                    }
                }, null);
            }
        }
        public void Start(DispatcherTimer timer = null)
        {
            if (Started)
            {
                throw new Exception("KinectReplay already started");
            }

            Started = true;

            if (allFramesReplay != null)
            {
                allFramesReplay.FrameReady += frame => synchronizationContext.Send(state => {
                    if (AllFramesReady != null)
                    {
                        AllFramesReady(this, new ReplayAllFramesReadyEventArgs {
                            AllFrames = frame
                        });
                    }
                }, null);
                allFramesReplay.Start(timer);
            }
        }