C# Class SIL.FieldWorks.TE.ImportWizard

The ImportWizard class guides the user through the process of establishing import settings for TE and/or for defining the project settings for shadowing or converting a Standard Format project for access by ScriptureObjects.
Inheritance: System.Windows.Forms.Form, IFWDisposable
Show file Open project: sillsdev/FieldWorks Class Usage Examples

Protected Properties

Property Type Description
cboPTBackTrans SIL.FieldWorks.Common.Controls.FwOverrideComboBox
cboPTLangProj SIL.FieldWorks.Common.Controls.FwOverrideComboBox
cboPTTransNotes SIL.FieldWorks.Common.Controls.FwOverrideComboBox
lvScrMappings SIL.FieldWorks.Common.Controls.FwListView
m_MappingDialog SIL.FieldWorks.TE.ModifyMapping
m_PTLangProjects List
m_ScriptureText ISCScriptureText
m_StyleSheet FwStyleSheet
m_btnAddNoteMapping System.Windows.Forms.Button
m_btnAddScrMapping System.Windows.Forms.Button
m_btnBack System.Windows.Forms.Button
m_btnCurrentAddButton System.Windows.Forms.Button
m_btnCurrentDeleteButton System.Windows.Forms.Button
m_btnCurrentModifyButton System.Windows.Forms.Button
m_btnDeleteNoteMapping System.Windows.Forms.Button
m_btnDeleteScrMapping System.Windows.Forms.Button
m_btnModifyNoteMapping System.Windows.Forms.Button
m_btnModifyScrMapping System.Windows.Forms.Button
m_btnNext System.Windows.Forms.Button
m_cache SIL.FieldWorks.FDO.FdoCache
m_fShowAllMappings bool
m_inlineMappingDialog SIL.FieldWorks.TE.CharacterMappingSettings
m_lvCurrentMappingList SIL.FieldWorks.Common.Controls.FwListView
m_projectType ProjectTypes
m_scr IScripture
m_settings IScrImportSet
rbOther System.Windows.Forms.RadioButton
rbParatext5 System.Windows.Forms.RadioButton
rbParatext6 System.Windows.Forms.RadioButton
sfFileListBuilder SIL.FieldWorks.Common.Controls.SFFileListBuilder

Public Methods

Method Description
CheckDisposed ( ) : void

Check to see if the object has been disposed. All public Properties and Methods should call this before doing anything else.

DisplayMappingDialog ( Form dlg ) : void

Shows the dlg modally. This is a public virtual so that test code can override it.

ImportWizard ( string langProjName, IScripture scr, FwStyleSheet styleSheet, IHelpTopicProvider helpTopicProvider, IApp app ) : System

Constructor for runtime.

Protected Methods

Method Description
DisplayInlineMappingDialog ( SIL.FieldWorks.FDO.DomainServices.ImportMappingInfo mapping ) : void

Creates (if necessary) and shows the CharacterMappingSettings dialog. This is a public virtual so that test code can override it.

Dispose ( bool disposing ) : void

Clean up any resources being used.

IsDup ( string beginMarker ) : bool

Handles the CharacterMappingsettings.IsDuplicateMapping event. Checks for duplicate begin marker, unless we're just modifying other properties of an existing one. ///

LoadMappingsFromSettings ( ) : void

This method gets all the mappings from the ScrImportSet and loads them into a list view so the user can modify them if necessary.

LoadMappingsFromSettings ( SIL.FieldWorks.Common.Controls.FwListView lv, MappingSet mappingSet ) : void

This method gets all the mappings from the ScrImportSet and loads them into a list view so the user can modify them if necessary.

OnClosing ( CancelEventArgs e ) : void

Save in the registry the dialog's location and size along with the widths of the list view columns.

OnFilesChanged ( ) : void

If there aren't any files for SFM import, this event handler prevents the user from continuing in the wizard.

OnLoad ( EventArgs e ) : void

OnPaint ( PaintEventArgs e ) : void

This will draw the the etched line that separates the dialog's buttons at the bottom from the rest of the dialog.

btnAdd_Click ( object sender, EventArgs e ) : void

Display the Add Character Mapping Settings dialog box

btnDelete_Click ( object sender, EventArgs e ) : void

lvMappings_SelectedIndexChanged ( object sender, EventArgs e ) : void

Prevent user from changing mapping for chapter and verse markers. If there are no markers at all disable modify button as well.

m_btnBack_Click ( object sender, EventArgs e ) : void

Handles the Click event of the m_btnBack control.

m_btnModify_Click ( object sender, EventArgs e ) : void

m_btnNext_Click ( object sender, EventArgs e ) : void

Handles the Click event of the m_btnNext control.

Private Methods

