/// ------------------------------------------------------------------------------------ /// <summary> /// Reports potential data loss to the user if they could overwrite the book. /// </summary> /// <param name="originalBook">The original book.</param> /// <param name="scrDraftType">whether the draft is from a saved version or an imported /// version.</param> /// <param name="owner">The window's owner.</param> /// <param name="sDetails">The details about which verses would be deleted with an /// overwrite.</param> /// ------------------------------------------------------------------------------------ internal static void ReportDataLoss(IScrBook originalBook, ScrDraftType scrDraftType, IWin32Window owner, string sDetails) { string sType = (scrDraftType == ScrDraftType.ImportedVersion) ? Properties.Resources.kstidImported : Properties.Resources.kstidSaved; string sMsg = string.Format(Properties.Resources.kstidDataLossMsg, sType, originalBook.BestUIName, sDetails); MessageBox.Show(owner, sMsg, Properties.Resources.kstidDataLossCaption, MessageBoxButtons.OK, MessageBoxIcon.None, MessageBoxDefaultButton.Button1); }
/// -------------------------------------------------------------------------------- /// <summary> /// Confirms whether the back translations in the current book should be overwritten. /// </summary> /// <param name="originalBook">The original book.</param> /// <param name="scrDraftType">whether the draft is from a saved version or an imported /// version.</param> /// <param name="sectionsToRemove">sections that will need to be removed from this book /// before a partial overwrite can be executed (will be null unless return type is /// Partial).</param> /// <param name="missingBtWs">list of back translation writing systems that are used in /// this book but not in the savedVersion</param> /// <param name="owner">The window's owner.</param> /// <returns> /// <c>true</c> if the user wants to proceed with book overwrite; /// <c>false</c> otherwise /// </returns> /// -------------------------------------------------------------------------------- internal static bool ConfirmBtOverwrite(IScrBook originalBook, ScrDraftType scrDraftType, List <IScrSection> sectionsToRemove, HashSet <int> missingBtWs, IWin32Window owner) { string sType = (scrDraftType == ScrDraftType.ImportedVersion) ? Properties.Resources.kstidImported : Properties.Resources.kstidSaved; // Get the list of language name(s) used for back translations in the current book, // but not in the revision. string sLanguages = GetLanguageNames(originalBook.Cache, missingBtWs); // Get the Scripture data (intro and/or verses) that will be replaced. // When sectionsToRemove is null, this indicates that we want a full book overwrite. // In this case, we report all sections in the current book. string sReferences = GetScriptureReferences((sectionsToRemove != null) ? sectionsToRemove : new List <IScrSection>(originalBook.SectionsOS)); string sMsg = string.Format(Properties.Resources.kstidConfirmOverwriteBackTrans, sType, sLanguages, originalBook.Name.UserDefaultWritingSystem.Text, sReferences); return(MessageBox.Show(owner, sMsg, Properties.Resources.kstidConfirmOverwriteBackTransCaption, MessageBoxButtons.YesNo, MessageBoxIcon.None, MessageBoxDefaultButton.Button2) == DialogResult.Yes); }
/// ------------------------------------------------------------------------------------ /// <summary> /// Create an empty version (containing no books) /// </summary> /// <param name="description">Description for the saved version</param> /// <param name="type">The type of version to create (saved or imported)</param> /// ------------------------------------------------------------------------------------ public IScrDraft Create(string description, ScrDraftType type) { IScrDraft version = Create(description); version.Type = type; return version; }
/// -------------------------------------------------------------------------------- /// <summary> /// Confirms whether the back translations in the current book should be overwritten. /// </summary> /// <param name="originalBook">The original book.</param> /// <param name="scrDraftType">whether the draft is from a saved version or an imported /// version.</param> /// <param name="sectionsToRemove">sections that will need to be removed from this book /// before a partial overwrite can be executed (will be null unless return type is /// Partial).</param> /// <param name="missingBtWs">list of back translation writing systems that are used in /// this book but not in the savedVersion</param> /// <param name="owner">The window's owner.</param> /// <returns> /// <c>true</c> if the user wants to proceed with book overwrite; /// <c>false</c> otherwise /// </returns> /// -------------------------------------------------------------------------------- internal static bool ConfirmBtOverwrite(ScrBook originalBook, ScrDraftType scrDraftType, List<IScrSection> sectionsToRemove, List<int> missingBtWs, IWin32Window owner) { string sType = (scrDraftType == ScrDraftType.ImportedVersion) ? TeResourceHelper.GetResourceString("kstidImported") : TeResourceHelper.GetResourceString("kstidSaved"); // Get the list of language name(s) used for back translations in the current book, // but not in the revision. string sLanguages = GetLanguageNames(originalBook.Cache, missingBtWs); // Get the Scripture data (intro and/or verses) that will be replaced. // When sectionsToRemove is null, this indicates that we want a full book overwrite. // In this case, we report all sections in the current book. string sReferences = GetScriptureReferences((sectionsToRemove != null) ? sectionsToRemove : new List<IScrSection>(originalBook.SectionsOS)); string sMsg = TeResourceHelper.FormatResourceString("kstidConfirmOverwriteBackTrans", sType, sLanguages, originalBook.Name.UserDefaultWritingSystem, sReferences); return (MessageBox.Show(owner, sMsg, TeResourceHelper.GetResourceString("kstidConfirmOverwriteBackTransCaption"), MessageBoxButtons.YesNo, MessageBoxIcon.None, MessageBoxDefaultButton.Button2) == DialogResult.Yes); }
/// ------------------------------------------------------------------------------------ /// <summary> /// Reports potential data loss to the user if they could overwrite the book. /// </summary> /// <param name="originalBook">The original book.</param> /// <param name="scrDraftType">whether the draft is from a saved version or an imported /// version.</param> /// <param name="owner">The window's owner.</param> /// <param name="sDetails">The details about which verses would be deleted with an /// overwrite.</param> /// ------------------------------------------------------------------------------------ internal static void ReportDataLoss(ScrBook originalBook, ScrDraftType scrDraftType, IWin32Window owner, string sDetails) { string sType = (scrDraftType == ScrDraftType.ImportedVersion) ? TeResourceHelper.GetResourceString("kstidImported") : TeResourceHelper.GetResourceString("kstidSaved"); string sMsg = TeResourceHelper.FormatResourceString("kstidDataLossMsg", sType, originalBook.BestUIName, sDetails); MessageBox.Show(owner, sMsg, TeResourceHelper.GetResourceString("kstidDataLossCaption"), MessageBoxButtons.OK, MessageBoxIcon.None, MessageBoxDefaultButton.Button1); }