Esempio n. 1
0
        private bool UserWantsUpdatedContent(BookScript bookScriptFromExistingFile)
        {
            // If there is a newer version ask user if they want to get the updated version.
            GetParatextScrTextWrapperIfNeeded(true);
            if (m_paratextScrTextWrapper == null || m_paratextScrTextWrapper.GetBookChecksum(bookScriptFromExistingFile.BookNumber) == bookScriptFromExistingFile.ParatextChecksum)
            {
                return(false);
            }
            // If the updated version does NOT pass tests but the existing version does (i.e., user didn't override the checking status),
            // we'll just stick with the version we have. If they want to update it manually later, they can.
            if (m_paratextScrTextWrapper.DoesBookPassChecks(bookScriptFromExistingFile.BookNumber) && !bookScriptFromExistingFile.CheckStatusOverridden)
            {
                return(false);
            }

            var result = m_userDecisionAboutUpdatedBookContent;

            if (result == DialogResult.None)
            {
                var msg = Format(LocalizationManager.GetString("DialogBoxes.ScriptureRangeSelectionDlg.GetUpdatedContent.Msg",
                                                               "{0} has existing data for {1}. However, {2} reports that there is updated content in project {3}. " +
                                                               "Do you want {0} to use the latest content?",
                                                               "Param 0: \"Glyssen\" (product name); " +
                                                               "Param 1: 3-letter Scripture book code; " +
                                                               "Param 2: \"Paratext\" (product name); " +
                                                               "Param 3: Paratext project short name (unique project identifier)"),
                                 GlyssenInfo.kProduct,
                                 bookScriptFromExistingFile.BookId,
                                 ParatextScrTextWrapper.kParatextProgramName,
                                 m_project.ParatextProjectName);
                var applyToAllText = LocalizationManager.GetString("DialogBoxes.ScriptureRangeSelectionDlg.GetUpdatedContent.ApplyToAll",
                                                                   "Apply to all newly included books");
                using (var dlg = new YesNoApplyToAllDlg(msg, applyToAllText))
                {
                    result = dlg.ShowDialog(this);
                    if (dlg.ApplyToAll)
                    {
                        m_userDecisionAboutUpdatedBookContent = result;
                    }
                }
            }
            return(result == DialogResult.Yes);
        }