///------------------------------------------------------------------------------- /// <summary> /// When the Source button is clicked, display the import wizard. /// </summary> ///------------------------------------------------------------------------------- private void btnSource_Click(object sender, System.EventArgs e) { ILangProject lp = m_cache.LangProject; Scripture scr = (Scripture)lp.TranslatedScriptureOA; using (ImportWizard importWizard = new ImportWizard(lp.Name.AnalysisDefaultWritingSystem, scr, m_StyleSheet, m_cache, m_helpFile)) { if (importWizard.ShowDialog() == DialogResult.Cancel) { // Ditch any in-memory changes made to the settings. Reload from the DB. m_importSettings.RevertToSaved(); } // If there are no files after showing the wizard, close the import dialog if (InitBookNameList() == 0) { MessageBox.Show(this, DlgResources.ResourceString("kstidImportFilesUnavailable"), Application.ProductName, MessageBoxButtons.OK, MessageBoxIcon.Information); Close(); return; } // Update the file ranges for import because they may have changed. The default // set of settings may also have changed, so we re-retrieve them from the DB. m_importSettings = (ScrImportSet)scr.DefaultImportSettings; scrPsgFrom.Initialize(new ScrReference(StartRef, scr.Versification), scr, m_importSettings.BooksForProject.ToArray()); scrPsgTo.Initialize(new ScrReference(EndRef, scr.Versification), scr, m_importSettings.BooksForProject.ToArray()); // 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(); }