private void InitializeInfoView(RecordClerk clerk)
{
if (m_mediator == null)
return;
var xnWindow = (XmlNode)m_mediator.PropertyTable.GetValue("WindowConfiguration");
if (xnWindow == null)
return;
XmlNode xnControl = xnWindow.SelectSingleNode(
"controls/parameters/guicontrol[@id=\"TextInformationPane\"]/control/parameters");
if (xnControl == null)
return;
var activeClerk = m_mediator.PropertyTable.GetValue("ActiveClerk") as RecordClerk;
var toolChoice = m_mediator.PropertyTable.GetStringProperty("currentContentControl", null);
if(m_xrev != null)
{
//when re-using the infoview we want to remove and dispose of the old recordeditview and
//associated datatree. (LT-13216)
Controls.Remove(m_xrev);
m_xrev.Dispose();
}
m_xrev = new InterlinearTextsRecordEditView(this);
if (clerk.GetType().Name == "InterlinearTextsRecordClerk")
{
m_xrev.Clerk = clerk;
}
else
{
//We want to make sure that the following initialization line will initialize this
//clerk if we haven't already set it. Without this assignment to null, the InfoPane
//misbehaves in the Concordance view (it uses the filter from the InterlinearTexts view)
m_xrev.Clerk = null;
}
m_xrev.Init(m_mediator, xnControl); // <-- This call will change the ActiveClerk
DisplayCurrentRoot();
m_xrev.Dock = DockStyle.Fill;
Controls.Add(m_xrev);
// There are times when moving to the InfoPane causes the wrong ActiveClerk to be set.
// See FWR-3390 (and InterlinearTextsRecordClerk.OnDisplayInsertInterlinText).
var activeClerkNew = m_mediator.PropertyTable.GetValue("ActiveClerk") as RecordClerk;
if (toolChoice != "interlinearEdit" && activeClerk != null && activeClerk != activeClerkNew)
{
m_mediator.PropertyTable.SetProperty("ActiveClerk", activeClerk);
activeClerk.ActivateUI(true);
}
}