示例#1
0
		/// ------------------------------------------------------------------------------------
		/// <summary>
		/// Display the book properties dialog
		/// </summary>
		/// <param name="args"></param>
		/// <returns>true if the message was handled</returns>
		/// ------------------------------------------------------------------------------------
		protected bool OnBookProperties(object args)
		{
			if (ActiveEditingHelper == null)
				return false;

			using (new WaitCursor(this))
			{
				// Find out which book is active.  Also make sure that there is a book to use.
				int index = ActiveEditingHelper.BookIndex;
				if (index == -1)
					index = 0;
				if (index >= BookFilter.BookCount)
					return false;
				IScrBook book = BookFilter.GetBook(index);

				// Show the book properties dialog with an undo/redo action
				string undo;
				string redo;
				TeResourceHelper.MakeUndoRedoLabels("kstidUndoRedoBookProperties", out undo, out redo);
				using (UndoableUnitOfWorkHelper undoHelper = new UndoableUnitOfWorkHelper(
					Cache.ServiceLocator.GetInstance<IActionHandler>(), undo, redo))
				{
					using (BookPropertiesDialog dlg = new BookPropertiesDialog(book, m_StyleSheet, m_app))
					{
						if (dlg.ShowDialog() == DialogResult.OK)
						{
							RefreshAllViews();
							undoHelper.RollBack = false;
						}
					}
				}
			}
			return true;
		}
示例#2
0
		/// ------------------------------------------------------------------------------------
		/// <summary>
		/// Display the book properties dialog
		/// </summary>
		/// <param name="args"></param>
		/// <returns>true if the message was handled</returns>
		/// ------------------------------------------------------------------------------------
		protected bool OnBookProperties(object args)
		{
			if (ActiveEditingHelper == null)
				return false;

			using (new WaitCursor(this))
			{
				// Find out which book is active.  Also make sure that there is a book to use.
				int index = ActiveEditingHelper.BookIndex;
				if (index == -1)
					index = 0;
				if (index >= BookFilter.BookCount)
					return false;
				ScrBook book = BookFilter.GetBook(index);

				// Show the book properties dialog with an undo/redo action
				string undo;
				string redo;
				TeResourceHelper.MakeUndoRedoLabels("kstidUndoRedoBookProperties", out undo,
					out redo);
				using (UndoTaskHelper undoTaskHelper = new UndoTaskHelper(Cache.MainCacheAccessor,
						  ActiveView.CastAsIVwRootSite(), undo, redo, true))
				{
					using (BookPropertiesDialog dlg = new BookPropertiesDialog(book, m_StyleSheet))
					{
						if (dlg.ShowDialog() == DialogResult.OK)
							RefreshAllViews();
					}
				}
			}
			return true;
		}