Exemplo n.º 1
0
        /// ------------------------------------------------------------------------------------
        /// <summary>
        /// Ensures the specified localization is up-to-date with respect to the localization
        /// file.
        /// </summary>
        /// <param name="locale">The ICU locale for the localization to check/update.</param>
        /// <param name="scr">Scripture object (which owns the resources that store the version
        /// info.</param>
        /// <param name="app">The application (needed for error reporting info).</param>
        /// <param name="caller">The form that is calling this method (to be used as the owner
        /// of the progress dialog box).</param>
        /// ------------------------------------------------------------------------------------
        public static void EnsureCurrentLocalization(string locale, IScripture scr, FwApp app,
                                                     Form caller)
        {
            TeKeyTermsInit keyTermsInit = new TeKeyTermsInit(scr, app);

            keyTermsInit.EnsureCurrentLocalization(locale, caller, null);
        }
Exemplo n.º 2
0
        /// ------------------------------------------------------------------------------------
        /// <summary>
        /// TODO: for now, this just creates the key terms list if the list isn't in the DB...
        /// If the current key terms version in the DD doesn't match that of the current XML
        /// file, update the DB.
        /// </summary>
        /// <param name="lp">language project</param>
        /// <param name="app">The TE application.</param>
        /// <param name="existingProgressDlg">The existing progress dialog, if any.</param>
        /// ------------------------------------------------------------------------------------
        public static void EnsureCurrentKeyTerms(ILangProject lp, FwApp app,
                                                 IThreadedProgress existingProgressDlg)
        {
            TeKeyTermsInit keyTermsInit = new TeKeyTermsInit(lp.TranslatedScriptureOA, app);

            keyTermsInit.EnsureCurrentResource(existingProgressDlg);
        }
Exemplo n.º 3
0
        /// ------------------------------------------------------------------------------------
        /// <summary>
        /// Ensures all of the project components are valid.
        /// </summary>
        /// <param name="cache">The cache.</param>
        /// <param name="existingProgressDlg">The existing progress dialog.</param>
        /// ------------------------------------------------------------------------------------
        public static void EnsureProjectComponentsValid(FdoCache cache, IAdvInd4 existingProgressDlg)
        {
            EnsureProjectValid(cache, existingProgressDlg);

            // TE-8621: Don't try to upgrade the database unless we're the project server and no one is connected
            if (!MiscUtils.IsServerLocal(cache.ServerName) || cache.GetNumberOfRemoteClients() > 0)
            {
                return;
            }

            ILangProject lp = cache.LangProject;

            TePublicationsInit.EnsureFactoryPublications(lp, existingProgressDlg);
            TeStylesXmlAccessor.EnsureCurrentStylesheet(lp, existingProgressDlg);
            TeScrNoteCategoriesInit.EnsureCurrentScrNoteCategories(lp, existingProgressDlg);
            TeKeyTermsInit.EnsureCurrentKeyTerms(lp, existingProgressDlg);
            cache.Save();
        }
Exemplo n.º 4
0
        /// --------------------------------------------------------------------------------
        /// <summary>
        /// Ensures all of the project components are valid.
        /// </summary>
        /// --------------------------------------------------------------------------------
        public static void EnsureProjectComponentsValid(FdoCache cache, FwApp app,
                                                        IThreadedProgress existingProgressDlg)
        {
            EnsureProjectValid(cache, app, existingProgressDlg);

            // TE-8621: Don't try to upgrade the database unless we're the project server and no one is connected
            if (!cache.ProjectId.IsLocal || cache.NumberOfRemoteClients > 0)
            {
                return;
            }

            ILangProject lp = cache.LangProject;

            TeScrBookRefsInit.EnsureFactoryScrBookRefs(cache, existingProgressDlg);
            TePublicationsInit.EnsureFactoryPublications(lp, existingProgressDlg);
            TeStylesXmlAccessor.EnsureCurrentStylesheet(cache, existingProgressDlg, app);
            TeScrNoteCategoriesInit.EnsureCurrentScrNoteCategories(lp, existingProgressDlg);
            TeKeyTermsInit.EnsureCurrentKeyTerms(lp, app, existingProgressDlg);
        }
