ClearDialogReferences() public static method

Clears the starting and ending references in this dialog.
public static ClearDialogReferences ( ) : void
return void
Esempio n. 1
0
        /// ------------------------------------------------------------------------------------
        /// <summary>
        /// Get the settings for Import, either from database or from wizard
        /// </summary>
        /// <returns>Import settings, or <c>null</c> if user canceled dialog.</returns>
        /// ------------------------------------------------------------------------------------
        protected ScrImportSet GetImportSettings()
        {
            ILangProject proj           = m_cache.LangProject;
            Scripture    scr            = (Scripture)proj.TranslatedScriptureOA;
            ScrImportSet importSettings = new ScrImportSet(m_cache, scr.DefaultImportSettingsHvo,
                                                           m_styleSheet, FwApp.App.HelpFile);

            importSettings.OverlappingFileResolver = new ConfirmOverlappingFileReplaceDialog();
            if (!importSettings.BasicSettingsExist)
            {
                // REVIEW DavidO: Should I use AnalysisDefaultWritingSystem or
                // VernacularDefaultWritingSystem or something else.
                using (ImportWizard importWizard = new ImportWizard(proj.Name.UserDefaultWritingSystem,
                                                                    scr, m_styleSheet, m_cache, FwApp.App.HelpFile))
                {
                    if (importWizard.ShowDialog() == DialogResult.Cancel)
                    {
                        return(null);
                    }
                    // Scripture reference range may have changed
                    ImportDialog.ClearDialogReferences(m_cache);
                    importSettings = (ScrImportSet)scr.DefaultImportSettings;
                }
            }
            else
            {
                StringCollection sInvalidFiles;
                bool             fCompletedWizard = false;
                while (!importSettings.ImportProjectIsAccessible(out sInvalidFiles))
                {
                    // Display the "Project Not Found" message box
                    using (ScrImportSetMessage dlg = new ScrImportSetMessage())
                    {
                        string[] files = new string[sInvalidFiles.Count];
                        sInvalidFiles.CopyTo(files, 0);
                        dlg.InvalidFiles       = files;
                        dlg.HelpURL            = FwApp.App.HelpFile;
                        dlg.HelpTopic          = "/Beginning_Tasks/Import_Standard_Format/Project_Files_Unavailable.htm";
                        dlg.DisplaySetupOption = true;
                        switch (dlg.ShowDialog())
                        {
                        case DialogResult.OK:                                 // Setup...
                        {
                            using (ImportWizard importWizard = new ImportWizard(
                                       proj.Name.UserDefaultWritingSystem, scr, m_styleSheet, m_cache,
                                       FwApp.App.HelpFile))
                            {
                                if (importWizard.ShowDialog() == DialogResult.Cancel)
                                {
                                    return(null);
                                }
                                // Scripture reference range may have changed
                                ImportDialog.ClearDialogReferences(m_cache);
                                importSettings   = (ScrImportSet)scr.DefaultImportSettings;
                                fCompletedWizard = true;
                            }
                            break;
                        }

                        case DialogResult.Cancel:
                            return(null);

                        case DialogResult.Retry:
                            // Loop around until user gets tired.
                            break;
                        }
                    }
                }
                if (!fCompletedWizard)
                {
                    if (ParatextProjHasUnmappedMarkers(importSettings))
                    {
                        // TODO: Show message box and then bring up import wizard
                    }
                }
            }

            return(importSettings);
        }
Esempio n. 2
0
        /// ------------------------------------------------------------------------------------
        /// <summary>
        /// Get the settings for Import, either from database or from wizard
        /// </summary>
        /// <returns>Import settings, or <c>null</c> if user canceled dialog.</returns>
        /// ------------------------------------------------------------------------------------
        protected IScrImportSet GetImportSettings()
        {
            ILangProject  proj           = m_cache.LangProject;
            IScripture    scr            = proj.TranslatedScriptureOA;
            IScrImportSet importSettings = null;

            NonUndoableUnitOfWorkHelper.Do(m_cache.ActionHandlerAccessor, () =>
            {
                importSettings =
                    scr.FindOrCreateDefaultImportSettings(TypeOfImport.Unknown);
            });
            importSettings.StyleSheet = m_styleSheet;

            importSettings.OverlappingFileResolver = new ConfirmOverlappingFileReplaceDialog(m_helpTopicProvider);
            if (!importSettings.BasicSettingsExist)
            {
                using (NonUndoableUnitOfWorkHelper undoHelper = new NonUndoableUnitOfWorkHelper(
                           m_cache.ServiceLocator.GetInstance <IActionHandler>()))
                {
                    using (ImportWizard importWizard = new ImportWizard(m_cache.ProjectId.Name,
                                                                        scr, m_styleSheet, m_helpTopicProvider, m_app))
                    {
                        if (importWizard.ShowDialog() == DialogResult.Cancel)
                        {
                            return(null);
                        }
                        // Scripture reference range may have changed
                        ImportDialog.ClearDialogReferences();
                        importSettings = scr.DefaultImportSettings;
                    }
                    undoHelper.RollBack = false;
                }
            }
            else
            {
                StringCollection sInvalidFiles;
                bool             fCompletedWizard = false;
                while (!importSettings.ImportProjectIsAccessible(out sInvalidFiles))
                {
                    // Display the "Project Not Found" message box
                    using (ScrImportSetMessage dlg = new ScrImportSetMessage())
                    {
                        string[] files = new string[sInvalidFiles.Count];
                        sInvalidFiles.CopyTo(files, 0);
                        dlg.InvalidFiles       = files;
                        dlg.HelpURL            = m_helpTopicProvider.HelpFile;
                        dlg.HelpTopic          = "/Beginning_Tasks/Import_Standard_Format/Project_Files_Unavailable.htm";
                        dlg.DisplaySetupOption = true;
                        switch (dlg.ShowDialog())
                        {
                        case DialogResult.OK:                                 // Setup...
                        {
                            using (NonUndoableUnitOfWorkHelper undoHelper = new NonUndoableUnitOfWorkHelper(
                                       m_cache.ServiceLocator.GetInstance <IActionHandler>()))
                            {
                                using (ImportWizard importWizard = new ImportWizard(
                                           m_cache.ProjectId.Name, scr, m_styleSheet, m_helpTopicProvider, m_app))
                                {
                                    if (importWizard.ShowDialog() == DialogResult.Cancel)
                                    {
                                        return(null);
                                    }
                                    // Scripture reference range may have changed
                                    ImportDialog.ClearDialogReferences();
                                    importSettings   = scr.DefaultImportSettings;
                                    fCompletedWizard = true;
                                }
                                undoHelper.RollBack = false;
                            }
                            break;
                        }

                        case DialogResult.Cancel:
                            return(null);

                        case DialogResult.Retry:
                            // Loop around until user gets tired.
                            break;
                        }
                    }
                }
                if (!fCompletedWizard)
                {
                    if (ParatextProjHasUnmappedMarkers(importSettings))
                    {
                        // TODO: Show message box and then bring up import wizard
                    }
                }
            }

            return(importSettings);
        }