/// ------------------------------------------------------------------------------------
/// <summary>
/// Toggles the visibility of the notes view.
/// </summary>
/// <param name="arg">The menu or toolbar item</param>
/// <returns><c>true</c> because we handled the message.</returns>
/// ------------------------------------------------------------------------------------
protected bool OnViewNotes(object arg)
{
NotesMainWnd notesWnd = ((TeApp)m_app).NotesWindow;
if (notesWnd == null)
{
try
{
// Make sure the user can't close the main window when bringing up the
// notes window (TE-8561)
m_app.EnableMainWindows(false);
m_syncHandler.IgnoreAnySyncMessages = true;
notesWnd = new NotesMainWnd(m_app, m_StyleSheet, DraftViewZoomPercent);
m_app.InitAndShowMainWindow(notesWnd, null);
if (!notesWnd.OnFinishedInit())
Debug.Fail("Notes window did not initialize properly");
}
finally
{
m_app.EnableMainWindows(true);
m_syncHandler.IgnoreAnySyncMessages = false;
}
((TeApp)m_app).NotesWindow = notesWnd;
RespondToSyncScrollingMsgs(true);
notesWnd.SyncHandler = m_syncHandler;
if (ActiveEditingHelper != null)
notesWnd.ScrollToScrEditingLocation(this, ActiveEditingHelper);
}
else if (arg != null)
{
// The user chose the View/Notes menu option, which is a toggle,
// so we close the existing window.
notesWnd.Close();
}
return true;
}