コード例 #1
0
 /// ------------------------------------------------------------------------------------
 public PersonInformant(ElementRepository <Person> peopleRepository,
                        AutoCompleteValueGatherer autoCompleteValueGatherer)
 {
     _peopleRepository = peopleRepository;
     _peopleRepository.ElementIdChanged += HandlePersonNameChanged;
     _autoCompleteValueGatherer          = autoCompleteValueGatherer;
 }
コード例 #2
0
        internal IEnumerable <Session> GetAllSessions()
        {
            ElementRepository <Session> sessionRepo = _sessionsRepoFactory(Path.GetDirectoryName(SettingsFilePath), Session.kFolderName, _sessionFileType);

            sessionRepo.RefreshItemList();

            return(sessionRepo.AllItems);
        }
コード例 #3
0
 /// ------------------------------------------------------------------------------------
 public void Dispose()
 {
     _sessionsRepoFactory = null;
     if (_needToDisposeTranscriptionFont)
     {
         TranscriptionFont.Dispose();
     }
     TranscriptionFont = null;
     if (_needToDisposeFreeTranslationFont)
     {
         FreeTranslationFont.Dispose();
     }
     FreeTranslationFont = null;
 }
コード例 #4
0
        /// ------------------------------------------------------------------------------------
        /// <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();
            }
        }
コード例 #5
0
 /// ------------------------------------------------------------------------------------
 public SessionWorkflowInformant(ElementRepository <Session> sessionRepository,
                                 IEnumerable <ComponentRole> componentRoles)
 {
     _sessionRepository = sessionRepository;
     _componentRoles    = componentRoles;
 }