Beispiel #1
0
 public void Pause()
 {
     if (!ReferenceEquals(null, _replay))
     {
         _replay.Stop();
     }
 }
Beispiel #2
0
        public void Close()
        {
            if (_replay != null)
            {
                if (_replay.IsStarted)
                {
                    _replay.Stop();
                }

                _replay.PropertyChanged -= _replay_PropertyChanged;

                if (_replay.HasBodyFrames)
                {
                    _replay.BodyFrameArrived -= _replay_BodyFrameArrived;
                }
                if (_replay.HasColorFrames)
                {
                    _replay.ColorFrameArrived -= _replay_ColorFrameArrived;
                }
                _replay.Dispose();

                _replay = null;
            }

            _colorBitmap = null; // reset to force recreation for new file
        }
Beispiel #3
0
 private void CleanupReplay()
 {
     if (!IsReplaying)
     {
         return;
     }
     message = "";
     //if (_soundPlayer != null && _startedAudio)
     //    _soundPlayer.Stop();
     replay.AllFramesReady -= ReplayAllFramesReady;
     replay.Stop();
     replay.Dispose();
     replay      = null;
     IsReplaying = false;
 }
        private void replayButton_Click(object sender, RoutedEventArgs e)
        {
            OpenFileDialog openFileDialog = new OpenFileDialog {
                Title = "Select filename", Filter = "Replay files|*.replay"
            };

            if (openFileDialog.ShowDialog() == true)
            {
                if (replay != null)
                {
                    replay.SkeletonFrameReady   -= replay_SkeletonFrameReady;
                    replay.ColorImageFrameReady -= replay_ColorImageFrameReady;
                    replay.Stop();
                }
                Stream recordStream = File.OpenRead(openFileDialog.FileName);

                replay = new KinectReplay(recordStream);

                replay.SkeletonFrameReady   += replay_SkeletonFrameReady;
                replay.ColorImageFrameReady += replay_ColorImageFrameReady;
                replay.DepthImageFrameReady += replay_DepthImageFrameReady;

                replay.Start();
            }
        }
        private void ReplayButtonClick(object sender, RoutedEventArgs e)
        {
            Microsoft.Win32.OpenFileDialog openFileDialog = new Microsoft.Win32.OpenFileDialog {
                Title = "Select filename", Filter = "Replay files|*.replay"
            };

            if (openFileDialog.ShowDialog() == true)
            {
                if (replay != null)
                {
                    replay.SkeletonFrameReady   -= ReplaySkeletonFrameReady;
                    replay.ColorImageFrameReady -= ReplayColorImageFrameReady;
                    replay.Stop();
                }

                this.image_stream.DataContext = colorManager;
                Stream recordStream = File.OpenRead(openFileDialog.FileName);

                replay = new KinectReplay(recordStream);

                replay.SkeletonFrameReady   += ReplaySkeletonFrameReady;
                replay.ColorImageFrameReady += ReplayColorImageFrameReady;

                replay.Start();
            }
        }
Beispiel #6
0
        private void replayButton_Click(object sender, RoutedEventArgs e)
        {
            OpenFileDialog openFileDialog = new OpenFileDialog {
                Title = "Select filename", Filter = "Replay files|*.replay"
            };

            if (openFileDialog.ShowDialog() == true)
            {
                if (replay != null)
                {
                    replay.SkeletonFrameReady   -= replay_SkeletonFrameReady;
                    replay.ColorImageFrameReady -= replay_ColorImageFrameReady;
                    replay.Stop();
                    comparisonStopWatch.Stop();
                    comparisonStopWatch.Reset();
                    setPoints();
                    replayOption.Content = "Record";
                }
                Stream recordStream = File.OpenRead(openFileDialog.FileName);


                replay = new KinectReplay(recordStream);

                replay.SkeletonFrameReady   += replay_SkeletonFrameReady;
                replay.ColorImageFrameReady += replay_ColorImageFrameReady;

                replay.Start();
                comparisonStopWatch = new Stopwatch();
                comparisonStopWatch.Start();
                startPlaybackSkeleton();
                //Debug.WriteLine("REPLAY");
            }
        }
Beispiel #7
0
 public void RestartReplay()
 {
     if (null != KinectReplay && null != _replayStream)
     {
         _replayStream.Position = 0;
         KinectReplay.Stop();
         KinectReplay.Start();
     }
     Status = Service.RecordingManagerStatus.Replaying;
 }
