/// ------------------------------------------------------------------------------------ /// <summary> /// If the current stylesheet version in the Db doesn't match that of the current XML /// file, update the DB. /// </summary> /// <param name="lp">The language project</param> /// <param name="progressDlg">The progress dialog.</param> /// ------------------------------------------------------------------------------------ public static void EnsureCurrentStylesheet(ILangProject lp, IThreadedProgress progressDlg) { // We don't need to establish a NonUndoableUnitOfWork here because caller has already // done it and if not, the internal code of StylesXmlAccessor will do it for us. var acc = new FlexStylesXmlAccessor(lp.LexDbOA); acc.EnsureCurrentResource(progressDlg); }
/// ------------------------------------------------------------------------------------- /// <summary> /// If the current stylesheet version in the Db doesn't match that of the current XML /// file, update the DB. /// </summary> /// <param name="lp">The language project</param> /// ------------------------------------------------------------------------------------- public static void EnsureCurrentStylesheet(ILangProject lp) { FlexStylesXmlAccessor acc = new FlexStylesXmlAccessor(lp.LexDbOA); // TODO: consider passing progress dialog from SplashScreen if splash screen // is showing. acc.EnsureCurrentResource(null); }
private void SafelyEnsureStyleSheetPostTERemoval(IThreadedProgress progressDlg) { // Ensure that we have up-to-date versification information so that projects with old TE styles // will be able to migrate them from the Scripture area to the LanguageProject model ScrReference.InitializeVersification(FwDirectoryFinder.EditorialChecksDirectory, false); // Make sure this DB uses the current stylesheet version // Suppress adjusting scripture sections since isn't safe to do so at this point SectionAdjustmentSuppressionHelper.Do(() => FlexStylesXmlAccessor.EnsureCurrentStylesheet(Cache.LangProject, progressDlg)); }
/// <summary> /// App-specific initialization of the cache. /// </summary> /// <param name="progressDlg">The progress dialog.</param> /// <returns>True if the initialize was successful, false otherwise</returns> public override bool InitCacheForApp(IProgress progressDlg) { Cache.ServiceLocator.DataSetup.LoadDomainAsync(BackendBulkLoadDomain.All); AddDefaultWordformingOverridesIfNeeded(); // The try-catch block is modeled after that used by TeScrInitializer.Initialize(), // as the suggestion for fixing LT-8797. try { // Make sure this DB uses the current stylesheet version. if (Cache.ProjectId.IsLocal && Cache.NumberOfRemoteClients == 0) { FlexStylesXmlAccessor.EnsureCurrentStylesheet(Cache.LangProject, progressDlg); } } catch (WorkerThreadException e) { MessageBox.Show(Form.ActiveForm, e.InnerException.Message, ApplicationName, MessageBoxButtons.OK, MessageBoxIcon.Error); return(false); } return(true); }
/// ------------------------------------------------------------------------------------ /// <summary> /// If the current stylesheet version in the Db doesn't match that of the current XML /// file, update the DB. /// </summary> /// <param name="lp">The language project</param> /// <param name="progressDlg">The progress dialog.</param> /// ------------------------------------------------------------------------------------ public static void EnsureCurrentStylesheet(ILangProject lp, IThreadedProgress progressDlg) { // We don't need to establish a NonUndoableUnitOfWork here because caller has already // done it and if not, the internal code of StylesXmlAccessor will do it for us. var acc = new FlexStylesXmlAccessor(lp.LexDbOA); acc.EnsureCurrentResource(progressDlg); }
/// ------------------------------------------------------------------------------------- /// <summary> /// If the current stylesheet version in the Db doesn't match that of the current XML /// file, update the DB. /// </summary> /// <param name="lp">The language project</param> /// ------------------------------------------------------------------------------------- public static void EnsureCurrentStylesheet(ILangProject lp) { FlexStylesXmlAccessor acc = new FlexStylesXmlAccessor(lp.LexDbOA); // TODO: consider passing progress dialog from SplashScreen if splash screen // is showing. acc.EnsureCurrentResource(null); }
protected override Form NewMainAppWnd(FdoCache cache, bool isNewCache, Form wndCopyFrom, bool fOpeningNewProject) { WriteSplashScreen(String.Format(LexTextStrings.ksCreatingWindowForX, cache.DatabaseName)); // The try-catch block is modeled after that used by TeScrInitializer.Initialize(), // as the suggestion for fixing LT-8797. try { // Make sure this DB uses the current stylesheet version. if (MiscUtils.IsServerLocal(cache.ServerName) && cache.GetNumberOfRemoteClients() == 0) { FlexStylesXmlAccessor.EnsureCurrentStylesheet(cache.LangProject); } } catch (WorkerThreadException e) { UndoResult ures; while (cache.Undo(out ures)) { ; // Enhance JohnT: make use of ures? } MessageBox.Show(Form.ActiveForm, e.InnerException.Message, LexTextStrings.ksFieldWorksLanguageExplorer, MessageBoxButtons.OK, MessageBoxIcon.Error); return(null); } Form form = base.NewMainAppWnd(cache, isNewCache, wndCopyFrom, fOpeningNewProject); // Ensure that all the relevant writing systems are installed. if (isNewCache) { ILangProject lp = cache.LangProject; // Loop through the Vernacular WS and initialize them foreach (ILgWritingSystem ws in lp.VernWssRC) { cache.LanguageWritingSystemFactoryAccessor.get_EngineOrNull(ws.Hvo); } // Loop through the Analysis WS and initialize them foreach (ILgWritingSystem ws in lp.AnalysisWssRC) { cache.LanguageWritingSystemFactoryAccessor.get_EngineOrNull(ws.Hvo); } } cache.Save(); if (form != null && form is FwXWindow) { FwXWindow wnd = form as FwXWindow; wnd.Mediator.BroadcastPendingItems(); IFwCheckAnthroList fcal = FwCheckAnthroListClass.Create(); string sDesc = wnd.Mediator.StringTbl.GetString("AnthroListUse", "DialogStrings"); fcal.Description = sDesc; string sHelpFile = HelpFile; fcal.HelpFilename = sHelpFile; fcal.CheckAnthroList(wnd.Cache.DatabaseAccessor, (uint)form.Handle, wnd.Cache.LangProject.Name.UserDefaultWritingSystem, wnd.Cache.DefaultUserWs); m_activeMainWindow = form; } if (isNewCache && form != null) { InitializePartInventories(cache, true); } return(form); }