Пример #1
0
		/// ------------------------------------------------------------------------------------
		/// <summary>
		/// Ends the inserting verse numbers mode
		/// </summary>
		/// ------------------------------------------------------------------------------------
		public void EndInsertVerseNumbers()
		{
			CheckDisposed();

			DefaultCursor = m_restoreCursor;
			Application.RemoveMessageFilter(m_InsertVerseMessageFilter);
			m_InsertVerseMessageFilter = null;
			SelectionChanged(Callbacks.EditedRootBox, Callbacks.EditedRootBox.Selection);
		}
Пример #2
0
		/// <summary>
		/// Executes in two distinct scenarios.
		///
		/// 1. If disposing is true, the method has been called directly
		/// or indirectly by a user's code via the Dispose method.
		/// Both managed and unmanaged resources can be disposed.
		///
		/// 2. If disposing is false, the method has been called by the
		/// runtime from inside the finalizer and you should not reference (access)
		/// other managed objects, as they already have been garbage collected.
		/// Only unmanaged resources can be disposed.
		/// </summary>
		/// <param name="disposing"></param>
		/// <remarks>
		/// If any exceptions are thrown, that is fine.
		/// If the method is being done in a finalizer, it will be ignored.
		/// If it is thrown by client code calling Dispose,
		/// it needs to be handled by fixing the bug.
		///
		/// If subclasses override this method, they should call the base implementation.
		/// </remarks>
		protected override void Dispose(bool disposing)
		{
			//Debug.WriteLineIf(!disposing, "****************** " + GetType().Name + " 'disposing' is false. ******************");
			// Must not be run more than once.
			if (IsDisposed)
			{
				Debug.Assert(m_cpe == null);
				return;
			}

			if (disposing)
			{
				// Log disposing event - removed logging as part of fix for TE-6551
				//string message = "Disposing TeEditingHelper...\n" +
				//    "Stack Trace:\n" + Environment.StackTrace;
				//SIL.Utils.Logger.WriteEvent(message);

				// Dispose managed resources here.
				if (m_InsertVerseMessageFilter != null)
					Application.RemoveMessageFilter(m_InsertVerseMessageFilter);

				if (m_syncHandler != null)
				{
					m_syncHandler.ReferenceChanged -= ScrollToReference;
					m_syncHandler.AnnotationChanged -= ScrollToCitedText;
					m_syncHandler.Dispose();
				}

				if (m_annotationAdjuster != null)
					m_annotationAdjuster.Dispose();
			}

			// Dispose unmanaged resources here, whether disposing is true or false.
			PasteFixTssEvent -= RemoveHardFormatting;
			m_syncHandler = null;
			m_scr = null;
			m_bookFilter = null;
			m_InsertVerseMessageFilter = null;
			m_restoreCursor = null;
			m_lastFootnoteTextRepSelection = null;
			m_oldReference = null;
			if (m_cpe != null)
			{
				if (Marshal.IsComObject(m_cpe))
					Marshal.ReleaseComObject(m_cpe);
				m_cpe = null;
			}
			m_annotationAdjuster = null;
			base.Dispose(disposing);
		}
Пример #3
0
		/// ------------------------------------------------------------------------------------
		/// <summary>
		/// Process the InsertVerseNumbers request.
		/// </summary>
		/// <param name="currentStateEnabled">current state of the insert verse numbers
		/// mode</param>
		/// ------------------------------------------------------------------------------------
		public void ProcessInsertVerseNumbers(bool currentStateEnabled)
		{
			CheckDisposed();

			if (currentStateEnabled)
				EndInsertVerseNumbers();
			else
			{
				// Enter InsertVerseNumbers mode.
				m_restoreCursor = DefaultCursor;
				DefaultCursor = TeResourceHelper.InsertVerseCursor;
				// don't re-add a message filter if verse number mode was already on
				if (!InsertVerseActive)
				{
					m_InsertVerseMessageFilter = new InsertVerseMessageFilter(Control, this);
					Application.AddMessageFilter(m_InsertVerseMessageFilter);
				}
			}
		}
Пример #4
0
		/// <summary>
		/// Executes in two distinct scenarios.
		///
		/// 1. If disposing is true, the method has been called directly
		/// or indirectly by a user's code via the Dispose method.
		/// Both managed and unmanaged resources can be disposed.
		///
		/// 2. If disposing is false, the method has been called by the
		/// runtime from inside the finalizer and you should not reference (access)
		/// other managed objects, as they already have been garbage collected.
		/// Only unmanaged resources can be disposed.
		/// </summary>
		/// <param name="disposing"></param>
		/// <remarks>
		/// If any exceptions are thrown, that is fine.
		/// If the method is being done in a finalizer, it will be ignored.
		/// If it is thrown by client code calling Dispose,
		/// it needs to be handled by fixing the bug.
		///
		/// If subclasses override this method, they should call the base implementation.
		/// </remarks>
		protected override void Dispose(bool disposing)
		{
			// Must not be run more than once.
			if (IsDisposed)
			{
				Debug.Assert(m_cpe == null);
				return;
			}

			if (disposing)
			{
				// Log disposing event - removed logging as part of fix for TE-6551
				//string message = "Disposing TeEditingHelper...\n" +
				//    "Stack Trace:\n" + Environment.StackTrace;
				//SIL.Utils.Logger.WriteEvent(message);

				// Dispose managed resources here.
				if (m_InsertVerseMessageFilter != null)
					Application.RemoveMessageFilter(m_InsertVerseMessageFilter);
			}

			// Dispose unmanaged resources here, whether disposing is true or false.
			PasteFixTssEvent -= RemoveHardFormatting;
			m_scr = null;
			m_bookFilter = null;
			m_InsertVerseMessageFilter = null;
			m_restoreCursor = null;
			m_lastFootnoteTextRepSelection = null;
			m_oldReference = null;
				m_cpe = null;

			base.Dispose(disposing);
		}