SIL.FieldWorks.TE.NotesMainWnd.OnInsertResponse C# (CSharp) Method

OnInsertResponse() public method

Adds a reponse to the current annotation. This really appends a response, it doesn't insert.
public OnInsertResponse ( object args ) : bool
args object
return bool
		public bool OnInsertResponse(object args)
		{
			CheckDisposed();

			IScrScriptureNote ann = CurrentAnnotation;
			if (ann == null)
				return false;

			m_dataEntryView.ExpandAnnotationIfNeeded(ann.Hvo);

			string sUndo, sRedo;
			TeResourceHelper.MakeUndoRedoLabels("kstidCreateResponse", out sUndo, out sRedo);
			using (UndoTaskHelper undoTaskHelper =
				new UndoTaskHelper(m_cache.ActionHandlerAccessor, null, sUndo, sRedo))
			{
				int iPos = ann.ResponsesOS.Count; // position where response will be inserted
				ann.CreateResponse();
				m_dataEntryView.OpenExpansionBox(ann.ResponsesOS[0].Hvo);
				m_dataEntryView.Focus();

				// Set the selection in the inserted response.
				int book = BCVRef.GetBookFromBcv(ann.BeginRef) - 1;
				int index = ann.IndexInOwner; //TODO: We actually want an index in the filtered list
				m_dataEntryView.NotesEditingHelper.MakeSelectionInNote(book, index,
					ann.ResponsesOS.Count - 1, ScrScriptureNoteTags.kflidResponses);
				undoTaskHelper.RollBack = false;
			}

			return true;
		}