Esempio n. 1
0
        /// ------------------------------------------------------------------------------------
        /// <summary>
        /// Get settings for and perform the Standard Format import
        /// </summary>
        /// <returns><c>true</c> if something got imported; <c>false</c> otherwise</returns>
        /// ------------------------------------------------------------------------------------
        protected bool ImportSf()
        {
            IScrImportSet importSettings;

            if (m_fParatextStreamlinedImport)
            {
                importSettings = m_cache.LangProject.TranslatedScriptureOA.FindImportSettings(TypeOfImport.Paratext6);
                if (importSettings == null)
                {
                    throw new InvalidOperationException("Caller must set import settings before attempting a streamlined Paratext import");
                }
            }
            else
            {
                using (new WaitCursor(m_mainWnd))
                {
                    importSettings = GetImportSettings();
                }
                if (importSettings == null)                 // User cancelled in import wizard
                {
                    return(false);
                }

                // Display ImportDialog
                using (ImportDialog importDlg = new ImportDialog(m_styleSheet, m_cache,
                                                                 importSettings, m_helpTopicProvider, m_app))
                {
                    importDlg.ShowDialog(m_mainWnd);
                    if (importDlg.DialogResult == DialogResult.Cancel)
                    {
                        Logger.WriteEvent("User canceled import dialog");
                        return(false);
                    }
                    // Settings could have changed if the user went into the wizard.
                    importSettings = importDlg.ImportSettings;
                }
            }

            return(DoImport(importSettings, "ImportStandardFormat"));
        }
Esempio n. 2
0
        /// ------------------------------------------------------------------------------------
        /// <summary>
        /// Get settings for and perform the Standard Format import
        /// </summary>
        /// ------------------------------------------------------------------------------------
        protected void ImportSf()
        {
            ScrImportSet importSettings = null;

            // Prevent creation of undo task.
            using (new SuppressSubTasks(m_cache))
            {
                using (new WaitCursor(m_mainWnd))
                {
                    importSettings = GetImportSettings();
                }
                if (importSettings == null)                 // User cancelled in import wizard
                {
                    return;
                }

                // Display ImportDialog
                using (ImportDialog importDlg = new ImportDialog(m_styleSheet, m_cache,
                                                                 importSettings, FwApp.App.HelpFile))
                {
                    importDlg.ShowDialog(m_mainWnd);
                    if (importDlg.DialogResult == DialogResult.Cancel)
                    {
                        Logger.WriteEvent("User canceled import dialog");
                        return;
                    }
                    // Settings could have changed if the user went into the wizard.
                    importSettings = importDlg.ImportSettings;
                }
                if (!m_importCallbacks.EncourageBackup())
                {
                    Logger.WriteEvent("Import canceled in encourage backup dialog");
                    return;
                }
            }

            DoImport(importSettings, "ImportStandardFormat");
        }
Esempio n. 3
0
		/// ------------------------------------------------------------------------------------
		/// <summary>
		/// Get settings for and perform the Standard Format import
		/// </summary>
		/// <returns><c>true</c> if something got imported; <c>false</c> otherwise</returns>
		/// ------------------------------------------------------------------------------------
		protected bool ImportSf()
		{
			IScrImportSet importSettings;

			if (m_fParatextStreamlinedImport)
			{
				importSettings = m_cache.LangProject.TranslatedScriptureOA.FindImportSettings(TypeOfImport.Paratext6);
				if (importSettings == null)
					throw new InvalidOperationException("Caller must set import settings before attempting a streamlined Paratext import");
			}
			else
			{
				using (new WaitCursor(m_mainWnd))
				{
					importSettings = GetImportSettings();
				}
				if (importSettings == null) // User cancelled in import wizard
					return false;

				// Display ImportDialog
				using (ImportDialog importDlg = new ImportDialog(m_styleSheet, m_cache,
					importSettings, m_helpTopicProvider, m_app))
				{
					importDlg.ShowDialog(m_mainWnd);
					if (importDlg.DialogResult == DialogResult.Cancel)
					{
						Logger.WriteEvent("User canceled import dialog");
						return false;
					}
					// Settings could have changed if the user went into the wizard.
					importSettings = importDlg.ImportSettings;
				}
			}

			return DoImport(importSettings, "ImportStandardFormat");
		}
Esempio n. 4
0
		/// ------------------------------------------------------------------------------------
		/// <summary>
		/// Get settings for and perform the Standard Format import
		/// </summary>
		/// ------------------------------------------------------------------------------------
		protected void ImportSf()
		{
			ScrImportSet importSettings = null;

			// Prevent creation of undo task.
			using (new SuppressSubTasks(m_cache))
			{
				using (new WaitCursor(m_mainWnd))
				{
					importSettings = GetImportSettings();
				}
				if (importSettings == null) // User cancelled in import wizard
					return;

				// Display ImportDialog
				using (ImportDialog importDlg = new ImportDialog(m_styleSheet, m_cache,
					importSettings, FwApp.App.HelpFile))
				{
					importDlg.ShowDialog(m_mainWnd);
					if (importDlg.DialogResult == DialogResult.Cancel)
					{
						Logger.WriteEvent("User canceled import dialog");
						return;
					}
					// Settings could have changed if the user went into the wizard.
					importSettings = importDlg.ImportSettings;
				}
				if (!m_importCallbacks.EncourageBackup())
				{
					Logger.WriteEvent("Import canceled in encourage backup dialog");
					return;
				}
			}

			DoImport(importSettings, "ImportStandardFormat");
		}