Exemplo n.º 5
0
        /// ------------------------------------------------------------------------------------
        /// <summary>
        /// Initializes the scripture project.
        /// </summary>
        /// <param name="progressDialog">The progress dialog.</param>
        /// <param name="parameters">The parameters.</param>
        /// <returns></returns>
        /// ------------------------------------------------------------------------------------
        private object InitializeScriptureProject(IThreadedProgress progressDialog, object[] parameters)
        {
            ILangProject lp = m_cache.LanguageProject;

            if (m_scr == null)
            {
                InitializeScriptureAndStyles(progressDialog);
            }

            // REVIEW: Since all the version-based initialization will be taken care of by a
            // subsequent call to EnsureProjectComponentsValid, we could probably get rid of this and/or
            // put it in the above block as we do with the stylesheet initialization.

            //Initialize factory publications
            if (m_scr.PublicationsOC.Count == 0)
            {
                TePublicationsInit.CreatePublicationInfo(progressDialog, m_scr);
            }

            //Initialize the key terms
            ICmPossibilityList keyTermsList = lp.KeyTermsList;

            if (keyTermsList.PossibilitiesOS.Count < 1)
            {
                TeKeyTermsInit.CreateKeyTerms(progressDialog, keyTermsList, m_app);
            }

            //Initialize the annotation categories
            if (m_scr.NoteCategoriesOA == null || m_scr.NoteCategoriesOA.PossibilitiesOS.Count == 0)
            {
                TeScrNoteCategoriesInit.CreateFactoryScrNoteCategories(progressDialog, m_scr);
            }

            // For good measure, on the off-chance the user notices.
            progressDialog.Position = progressDialog.Maximum;

            return(null);
        }
Exemplo n.º 6
0
        /// ------------------------------------------------------------------------------------
        /// <summary>
        /// Initializes the scripture project.
        /// </summary>
        /// <param name="progressDialog">The progress dialog.</param>
        /// <param name="parameters">The parameters.</param>
        /// <returns></returns>
        /// ------------------------------------------------------------------------------------
        private object InitializeScriptureProject(IAdvInd4 progressDialog, params object[] parameters)
        {
            ILangProject lp = m_cache.LangProject;

            if (m_scr == null)
            {
                m_scr = lp.TranslatedScriptureOA = new Scripture();

                //Initialize factory styles
                TeStylesXmlAccessor.CreateFactoryScrStyles(progressDialog, m_scr);

                // Initialize the separator and bridge strings.
                m_scr.ChapterVerseSepr = ":";
                m_scr.Bridge           = "-";
                m_scr.RefSepr          = ";";
                m_scr.VerseSepr        = ",";

                //Initialize misc
                m_scr.RestartFootnoteSequence        = true;
                m_scr.CrossRefsCombinedWithFootnotes = false;

                m_scr.FootnoteMarkerType       = FootnoteMarkerTypes.AutoFootnoteMarker;
                m_scr.FootnoteMarkerSymbol     = Scripture.kDefaultFootnoteMarkerSymbol;
                m_scr.DisplayFootnoteReference = false;

                m_scr.CrossRefMarkerType       = FootnoteMarkerTypes.NoFootnoteMarker;
                m_scr.CrossRefMarkerSymbol     = Scripture.kDefaultFootnoteMarkerSymbol;
                m_scr.DisplayCrossRefReference = true;
            }

            // Initialize Scripture book annotations
            if (m_scr.BookAnnotationsOS.Count == 0)
            {
                CreateScrBookAnnotations();
            }

            //Initialize Scripture Book Ref info
            if (m_cache.ScriptureReferenceSystem.BooksOS.Count == 0)
            {
                CreateScrBookRefs(progressDialog);
            }

            //Initialize factory publications
            if (m_scr.PublicationsOC.Count == 0)
            {
                TePublicationsInit.CreatePublicationInfo(progressDialog, m_scr);
            }

            //Initialize the key terms
            ICmPossibilityList keyTermsList = lp.KeyTermsList;

            if (keyTermsList.PossibilitiesOS.Count < 1)
            {
                TeKeyTermsInit.CreateKeyTerms(progressDialog, keyTermsList);
            }

            //Initialize the note categories
            if (m_scr.NoteCategoriesOA == null || m_scr.NoteCategoriesOA.PossibilitiesOS.Count == 0)
            {
                TeScrNoteCategoriesInit.CreateFactoryScrNoteCategories(progressDialog, m_scr);
            }

            m_cache.Save();

            // For good measure, on the off-chance the user notices.
            int nMin, nMax;

            progressDialog.GetRange(out nMin, out nMax);
            progressDialog.Position = nMax;

            return(null);
        }