Method Description
CheckProjectCombo ( string projName, SIL.FieldWorks.Common.Controls.FwOverrideComboBox projCombo, ImportDomain domain ) : void

Checks the contents of the project combo. We call this after we attempt to assign the projName in the import settings to the current selection in the project combo box.

DefineImportSettings ( TypeOfImport importType ) : void

Defines the import settings given a type of import (Paratext5, Paratext6 or Other). Either we find import settings in the database or create a new set.

FindParatextProjects ( ) : bool

Loads a list with the Paratext projects on a user's system.

GetMappingDetailsAsString ( SIL.FieldWorks.FDO.DomainServices.ImportMappingInfo mapping ) : string

For the given mapping, compute a string to display in the details column of the mapping list.

GetPTShortName ( SIL.FieldWorks.Common.Controls.FwOverrideComboBox cbo ) : string

Gets the selected ParaText project short name from the selected item in a combo box list.

ImportWizard ( ) : System

Initializes the ImportWizard class.

InitializeComponent ( ) : void

Required method for Designer support - do not modify the contents of this method with the code editor.

InitializeScrImportSettings ( ) : void

Initializes the Scripture import settings object. This should be called whenever m_settings is reassigned to a new instance of the ScrImportSet class.

LoadLVMappingItem ( SIL.FieldWorks.Common.Controls.FwListView lv, SIL.FieldWorks.FDO.DomainServices.ImportMappingInfo mapping ) : System.Windows.Forms.ListViewItem

This method will add or modify a single mapping to the list view.

LoadLVMappingItem ( SIL.FieldWorks.Common.Controls.FwListView lv, System.Windows.Forms.ListViewItem item, SIL.FieldWorks.FDO.DomainServices.ImportMappingInfo mapping ) : System.Windows.Forms.ListViewItem

This method will add or modify a single mapping in the list view.

LoadParatextProjectCombo ( SIL.FieldWorks.Common.Controls.FwOverrideComboBox cbo, string selectedProj ) : void

Load the given combobox and select the selected project, if any.

LoadParatextProjectCombos ( ) : void
MappingContextMenu_Click ( object sender, EventArgs e ) : void

Process a menu item click on the context menu

MappingStyleNameAsUIString ( SIL.FieldWorks.FDO.DomainServices.ImportMappingInfo mapping ) : string

PrepareToGetOtherProjectSettings ( ) : void

This method is called after the user has chosen to import a non Paratext project (e.g. a standard format project). Prepare to get the settings for that import.

PrepareToGetParatextProjectSettings ( ) : bool

This method is called after the user has chosen to import a Paratext project. Prepare to get the settings for that import by first, making sure there are Paratext projects on the system, and if there is, loading misc. information about the projects in order for the user to specify the import settings.

RestoreWindowsSettings ( ) : void

Get, from the registry, the dialog's location and size along with the widths of the list view columns.

SetParatextProjectIds ( ) : bool

Store in the settings the Paratext projects selected in the combo boxes from the project location step, provided they are valid projects.

UpdateStepLabel ( ) : void

ValidToGoForward ( ) : bool
cboShowMappings_SelectedIndexChanged ( object sender, EventArgs e ) : void

Handles the SelectedIndexChanged event of the cboShowMappings control.

lvMappings_DoubleClick ( object sender, EventArgs e ) : void

Handles the double click on the listview. It will make it modify the item double-clicked.

lvMappings_DrawSubItem ( object sender, DrawListViewSubItemEventArgs e ) : void

Handles the DrawSubItem event of the lvMappings control.

m_btnHelp_Click ( object sender, EventArgs e ) : void

Open the help window when the help button is pressed.

m_cmMappings_Popup ( object sender, EventArgs e ) : void

Set the context menu's checked properties appropriately before showing the menu.

panStep1_VisibleChanged ( object sender, EventArgs e ) : void

panStep2_Other_VisibleChanged ( object sender, EventArgs e ) : void

Make sure the next button is disabled when the file list is empty.

panStep2_PT_VisibleChanged ( object sender, EventArgs e ) : void

Make sure the next button is disabled when there are no paratext projects available

panStep3_VisibleChanged ( object sender, EventArgs e ) : void

Fill the mappings listview with all mappings from the Paratext project(s) or SF files.

rbOther_CheckedChanged ( object sender, EventArgs e ) : void

Handles the CheckedChanged event of the rbOther control (Other USFM radio button).

rbParatext5_CheckedChanged ( object sender, EventArgs e ) : void

Handles the CheckedChanged event of the rbParatext5 control (Paratext 5 radio button).

rbParatext6_CheckedChanged ( object sender, EventArgs e ) : void

Handles the CheckedChanged event of the rbParatext6 control (Paratext 6 radio button).