Beispiel #8
0
 private void Clean()
 {
     KinectPresent = false;
     if (recorder != null && IsRecording)
     {
         recorder.Stop();
     }
     if (replay != null)
     {
         replay.Stop();
         replay.Dispose();
     }
     if (_kinectSensor == null)
     {
         return;
     }
     if (_kinectSensor.IsRunning)
     {
         _kinectSensor.Stop();
     }
     _kinectSensor.AllFramesReady -= KinectSensorAllFramesReady;
     _kinectSensor.Dispose();
     _kinectSensor = null;
 }
        void OpenButton_Click(object sender, RoutedEventArgs e)
        {
            if (_replay != null)
            {
                if (_replay.IsStarted)
                {
                    _replay.Stop();
                }

                _replay.PropertyChanged -= _replay_PropertyChanged;

                if (_replay.HasBodyFrames)
                {
                    _replay.BodyFrameArrived -= _replay_BodyFrameArrived;
                }
                if (_replay.HasColorFrames)
                {
                    _replay.ColorFrameArrived -= _replay_ColorFrameArrived;
                }
                if (_replay.HasDepthFrames)
                {
                    _replay.DepthFrameArrived -= _replay_DepthFrameArrived;
                }
                if (_replay.HasInfraredFrames)
                {
                    _replay.InfraredFrameArrived -= _replay_InfraredFrameArrived;
                }
                _replay = null;
            }

            var dlg = new OpenFileDialog()
            {
                DefaultExt = ".kdvr",
                Filter     = "KinectEx.DVR Files (*.kdvr)|*.kdvr"
            };

            if (dlg.ShowDialog().GetValueOrDefault())
            {
                _colorBitmap = null; // reset to force recreation for new file

                OutputCombo.Items.Clear();
                _replay = new KinectReplay(File.Open(dlg.FileName, FileMode.Open, FileAccess.Read));
                _replay.PropertyChanged += _replay_PropertyChanged;
                if (_replay.HasBodyFrames)
                {
                    _replay.BodyFrameArrived += _replay_BodyFrameArrived;
                    OutputCombo.Items.Add("Body");
                }
                if (_replay.HasColorFrames)
                {
                    _replay.ColorFrameArrived += _replay_ColorFrameArrived;
                    OutputCombo.Items.Add("Color");
                }
                if (_replay.HasDepthFrames)
                {
                    _replay.DepthFrameArrived += _replay_DepthFrameArrived;
                    OutputCombo.Items.Add("Depth");
                }
                if (_replay.HasInfraredFrames)
                {
                    _replay.InfraredFrameArrived += _replay_InfraredFrameArrived;
                    OutputCombo.Items.Add("Infrared");
                }

                if (OutputCombo.Items.Count > 0)
                {
                    OutputCombo.SelectedIndex = 0;
                }
                else
                {
                    PlayButton.IsEnabled = false;
                }
            }
        }
Beispiel #10
0
        async void OpenButton_Click(object sender, RoutedEventArgs e)
        {
            if (_replay != null)
            {
                if (_replay.IsStarted)
                {
                    _replay.Stop();
                }

                _replay.PropertyChanged -= _replay_PropertyChanged;

                if (_replay.HasBodyFrames)
                {
                    _replay.BodyFrameArrived -= _replay_BodyFrameArrived;
                }
                if (_replay.HasColorFrames)
                {
                    _replay.ColorFrameArrived -= _replay_ColorFrameArrived;
                }
                if (_replay.HasDepthFrames)
                {
                    _replay.DepthFrameArrived -= _replay_DepthFrameArrived;
                }
                if (_replay.HasInfraredFrames)
                {
                    _replay.InfraredFrameArrived -= _replay_InfraredFrameArrived;
                }
                _replay = null;
            }

            var picker = new FileOpenPicker();

            picker.FileTypeFilter.Add(".kdvr");

            var file = await picker.PickSingleFileAsync();

            if (file != null)
            {
                _colorBitmap = null; // reset to force recreation for new file

                OutputCombo.Items.Clear();
                _replay = new KinectReplay(await file.OpenStreamForReadAsync());
                _replay.PropertyChanged += _replay_PropertyChanged;
                if (_replay.HasBodyFrames)
                {
                    _replay.BodyFrameArrived += _replay_BodyFrameArrived;
                    OutputCombo.Items.Add("Body");
                }
                if (_replay.HasColorFrames)
                {
                    _replay.ColorFrameArrived += _replay_ColorFrameArrived;
                    OutputCombo.Items.Add("Color");
                }
                if (_replay.HasDepthFrames)
                {
                    _replay.DepthFrameArrived += _replay_DepthFrameArrived;
                    OutputCombo.Items.Add("Depth");
                }
                if (_replay.HasInfraredFrames)
                {
                    _replay.InfraredFrameArrived += _replay_InfraredFrameArrived;
                    OutputCombo.Items.Add("Infrared");
                }

                if (OutputCombo.Items.Count > 0)
                {
                    OutputCombo.SelectedIndex    = 0;
                    LocationSlider.Maximum       = _replay.Duration.TotalMilliseconds;
                    LocationSlider.TickFrequency = 1000;
                    LocationSlider.SmallChange   = 1000;
                }
                else
                {
                    PlayButton.IsEnabled = false;
                }
            }
        }