C# Class SIL.FieldWorks.TE.TeImportManager

Helper class that manages the different aspects of import: interacting with user, settings and then delegating the real work...
Show file Open project: sillsdev/FieldWorks Class Usage Examples

Public Methods

Method Description
ImportParatext ( Form mainWnd, FwStyleSheet stylesheet, FwApp app ) : bool

Perform a Paratext streamlined import

ImportSf ( FwMainWnd mainWnd, ITeImportCallbacks importCallbacks, FwApp app ) : void

Perform the Standard Format import

ImportXml ( FwMainWnd mainWnd, ITeImportCallbacks importCallbacks, FwApp app ) : void

Import an OXES (Open XML for Editing Scripture) file.

Protected Methods

Method Description
CompleteImport ( ScrReference firstImported ) : ScrReference

Completes the import.

CreateTeImportUi ( ProgressDialogWithTask progressDialog ) : TeImportUi

Creates a TeImportUi object.

Can be overriden in tests

DisplayImportedBooksDlg ( IScrDraft backupSavedVersion ) : void

Displays the imported books dialog box (virtual to allow tests to suppress display of dialog box).

GetImportSettings ( ) : IScrImportSet

Get the settings for Import, either from database or from wizard

Import ( IScrImportSet importSettings, SIL.FieldWorks.TE.UndoImportManager undoManager, TeImportUi importUi ) : ScrReference

Calls the importer.

ImportSf ( ) : bool

Get settings for and perform the Standard Format import

ImportWithUndoTask ( IScrImportSet importSettings, bool fDisplayUi, string updateDescription ) : ScrReference

Import scripture and embed it in a Undo task so that it is undoable. Nb: this creates a Mark in the undo stack (unless no books at all are imported or an error occurs), which is designed to be 'collapsed' to after all books in the batch are imported, so we get a single Undo task for the whole Import in the end. Code (such as tests) that calls this directly should call UndoManager.CollapseAllUndoActions().

ImportXml ( ) : void

Prepare for and perform the OXES import.

ParatextProjHasUnmappedMarkers ( IScrImportSet settings ) : bool

Iterate through the ScriptureTexts' lists of tags. If any missing mappings are found return true to give the user a chance to use the ImportWizard to map everything.

ParatextProjHasUnmappedMarkers ( string sParatextProjectId ) : bool

Iterate through the ScriptureText's list of tags. If any missing mappings are found return true to give the user a chance to use the ImportWizard to map everything.

TeImportManager ( SIL.FieldWorks.FDO.FdoCache cache, FwStyleSheet styleSheet, IApp app, bool fParatextStreamlinedImport ) : System

Initializes a new instance of the TeImportManager class.

This version is for testing only

Private Methods

Method Description
DoImport ( IScrImportSet importSettings, string updateDescription ) : bool

Does the import.

GetDialogCaption ( ErrorCodeType codeType ) : string

Gets the caption for the Unable to Import message box.

ImportTask ( IProgress progressDlg, object parameters ) : object

The import task.

InternalImport ( IScrImportSet importSettings, bool fDisplayUi ) : ScrReference
SetSelectionsAfterImport ( ScrReference firstReference ) : void

Set selections after import.

TeImportManager ( Form mainWnd, FwStyleSheet styleSheet, FwApp app, bool fParatextStreamlinedImport ) : System

Initializes a new instance of the TeImportManager class.

TeImportManager ( FwMainWnd mainWnd, ITeImportCallbacks importCallbacks, FwApp app, bool fParatextStreamlinedImport ) : System

Initializes a new instance of the TeImportManager class.

Method Details

CompleteImport() protected method

Completes the import.
protected CompleteImport ( ScrReference firstImported ) : ScrReference
firstImported ScrReference The reference of the first thing that was imported
return ScrReference

CreateTeImportUi() protected method

Creates a TeImportUi object.
Can be overriden in tests
protected CreateTeImportUi ( ProgressDialogWithTask progressDialog ) : TeImportUi
progressDialog SIL.FieldWorks.Common.Controls.ProgressDialogWithTask The progress dialog.
return TeImportUi

DisplayImportedBooksDlg() protected method

