Example #1
0
        /// ------------------------------------------------------------------------------------
        public override sealed void SetComponentFile(ComponentFile file)
        {
            Deactivated();

            this.SetWindowRedraw(false);
            base.SetComponentFile(file);

            var annotationFile = (AnnotationComponentFile)file;

            _splitter.Panel1Collapsed = annotationFile.GetIsAnnotatingAudioFile();

            var exception = annotationFile.TryLoadAndReturnException();

            if (exception != null)
            {
                var msg = LocalizationManager.GetString("SessionsView.Transcription.TextAnnotationEditor.LoadingAnnotationFileErrorMsg",
                                                        "There was an error loading the annotation file '{0}'.");

                ErrorReport.NotifyUserOfProblem(exception, msg, file.PathToAnnotatedFile);
            }

            _grid.Load(annotationFile);
            _grid.SetColumnFonts(_project.TranscriptionFont, _project.FreeTranslationFont);

            _exportMenu.Enabled = (_grid.RowCount > 0);

            SetupWatchingForFileChanges();
            this.SetWindowRedraw(true);
            _videoPanel.ShowVideoThumbnailNow();
        }
        /// ------------------------------------------------------------------------------------
        public override sealed void SetComponentFile(ComponentFile file)
        {
            Deactivated();

            this.SetWindowRedraw(false);
            base.SetComponentFile(file);

            var annotationFile = (AnnotationComponentFile)file;

            _splitter.Panel1Collapsed = annotationFile.GetIsAnnotatingAudioFile();

            var exception = annotationFile.TryLoadAndReturnException();

            if (exception != null)
            {
                var msg = LocalizationManager.GetString("SessionsView.Transcription.TextAnnotationEditor.LoadingAnnotationFileErrorMsg",
                                                        "There was an error loading the annotation file '{0}'.");

                ErrorReport.NotifyUserOfProblem(exception, msg, file.PathToAnnotatedFile);
            }

            _grid.Load(annotationFile);
            _grid.SetColumnFonts(_project.TranscriptionFont, _project.FreeTranslationFont);

            // check if there are oral translation or careful speach audio files
            var annotationsDirName = annotationFile.AssociatedComponentFile.PathToAnnotatedFile + Settings.Default.OralAnnotationsFolderSuffix;

            if (Directory.Exists(annotationsDirName))
            {
                _carefulSpeachAudioExportMenuItem.Enabled   = (Directory.GetFiles(annotationsDirName, "*" + Settings.Default.OralAnnotationCarefulSegmentFileSuffix).Length > 0);
                _oralTranslationAudioExportMenuItem.Enabled = (Directory.GetFiles(annotationsDirName, "*" + Settings.Default.OralAnnotationTranslationSegmentFileSuffix).Length > 0);
            }
            else
            {
                _carefulSpeachAudioExportMenuItem.Enabled   = false;
                _oralTranslationAudioExportMenuItem.Enabled = false;
            }

            _exportMenu.Enabled = (_grid.RowCount > 0);

            SetupWatchingForFileChanges();
            this.SetWindowRedraw(true);
            _videoPanel.ShowVideoThumbnailNow();
        }