tabCtrlMappings_SelectedIndexChanged ( object sender, EventArgs e ) : void

Handles the SelectedIndexChanged event of the tabCtrlMappings control.

Method Details

CheckDisposed() public method

Check to see if the object has been disposed. All public Properties and Methods should call this before doing anything else.
public CheckDisposed ( ) : void
return void

DisplayInlineMappingDialog() protected method

Creates (if necessary) and shows the CharacterMappingSettings dialog. This is a public virtual so that test code can override it.
protected DisplayInlineMappingDialog ( SIL.FieldWorks.FDO.DomainServices.ImportMappingInfo mapping ) : void
mapping SIL.FieldWorks.FDO.DomainServices.ImportMappingInfo Provides intial values displayed in dialog.
return void

DisplayMappingDialog() public method

Shows the dlg modally. This is a public virtual so that test code can override it.
public DisplayMappingDialog ( Form dlg ) : void
dlg System.Windows.Forms.Form The dialog to show
return void

Dispose() protected method

Clean up any resources being used.
protected Dispose ( bool disposing ) : void
disposing bool
return void

ImportWizard() public method

Constructor for runtime.
public ImportWizard ( string langProjName, IScripture scr, FwStyleSheet styleSheet, IHelpTopicProvider helpTopicProvider, IApp app ) : System
langProjName string Name of the lang proj.
scr IScripture The Scripture object.
styleSheet FwStyleSheet The styleSheet
helpTopicProvider IHelpTopicProvider The help topic provider.
app IApp The app.
return System

IsDup() protected method

Handles the CharacterMappingsettings.IsDuplicateMapping event. Checks for duplicate begin marker, unless we're just modifying other properties of an existing one. ///
protected IsDup ( string beginMarker ) : bool
beginMarker string
return bool

LoadMappingsFromSettings() protected method

This method gets all the mappings from the ScrImportSet and loads them into a list view so the user can modify them if necessary.
protected LoadMappingsFromSettings ( ) : void
return void

LoadMappingsFromSettings() protected method

This method gets all the mappings from the ScrImportSet and loads them into a list view so the user can modify them if necessary.
protected LoadMappingsFromSettings ( SIL.FieldWorks.Common.Controls.FwListView lv, MappingSet mappingSet ) : void
lv SIL.FieldWorks.Common.Controls.FwListView The list view to add mappings to
mappingSet MappingSet The set of mappings to add
return void

OnClosing() protected method

Save in the registry the dialog's location and size along with the widths of the list view columns.
protected OnClosing ( CancelEventArgs e ) : void
e CancelEventArgs
return void

OnFilesChanged() protected method

If there aren't any files for SFM import, this event handler prevents the user from continuing in the wizard.
protected OnFilesChanged ( ) : void
return void

OnLoad() protected method

protected OnLoad ( EventArgs e ) : void
e System.EventArgs
return void

OnPaint() protected method

This will draw the the etched line that separates the dialog's buttons at the bottom from the rest of the dialog.
protected OnPaint ( PaintEventArgs e ) : void
e PaintEventArgs
return void

btnAdd_Click() protected method

Display the Add Character Mapping Settings dialog box
protected btnAdd_Click ( object sender, EventArgs e ) : void
sender object
e System.EventArgs
return void

btnDelete_Click() protected method

protected btnDelete_Click ( object sender, EventArgs e ) : void
sender object Not used
e System.EventArgs Not used
return void

lvMappings_SelectedIndexChanged() protected method

Prevent user from changing mapping for chapter and verse markers. If there are no markers at all disable modify button as well.
protected lvMappings_SelectedIndexChanged ( object sender, EventArgs e ) : void
sender object Not used
e System.EventArgs Not used
return void

m_btnBack_Click() protected method

Handles the Click event of the m_btnBack control.
protected m_btnBack_Click ( object sender, EventArgs e ) : void
sender object The source of the event.
e System.EventArgs The instance containing the event /// data.
return void

m_btnModify_Click() protected method

protected m_btnModify_Click ( object sender, EventArgs e ) : void
sender object
e System.EventArgs
return void

m_btnNext_Click() protected method

Handles the Click event of the m_btnNext control.
protected m_btnNext_Click ( object sender, EventArgs e ) : void
sender object The source of the event.
e System.EventArgs The instance containing the event /// data.
return void

Property Details

cboPTBackTrans protected property

Protected for Tests
protected FwOverrideComboBox,SIL.FieldWorks.Common.Controls cboPTBackTrans
return SIL.FieldWorks.Common.Controls.FwOverrideComboBox

cboPTLangProj protected property

Protected for Tests
protected FwOverrideComboBox,SIL.FieldWorks.Common.Controls cboPTLangProj
return SIL.FieldWorks.Common.Controls.FwOverrideComboBox