Displays the imported books dialog box (virtual to allow tests to suppress display of dialog box).
protected DisplayImportedBooksDlg ( IScrDraft backupSavedVersion ) : void
backupSavedVersion IScrDraft The saved version for backups of any overwritten /// books.
return void

GetImportSettings() protected method

Get the settings for Import, either from database or from wizard
protected GetImportSettings ( ) : IScrImportSet
return IScrImportSet

Import() protected method

Calls the importer.
protected Import ( IScrImportSet importSettings, SIL.FieldWorks.TE.UndoImportManager undoManager, TeImportUi importUi ) : ScrReference
importSettings IScrImportSet The import settings.
undoManager SIL.FieldWorks.TE.UndoImportManager The undo manager.
importUi TeImportUi The import UI.
return ScrReference

ImportParatext() public static method

Perform a Paratext streamlined import
public static ImportParatext ( Form mainWnd, FwStyleSheet stylesheet, FwApp app ) : bool
mainWnd System.Windows.Forms.Form The main window.
stylesheet FwStyleSheet The Scripture stylesheet.
app SIL.FieldWorks.Common.Framework.FwApp The app.
return bool

ImportSf() protected method

Get settings for and perform the Standard Format import
protected ImportSf ( ) : bool
return bool

ImportSf() public static method

Perform the Standard Format import
public static ImportSf ( FwMainWnd mainWnd, ITeImportCallbacks importCallbacks, FwApp app ) : void
mainWnd SIL.FieldWorks.Common.Framework.FwMainWnd The main window.
importCallbacks ITeImportCallbacks The import callbacks.
app SIL.FieldWorks.Common.Framework.FwApp The app.
return void

ImportWithUndoTask() protected method

Import scripture and embed it in a Undo task so that it is undoable. Nb: this creates a Mark in the undo stack (unless no books at all are imported or an error occurs), which is designed to be 'collapsed' to after all books in the batch are imported, so we get a single Undo task for the whole Import in the end. Code (such as tests) that calls this directly should call UndoManager.CollapseAllUndoActions().
protected ImportWithUndoTask ( IScrImportSet importSettings, bool fDisplayUi, string updateDescription ) : ScrReference
importSettings IScrImportSet The SFM import settings. If null, then this is an XML import.
fDisplayUi bool set to true to display the progress dialog, /// false to run without UI.
updateDescription string description of the data update being done (i.e., /// which type of import).
return ScrReference

ImportXml() protected method

Prepare for and perform the OXES import.
protected ImportXml ( ) : void
return void

ImportXml() public static method

Import an OXES (Open XML for Editing Scripture) file.
public static ImportXml ( FwMainWnd mainWnd, ITeImportCallbacks importCallbacks, FwApp app ) : void
mainWnd SIL.FieldWorks.Common.Framework.FwMainWnd The main WND.
importCallbacks ITeImportCallbacks The import callbacks.
app SIL.FieldWorks.Common.Framework.FwApp The app.
return void

ParatextProjHasUnmappedMarkers() protected method

Iterate through the ScriptureTexts' lists of tags. If any missing mappings are found return true to give the user a chance to use the ImportWizard to map everything.
protected ParatextProjHasUnmappedMarkers ( IScrImportSet settings ) : bool
settings IScrImportSet Import settings object
return bool

ParatextProjHasUnmappedMarkers() protected method

Iterate through the ScriptureText's list of tags. If any missing mappings are found return true to give the user a chance to use the ImportWizard to map everything.
protected ParatextProjHasUnmappedMarkers ( string sParatextProjectId ) : bool
sParatextProjectId string P6 project id
return bool

TeImportManager() protected method

Initializes a new instance of the TeImportManager class.
This version is for testing only
protected TeImportManager ( SIL.FieldWorks.FDO.FdoCache cache, FwStyleSheet styleSheet, IApp app, bool fParatextStreamlinedImport ) : System
cache SIL.FieldWorks.FDO.FdoCache The cache.
styleSheet FwStyleSheet The style sheet.
app IApp The app.
fParatextStreamlinedImport bool if set to true do a Paratext /// streamlined import (minimal UI).
return System