public void Cancel() { if (Stage == CaptureMovieProcessFlowStage.Recording) { Stage = CaptureMovieProcessFlowStage.Stopped; State = CaptureMovieProcessFlowStates.Stop; PreRecordingTimer.Stop();; RecordingTimer.Stop(); PreRecordingTimer = null; RecordingTimer = null; CaptureFacede.StopCapturingVideoToFile(); //TODO handle files left after cancel //File.Delete(TempFilename); TextBlock.Visibility = System.Windows.Visibility.Collapsed; IsRecording = false; } else { this.Clean(); } }
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; } } } }
public void End() { if (Stage == CaptureMovieProcessFlowStage.Recording) { Stage = CaptureMovieProcessFlowStage.Stopped; State = CaptureMovieProcessFlowStates.Stop; PreRecordingTimer.Stop();; RecordingTimer.Stop(); PreRecordingTimer = null; RecordingTimer = null; this.StopRecording(); } else { this.Clean(); } }
public void Clean() { if (PreRecordingTimer != null) { PreRecordingTimer.Stop(); PreRecordingTimer = null; } if (RecordingTimer != null) { RecordingTimer.Stop(); RecordingTimer = null; } Stage = CaptureMovieProcessFlowStage.Stopped; State = CaptureMovieProcessFlowStates.Stop; TextBlock.Visibility = Visibility.Collapsed; this.IsRecording = false; }