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 PauseRecording() { RecordingTimer.Stop(); CaptureFacede.PauseCapturingVideoToFile(); this.IsRecording = false; State = CaptureMovieProcessFlowStates.PausedRecording; Stage = CaptureMovieProcessFlowStage.Stopped; }
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 bool StopRecording(List <string> actions = null) { lock (recordingLock) { // If recording is not in progress then return false. if (!Recording) { recordingSnapshot = null; return(false); } else if (recordingSnapshot == null) { // Make snapshot out of first state during recordining. recordingSnapshot = actions; } // Must stop recording if null passed or at least one action was recorded. var stop = (actions == null || actions.Count > 0); // If recording must stop then... if (stop) { Recording = false; RecordingTimer.Stop(); // If stop was initiaded before action was recorded then... if (actions == null) { CurrentCbx.Items.Clear(); } // If action was recorded then... else { // Get first recorded action. var name = actions[0]; // If this is DPad ComboBox and recorded action is DPad then... if (CurrentCbx == DPadComboBox && dPadRx.IsMatch(name)) { name = dPadRx.Match(name).Groups[0].Value; } SettingManager.Current.SetComboBoxValue(CurrentCbx, name); // Save setting and notify if vaue changed. if (SettingManager.Current.SaveSetting(CurrentCbx)) { MainForm.Current.NotifySettingsChange(); } } CurrentCbx.ForeColor = SystemColors.WindowText; CurrentCbx = null; } return(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..."; } }
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; }
/// <summary> /// Called whhen recording is in progress. /// </summary> /// <param name="state">Current direct input activity.</param> /// <returns>True if recording stopped, otherwise false.</returns> public bool StopRecording(DirectInputState state = null) { lock (recordingLock) { // If recording is not in progress then return false. if (!Recording) { recordingSnapshot = null; return(false); } // If recording snapshot was not created yet then... else if (recordingSnapshot == null) { // Make snapshot out of the first state during recordining. recordingSnapshot = state; return(false); } // Get actions by comparing intial snapshot with current state. var actions = recordingSnapshot.CompareTo(state); string action = null; // Must stop recording if null passed. var stop = actions == null; // if at least one action was recorded then... if (!stop && actions.Length > 0) { // If this is DPad ComboBox then... if (CurrentCbx == DPadComboBox) { // Get first action suitable for DPad var dPadAction = actions.FirstOrDefault(x => dPadRx.IsMatch(x)); if (dPadAction != null) { action = dPadRx.Match(dPadAction).Groups[0].Value; stop = true; } } else { // Get first recorded action. action = actions[0]; stop = true; } } // If recording must stop then... if (stop) { Recording = false; RecordingTimer.Stop(); // If stop was initiaded before action was recorded then... if (string.IsNullOrEmpty(action)) { CurrentCbx.Items.Clear(); } else { // If suitable action was recorded then... SettingManager.Current.SetComboBoxValue(CurrentCbx, action); // Save setting and notify if vaue changed. if (SettingManager.Current.SaveSetting(CurrentCbx)) { MainForm.Current.NotifySettingsChange(); } } CurrentCbx.ForeColor = SystemColors.WindowText; CurrentCbx = null; } return(stop); } }