Beispiel #1
0
        private void InitializeRelayCommands()
        {
            ToggleRecordingCommand = new RelayCommand <System.Windows.Controls.Button>(sender =>
            {
                if (!IsRecording)
                {
                    var sfd    = new SaveFileDialog();
                    sfd.Filter = "MPEG-4 Video|*.mp4|All files|*.*";
                    sfd.Title  = "Save the recording";

                    if (sfd.ShowDialog() == true)
                    {
                        if (videoWriter != null)
                        {
                            videoWriter.Dispose();
                        }

                        videoWriter = new MP4VideoWriter(sfd.FileName, new SharpDX.Size2(1920, 1080), MF.VideoFormatGuids.Argb32, true);

                        debugWaveFile = new WaveFile(WAVEFORMATEX.DefaultPCM);
                        debugWaveFile.Open(Path.Combine(Path.GetDirectoryName(sfd.FileName), Path.GetFileNameWithoutExtension(sfd.FileName)) + ".wav");

                        sender.Content = "Stop recording";
                        IsRecording    = true;
                    }
                }
                else
                {
                    sender.Content = "Record";
                    IsRecording    = false;
                }
            });

            OpenRecordingCommand = new RelayCommand(OpenRecording);

            ResetFilterCommand = new RelayCommand(objectFilter.Reset);

            PauseKinectCommand    = new RelayCommand(() => IsKinectPaused = true);
            ContinueKinectCommand = new RelayCommand(() => IsKinectPaused = false);
        }