Exemple #1
0
        /// ------------------------------------------------------------------------------------
        /// <summary>
        /// Completes the import.
        /// </summary>
        /// <param name="firstImported">The reference of the first thing that was imported</param>
        /// ------------------------------------------------------------------------------------
        protected ScrReference CompleteImport(ScrReference firstImported)
        {
            if (firstImported == null)
            {
                return(ScrReference.Empty);
            }

            // An empty first imported reference can happen if we imported just the BT.
            //Debug.Assert(!firstImported.IsEmpty, "We should have a useful reference if we imported something!");

            // Display the ImportedBooks dialog if we imported any vernacular Scripture.
            if (m_undoImportManager.ImportedBooks.Any(x => x.Value))
            {
                DisplayImportedBooksDlg(m_undoImportManager.BackupVersion);
            }

            m_undoImportManager.RemoveEmptyBackupSavedVersion();
            m_undoImportManager.CollapseAllUndoActions();
            // sync stuff
            if (m_app != null)
            {
                using (new WaitCursor(m_mainWnd))
                {
                    // Refresh all the views of all applications connected to the same DB. This
                    // will cause any needed Scripture data to be reloaded lazily.
                    m_app.Synchronize(SyncMsg.ksyncStyle);
                }
            }
            return(firstImported);
        }
Exemple #2
0
        /// ------------------------------------------------------------------------------------
        /// <summary>
        /// Completes the import.
        /// </summary>
        /// <param name="firstImported">The reference of the first thing that was imported</param>
        /// ------------------------------------------------------------------------------------
        protected ScrReference CompleteImport(ScrReference firstImported)
        {
            if (firstImported == null)
            {
                return(ScrReference.Empty);
            }

            // An ampty first imported reference can happen if we imported just the BT.
            //Debug.Assert(!firstImported.IsEmpty, "We should have a useful reference if we imported something!");

            if (m_importedSavedVersion != null && m_importedSavedVersion.BooksOS.Count > 0)
            {
                DisplayImportedBooksDlg(m_undoImportManager.BackupVersion);
                // Now re-check to see if we have any imported books left. If not, and if we didn't
                // import a partial BT either, then the net effect of this import was to do nothing.
                // So we discard our undo action altogether.
                if (m_importedSavedVersion.BooksOS.Count == 0 /* && !fPartialBtImported*/)
                {
                    m_undoImportManager.DiscardImportedVersionAndUndoActions();
                    return(ScrReference.Empty);
                }
            }

            m_undoImportManager.RemoveEmptyBackupSavedVersion();
            m_undoImportManager.CollapseAllUndoActions();
            // sync stuff
            if (FwApp.App != null)
            {
                using (new WaitCursor(m_mainWnd))
                {
                    // Refresh all the views of all applications connected to the same DB. This
                    // will cause any needed Scripture data to be reloaded lazily.
                    FwApp.App.Synchronize(new SyncInfo(SyncMsg.ksyncScriptureImport, 0, 0), m_cache);
                    FwApp.App.Synchronize(new SyncInfo(SyncMsg.ksyncStyle, 0, 0), m_cache);
                    FwApp.App.Synchronize(new SyncInfo(SyncMsg.ksyncReloadScriptureControl, 0, 0), m_cache);
                }
            }
            return(firstImported);
        }
        /// ------------------------------------------------------------------------------------
        /// <summary>
        /// Completes the import.
        /// </summary>
        /// <param name="firstImported">The reference of the first thing that was imported</param>
        /// ------------------------------------------------------------------------------------
        protected ScrReference CompleteImport(ScrReference firstImported)
        {
            if (firstImported == null)
            {
                return(ScrReference.Empty);
            }

            // An empty first imported reference can happen if we imported just the BT.
            //Debug.Assert(!firstImported.IsEmpty, "We should have a useful reference if we imported something!");

            // Display the ImportedBooks dialog if we imported any vernacular Scripture.
            if (m_undoImportManager.ImportedBooks.Any(x => x.Value))
            {
                DisplayImportedBooksDlg(m_undoImportManager.BackupVersion);
            }

            m_undoImportManager.RemoveEmptyBackupSavedVersion();
            // Keeping versions we made just for PT imports (which always entirely replace the current non-archived ones)
            // just clutters things up and makes S/R more expensive.
            if (m_fParatextStreamlinedImport)
            {
                m_undoImportManager.RemoveImportedVersion();
            }
            m_undoImportManager.CollapseAllUndoActions();
            // sync stuff
            if (m_app != null)
            {
                using (new WaitCursor(m_mainWnd))
                {
                    // Refresh all the views of all applications connected to the same DB. This
                    // will cause any needed Scripture data to be reloaded lazily.
                    m_app.Synchronize(SyncMsg.ksyncStyle);
                }
            }
            return(firstImported);
        }