Example #1
0
		/// ------------------------------------------------------------------------------------
		/// <summary>
		/// Makes a backup (saved version) of the current version of the book in the given
		/// BookMerger if we don't already have it backed up.
		/// </summary>
		/// <remarks>This is called when the user clicks the Compare and Merge button as well as
		/// before auto-merging.</remarks>
		/// <param name="bookMerger">The book merger.</param>
		/// ------------------------------------------------------------------------------------
		public void MakeBackupIfNeeded(BookMerger bookMerger)
		{
			// Copy original to backup
			using (WaitCursor wc = new WaitCursor(this))
			{
				if (NoExistingBackup(bookMerger.BookCurr))
					m_scr.AddBookToSavedVersion(m_backupVersion, bookMerger.BookCurr);
			}
		}
Example #2
0
		/// ------------------------------------------------------------------------------------
		/// <summary>
		/// Import an Open XML for Exchanging Scripture Annotations (OXESA) file.
		/// </summary>
		/// ------------------------------------------------------------------------------------
		public bool OnFileImportOXESA(object args)
		{
			CheckDisposed();

			using (TeImportExportFileDialog dlg = new TeImportExportFileDialog(m_cache, FileType.OXESA))
			{
				if (dlg.ShowOpenDialog(null, this) == DialogResult.OK)
				{
					string sUndo, sRedo;
					TeResourceHelper.MakeUndoRedoLabels("kstidImportAnnotations", out sUndo, out sRedo);

					using (IDisposable undoHelper = new UndoTaskHelper(Cache.MainCacheAccessor,
					   null, sUndo, sRedo, false), waitCursor = new WaitCursor(this))
					{
						Exception e;
						XmlScrAnnotationsList.LoadFromFile(dlg.FileName, m_cache, m_StyleSheet, out e);
						if (e != null)
						{
							// Something went wrong while importing so let the user know.
							MessageBox.Show(string.Format(Properties.Resources.kstidOxesaImportFailedMsg, e.Message),
								Properties.Resources.kstidOxesaImportFailedTitle, MessageBoxButtons.OK, MessageBoxIcon.Error);
						}
					}
				}
			}

			return true;
		}