public void ToggleStartPause() { if (Stage == CaptureMovieProcessFlowStage.Stopped || Stage == CaptureMovieProcessFlowStage.CountingDownTillRecording) { if (PreRecordingTimer == null) { PreRecordingTimer = new DispatcherTimer(); PreRecordingTimer.Tick += new EventHandler(StartMovieDelay_Timer); PreRecordingTimer.Interval = new TimeSpan(0, 0, 1); PreRecordingTimer.Start(); State = CaptureMovieProcessFlowStates.CountingDownTillRecording; Stage = CaptureMovieProcessFlowStage.CountingDownTillRecording; Seconds = 3; TextBlock.Text = "You have " + Seconds.ToString() + " seconds before recording starts..."; TextBlock.Visibility = System.Windows.Visibility.Visible; IsRecording = true; } else { if (PreRecordingTimer.IsEnabled) { PreRecordingTimer.Stop(); IsRecording = false; State = CaptureMovieProcessFlowStates.PausedCountingDownTillRecording; } else { PreRecordingTimer.Start(); State = CaptureMovieProcessFlowStates.CountingDownTillRecording; IsRecording = true; } } } else { if (RecordingTimer != null) { if (RecordingTimer.IsEnabled) { RecordingTimer.Stop(); State = CaptureMovieProcessFlowStates.PausedRecording; CaptureFacede.PauseCapturingVideoToFile(); IsRecording = false; } else { RecordingTimer.Start(); State = CaptureMovieProcessFlowStates.Recording; CaptureFacede.ResumeCapturingVideoToFile(); IsRecording = true; } } } }
void StartRecording() { lock (recordingLock) { // If recording is not in progress then return. if (Recording) { return; } Recording = true; drawRecordingImage = true; RecordingTimer.Start(); CurrentCbx.ForeColor = SystemColors.GrayText; MainForm.Current.StatusTimerLabel.Text = (CurrentCbx == DPadComboBox) ? "Recording - press any D-Pad button on your direct input device. Press ESC to cancel..." : "Recording - press button, move axis or slider on your direct input device. Press ESC to cancel..."; } }