cboPTTransNotes protected property

Protected for Tests
protected FwOverrideComboBox,SIL.FieldWorks.Common.Controls cboPTTransNotes
return SIL.FieldWorks.Common.Controls.FwOverrideComboBox

lvScrMappings protected property

Protected for Tests
protected FwListView,SIL.FieldWorks.Common.Controls lvScrMappings
return SIL.FieldWorks.Common.Controls.FwListView

m_MappingDialog protected property

The modify mappings dialog used for non-inline mappings or mappings that are "in use." We need this variable for testing purposes so that we can create a mock dialog.
protected ModifyMapping,SIL.FieldWorks.TE m_MappingDialog
return SIL.FieldWorks.TE.ModifyMapping

m_PTLangProjects protected property

protected List m_PTLangProjects
return List

m_ScriptureText protected property

protected ISCScriptureText m_ScriptureText
return ISCScriptureText

m_StyleSheet protected property

protected FwStyleSheet m_StyleSheet
return FwStyleSheet

m_btnAddNoteMapping protected property

protected Button,System.Windows.Forms m_btnAddNoteMapping
return System.Windows.Forms.Button

m_btnAddScrMapping protected property

Protected for Tests
protected Button,System.Windows.Forms m_btnAddScrMapping
return System.Windows.Forms.Button

m_btnBack protected property

Protected for Tests
protected Button,System.Windows.Forms m_btnBack
return System.Windows.Forms.Button

m_btnCurrentAddButton protected property

Either m_btnAddScrMapping or m_btnAddAnnotMapping
protected Button,System.Windows.Forms m_btnCurrentAddButton
return System.Windows.Forms.Button

m_btnCurrentDeleteButton protected property

Either m_btnDeleteScrMapping or m_btnDeleteAnnotMapping
protected Button,System.Windows.Forms m_btnCurrentDeleteButton
return System.Windows.Forms.Button

m_btnCurrentModifyButton protected property

Either m_btnModifyScrMapping or m_btnModifyAnnotMapping
protected Button,System.Windows.Forms m_btnCurrentModifyButton
return System.Windows.Forms.Button

m_btnDeleteNoteMapping protected property

protected Button,System.Windows.Forms m_btnDeleteNoteMapping
return System.Windows.Forms.Button

m_btnDeleteScrMapping protected property

protected Button,System.Windows.Forms m_btnDeleteScrMapping
return System.Windows.Forms.Button

m_btnModifyNoteMapping protected property

protected Button,System.Windows.Forms m_btnModifyNoteMapping
return System.Windows.Forms.Button

m_btnModifyScrMapping protected property

Protected for Tests
protected Button,System.Windows.Forms m_btnModifyScrMapping
return System.Windows.Forms.Button

m_btnNext protected property

Protected for Tests
protected Button,System.Windows.Forms m_btnNext
return System.Windows.Forms.Button

m_cache protected property

protected FdoCache,SIL.FieldWorks.FDO m_cache
return SIL.FieldWorks.FDO.FdoCache

m_fShowAllMappings protected property

Indicates whether to show all mappings or only those in use.
protected bool m_fShowAllMappings
return bool

m_inlineMappingDialog protected property

The modify mappings dialog used for user-created in-line mappings. We need this variable for testing purposes so that we can create a mock dialog.
protected CharacterMappingSettings,SIL.FieldWorks.TE m_inlineMappingDialog
return SIL.FieldWorks.TE.CharacterMappingSettings

m_lvCurrentMappingList protected property

Either lvScrMappings or lvAnnotationMappings
protected FwListView,SIL.FieldWorks.Common.Controls m_lvCurrentMappingList
return SIL.FieldWorks.Common.Controls.FwListView

m_projectType protected property

protected ProjectTypes m_projectType
return ProjectTypes

m_scr protected property

protected IScripture m_scr
return IScripture

m_settings protected property

current import settings retrieved from/stored in Scripture.
protected IScrImportSet m_settings
return IScrImportSet

rbOther protected property

Protected for Tests
protected RadioButton,System.Windows.Forms rbOther
return System.Windows.Forms.RadioButton

rbParatext5 protected property

Protected for Tests
protected RadioButton,System.Windows.Forms rbParatext5
return System.Windows.Forms.RadioButton

rbParatext6 protected property

Protected for Tests
protected RadioButton,System.Windows.Forms rbParatext6
return System.Windows.Forms.RadioButton

sfFileListBuilder protected property

Protected for Tests
protected SFFileListBuilder,SIL.FieldWorks.Common.Controls sfFileListBuilder
return SIL.FieldWorks.Common.Controls.SFFileListBuilder