private void btnSource_Click(object sender, System.EventArgs e)
{
using (ImportWizard importWizard = new ImportWizard(m_scr.Cache.ProjectId.Name,
m_scr, m_StyleSheet, m_helpTopicProvider, m_app))
{
using (NonUndoableUnitOfWorkHelper undoHelper = new NonUndoableUnitOfWorkHelper(ActionHandler))
{
if (importWizard.ShowDialog() == DialogResult.Cancel)
{
// Ditch any in-memory changes made to the settings. Reload from the DB.
m_importSettings.RevertToSaved();
}
else
undoHelper.RollBack = false;
}
// If there are no files after showing the wizard, close the import dialog
if (InitBookNameList() == 0)
{
MessageBox.Show(this, DlgResources.ResourceString("kstidImportFilesUnavailable"),
m_app.ApplicationName, MessageBoxButtons.OK, MessageBoxIcon.Information);
Close();
return;
}
// The default set of settings may have changed.
m_importSettings = m_scr.DefaultImportSettings;
// Update the file ranges for import because they may have changed.
InitializeStartAndEndRefControls();
// Update the passage controls to reflect the new range of files available
// Only make changes that do not expand the available range of books since a
// range may have been specified before the wizard was run that we do not
// want to overwrite
if (!scrPsgFrom.IsReferenceValid(scrPsgFrom.ScReference))
SetStartRefToFirstImportableBook();
if (!scrPsgTo.IsReferenceValid(scrPsgTo.ScReference))
SetEndRefToLastImportableBook();
}
btnOK.Focus();
}