public async void StopRecordButton_Click(object sender, RoutedEventArgs e) { if (_recorder != null) { await _recorder.StopAsync(); _recorder = null; //File.Copy(Properties.Paths.CurrentKdvrFile, Properties.Paths.CurrentReplayKdvrFile); Kinect.Instance.Player.OpenFile(Properties.Paths.CurrentKdvrFile); Scene.Instance.Duration = Kinect.Instance.Player.Duration; Scene.Instance.InitTimeLine(); foreach (Person person in Scene.Instance.Persons) { if (!person.HasBeenTracked) { continue; } //person.generatePostureIntervals(); //person.View.repaintIntervalGroups(); //MainWindow.Instance().timeLineContentGrid.Children.Add(person.View.postureGroupsGrid); } Interaction.Instance.GenerateIntervalGroups(); Scene.Instance.Interaction = Interaction.Instance; var db = BackupDataContext.CreateConnection(Properties.Paths.CurrentDataFile); db.Database.EnsureCreated(); //db.Scene.Add(Scene.Instance); //db.SaveChanges(); MainWindow.Instance().FromSceneRadioButton.IsChecked = true; System.Windows.Forms.DialogResult dialogResult = System.Windows.Forms.MessageBox.Show( "Escena grabada con éxito!", "Grabación"); } }
async void RecordButton_Click(object sender, RoutedEventArgs e) { if (_recorder == null) { var dlg = new SaveFileDialog() { FileName = DateTime.Now.ToString("MM-dd-yyyy-hh-mm-ss"), DefaultExt = ".kdvr", Filter = "KinectEx.DVR Files (*.kdvr)|*.kdvr" }; if (dlg.ShowDialog().GetValueOrDefault()) { _recorder = new KinectRecorder(File.Open(dlg.FileName, FileMode.Create), _sensor); _recorder.EnableBodyRecorder = BodyCheckBox.IsChecked.GetValueOrDefault(); _recorder.EnableColorRecorder = ColorCheckBox.IsChecked.GetValueOrDefault(); _recorder.EnableDepthRecorder = DepthCheckBox.IsChecked.GetValueOrDefault(); _recorder.EnableInfraredRecorder = InfraredCheckBox.IsChecked.GetValueOrDefault(); // NOTE : Default ColorRecorderCodec is Raw @ 1920 x 1080. Only need to change the // bits that differ from the default. int colorCompressionType = ColorCompressionCombo.SelectedIndex / 3; int colorCompressionSize = ColorCompressionCombo.SelectedIndex % 3; if (colorCompressionType == 1) { _recorder.ColorRecorderCodec = new JpegColorCodec(); } if (colorCompressionSize == 1) // 1280 x 720 { _recorder.ColorRecorderCodec.OutputWidth = 1280; _recorder.ColorRecorderCodec.OutputHeight = 720; } else if (colorCompressionSize == 2) // 640 x 360 { _recorder.ColorRecorderCodec.OutputWidth = 640; _recorder.ColorRecorderCodec.OutputHeight = 360; } _recorder.Start(); RecordButton.Content = "Stop Recording"; BodyCheckBox.IsEnabled = false; ColorCheckBox.IsEnabled = false; DepthCheckBox.IsEnabled = false; ColorCompressionCombo.IsEnabled = false; } } else { RecordButton.IsEnabled = false; await _recorder.StopAsync(); _recorder = null; RecordButton.Content = "Record"; RecordButton.IsEnabled = true; BodyCheckBox.IsEnabled = true; ColorCheckBox.IsEnabled = true; DepthCheckBox.IsEnabled = true; ColorCompressionCombo.IsEnabled = true; } }
async void RecordButton_Click(object sender, RoutedEventArgs e) { if (_recorder == null) { var picker = new FileSavePicker(); picker.FileTypeChoices.Add("KinectEx.DVR Files", new List <string>() { ".kdvr" }); picker.DefaultFileExtension = ".kdvr"; picker.SuggestedFileName = DateTime.Now.ToString("MM-dd-yyyy-hh-mm-ss"); var file = await picker.PickSaveFileAsync(); if (file != null) { // NOTE : Unlike the WPF sample which uses the "Automatic" mode, this example // shows the use of the manual recording mode and does some work to // optimize the recording process. The result is a better experience // for this application and a better recording because fewer frames // end up getting lost. _recorder = new KinectRecorder(await file.OpenStreamForWriteAsync()); // NOTE : Default ColorRecorderCodec is Raw @ 1920 x 1080. Only need to change the // bits that differ from the default. int colorCompressionType = ColorCompressionCombo.SelectedIndex / 3; int colorCompressionSize = ColorCompressionCombo.SelectedIndex % 3; if (colorCompressionType == 1) { _recorder.ColorRecorderCodec = new JpegColorCodec(); } if (colorCompressionSize == 1) // 1280 x 720 { _recorder.ColorRecorderCodec.OutputWidth = 1280; _recorder.ColorRecorderCodec.OutputHeight = 720; } else if (colorCompressionSize == 2) // 640 x 360 { _recorder.ColorRecorderCodec.OutputWidth = 640; _recorder.ColorRecorderCodec.OutputHeight = 360; } _recorder.Start(); RecordButton.Content = "Stop Recording"; BodyCheckBox.IsEnabled = false; ColorCheckBox.IsEnabled = false; DepthCheckBox.IsEnabled = false; InfraredCheckBox.IsEnabled = false; ColorCompressionCombo.IsEnabled = false; } } else { RecordButton.IsEnabled = false; await _recorder.StopAsync(); _recorder = null; RecordButton.Content = "Record"; RecordButton.IsEnabled = true; BodyCheckBox.IsEnabled = true; ColorCheckBox.IsEnabled = true; DepthCheckBox.IsEnabled = true; InfraredCheckBox.IsEnabled = true; ColorCompressionCombo.IsEnabled = true; } }