/// <summary> /// Initializes a new instance of the <see cref="MainViewModel"/> class. /// </summary> /// public RecorderViewModel(MainViewModel main, VideoSourcePlayer2 player) { if (main == null) { throw new ArgumentNullException("main"); } if (player == null) { throw new ArgumentNullException("player"); } this.main = main; this.videoPlayer = player; this.videoPlayer.NewFrame += Player_NewFrame; this.CaptureMode = CaptureRegionOption.Primary; this.CaptureRegion = new Rectangle(0, 0, 640, 480); this.clickCapture = new CaptureClick(); this.cursorCapture = new CaptureCursor(); this.keyCapture = new CaptureKeyboard(); this.AudioCaptureDevices = new AudioViewModelCollection(RecorderViewModel.AudioDevices); // Search and mark last selected devices foreach (var dev in AudioCaptureDevices) { dev.Checked = Settings.Default.LastAudioDevices .Contains(dev.DeviceInfo.Guid.ToString()); } }
/// <summary> /// Releases unmanaged and - optionally - managed resources /// </summary> /// /// <param name="disposing"><c>true</c> to release both managed /// and unmanaged resources; <c>false</c> to release only unmanaged /// resources.</param> /// void Dispose(bool disposing) { if (disposing) { // free managed resources if (clickCapture != null) { clickCapture.Dispose(); clickCapture = null; } if (cursorCapture != null) { cursorCapture.Dispose(); cursorCapture = null; } if (keyCapture != null) { keyCapture.Dispose(); keyCapture = null; } if (audioMixer != null) { audioMixer.Dispose(); audioMixer = null; } if (videoWriter != null) { videoWriter.Dispose(); videoWriter = null; } } }