/// ------------------------------------------------------------------------------------ public PersonInformant(ElementRepository <Person> peopleRepository, AutoCompleteValueGatherer autoCompleteValueGatherer) { _peopleRepository = peopleRepository; _peopleRepository.ElementIdChanged += HandlePersonNameChanged; _autoCompleteValueGatherer = autoCompleteValueGatherer; }
internal IEnumerable <Session> GetAllSessions() { ElementRepository <Session> sessionRepo = _sessionsRepoFactory(Path.GetDirectoryName(SettingsFilePath), Session.kFolderName, _sessionFileType); sessionRepo.RefreshItemList(); return(sessionRepo.AllItems); }
/// ------------------------------------------------------------------------------------ public void Dispose() { _sessionsRepoFactory = null; if (_needToDisposeTranscriptionFont) { TranscriptionFont.Dispose(); } TranscriptionFont = null; if (_needToDisposeFreeTranslationFont) { FreeTranslationFont.Dispose(); } FreeTranslationFont = null; }
/// ------------------------------------------------------------------------------------ /// <summary> /// can be used whether the project exists already, or not /// </summary> /// ------------------------------------------------------------------------------------ public Project(string desiredOrExistingSettingsFilePath, ElementRepository <Session> .Factory sessionsRepoFactory, SessionFileType sessionFileType) { _sessionsRepoFactory = sessionsRepoFactory; _sessionFileType = sessionFileType; SettingsFilePath = desiredOrExistingSettingsFilePath; Name = Path.GetFileNameWithoutExtension(desiredOrExistingSettingsFilePath); var projectDirectory = Path.GetDirectoryName(desiredOrExistingSettingsFilePath); var saveNeeded = false; if (File.Exists(desiredOrExistingSettingsFilePath)) { RenameEventsToSessions(projectDirectory); Load(); } else { var parentDirectoryPath = Path.GetDirectoryName(projectDirectory); if (parentDirectoryPath != null) { if (!Directory.Exists(parentDirectoryPath)) { Directory.CreateDirectory(parentDirectoryPath); } if (!Directory.Exists(projectDirectory)) { Directory.CreateDirectory(projectDirectory); } } Title = Name; saveNeeded = true; } if (TranscriptionFont == null) { TranscriptionFont = Program.DialogFont; } if (FreeTranslationFont == null) { FreeTranslationFont = Program.DialogFont; } if (AutoSegmenterMinimumSegmentLengthInMilliseconds < Settings.Default.MinimumSegmentLengthInMilliseconds || AutoSegmenterMaximumSegmentLengthInMilliseconds <= 0 || AutoSegmenterMinimumSegmentLengthInMilliseconds >= AutoSegmenterMaximumSegmentLengthInMilliseconds || AutoSegmenterPreferrerdPauseLengthInMilliseconds <= 0 || AutoSegmenterPreferrerdPauseLengthInMilliseconds > AutoSegmenterMaximumSegmentLengthInMilliseconds || AutoSegmenterOptimumLengthClampingFactor <= 0) { saveNeeded = AutoSegmenterMinimumSegmentLengthInMilliseconds != 0 || AutoSegmenterMaximumSegmentLengthInMilliseconds != 0 || AutoSegmenterPreferrerdPauseLengthInMilliseconds != 0 || !AutoSegmenterOptimumLengthClampingFactor.Equals(0) || saveNeeded; AutoSegmenterMinimumSegmentLengthInMilliseconds = Settings.Default.DefaultAutoSegmenterMinimumSegmentLengthInMilliseconds; AutoSegmenterMaximumSegmentLengthInMilliseconds = Settings.Default.DefaultAutoSegmenterMaximumSegmentLengthInMilliseconds; AutoSegmenterPreferrerdPauseLengthInMilliseconds = Settings.Default.DefaultAutoSegmenterPreferrerdPauseLengthInMilliseconds; AutoSegmenterOptimumLengthClampingFactor = Settings.Default.DefaultAutoSegmenterOptimumLengthClampingFactor; } if (saveNeeded) { Save(); } }
/// ------------------------------------------------------------------------------------ public SessionWorkflowInformant(ElementRepository <Session> sessionRepository, IEnumerable <ComponentRole> componentRoles) { _sessionRepository = sessionRepository; _componentRoles = componentRoles; }