private void StopRecording() { if (!cameraLoaded || !recording || !consumerRecord.Active) { return; } recording = false; consumerRecord.Deactivate(); view.Toast(ScreenManagerLang.Toast_StopRecord, 750); NotificationCenter.RaiseRefreshFileExplorer(this, false); if (recordingThumbnail != null) { AddCapturedFile(consumerRecord.Filename, recordingThumbnail, true); recordingThumbnail.Dispose(); recordingThumbnail = null; } CaptureHistoryEntry entry = CreateHistoryEntry(); CaptureHistory.AddEntry(entry); // We need to use the original filename with patterns still in it. string filenameWithoutExtension = view.CurrentVideoFilename; if (index == 0) { PreferencesManager.CapturePreferences.CapturePathConfiguration.LeftVideoFile = filenameWithoutExtension; } else { PreferencesManager.CapturePreferences.CapturePathConfiguration.RightVideoFile = filenameWithoutExtension; } PreferencesManager.Save(); string next = Filenamer.ComputeNextFilename(filenameWithoutExtension); view.UpdateNextVideoFilename(next); view.UpdateRecordingStatus(recording); }
private void MakeSnapshot() { if (!cameraLoaded || consumerDisplay.Bitmap == null) { return; } string root; string subdir; if (index == 0) { root = PreferencesManager.CapturePreferences.CapturePathConfiguration.LeftImageRoot; subdir = PreferencesManager.CapturePreferences.CapturePathConfiguration.LeftImageSubdir; } else { root = PreferencesManager.CapturePreferences.CapturePathConfiguration.RightImageRoot; subdir = PreferencesManager.CapturePreferences.CapturePathConfiguration.RightImageSubdir; } string filenameWithoutExtension = view.CurrentImageFilename; string extension = Filenamer.GetImageFileExtension(); Dictionary <FilePatternContexts, string> context = BuildCaptureContext(); string path = Filenamer.GetFilePath(root, subdir, filenameWithoutExtension, extension, context); FilesystemHelper.CreateDirectory(path); if (!FilePathSanityCheck(path)) { return; } if (!OverwriteCheck(path)) { return; } //Actual save. Bitmap outputImage = BitmapHelper.Copy(consumerDisplay.Bitmap); if (outputImage == null) { return; } ImageHelper.Save(path, outputImage); view.Toast(ScreenManagerLang.Toast_ImageSaved, 750); // After save routines. NotificationCenter.RaiseRefreshFileExplorer(this, false); AddCapturedFile(path, outputImage, false); CaptureHistoryEntry entry = CreateHistoryEntrySnapshot(path); CaptureHistory.AddEntry(entry); if (index == 0) { PreferencesManager.CapturePreferences.CapturePathConfiguration.LeftImageFile = filenameWithoutExtension; } else { PreferencesManager.CapturePreferences.CapturePathConfiguration.RightImageFile = filenameWithoutExtension; } PreferencesManager.Save(); // Compute next name for user feedback. string next = Filenamer.ComputeNextFilename(filenameWithoutExtension); view.UpdateNextImageFilename(next); }