void LaunchChooseFromMasterCategoryListOnIdle(object sender, EventArgs e)
{
Application.Idle -= LaunchChooseFromMasterCategoryListOnIdle; // now being handled
// now launch the dialog
using (MasterCategoryListDlg dlg = new MasterCategoryListDlg())
{
dlg.SetDlginfo(CategoryList, m_mediator, m_propertyTable, false, null);
switch (dlg.ShowDialog(m_parentOfPopupMgr))
{
case DialogResult.OK:
var sandboxMsa = new SandboxGenericMSA();
sandboxMsa.MainPOS = dlg.SelectedPOS;
sandboxMsa.MsaType = m_sense.GetDesiredMsaType();
UndoableUnitOfWorkHelper.Do(String.Format(LexTextControls.ksUndoSetX, FieldName),
String.Format(LexTextControls.ksRedoSetX, FieldName), m_sense, () =>
{
m_sense.SandboxMSA = sandboxMsa;
});
// Under certain circumstances (LT-11548) 'this' was disposed during the EndUndotask above!
// That's why we're now launching this on idle.
// Here's hoping we can get away without doing this! (It doesn't seem to make a difference.)
//LoadPopupTree(m_sense.MorphoSyntaxAnalysisRA.Hvo);
// everything should be setup with new node selected, so return.
break;
case DialogResult.Yes:
// represents a click on the link to create a new Grammar Category.
// Post a message so that we jump to Grammar(area)/Categories tool.
// Do this before we close any parent dialog in case
// the parent wants to check to see if such a Jump is pending.
// NOTE: We use PostMessage here, rather than SendMessage which
// disposes of the PopupTree before we and/or our parents might
// be finished using it (cf. LT-2563).
m_mediator.PostMessage("FollowLink", new FwLinkArgs("posEdit", dlg.SelectedPOS.Guid));
if (m_parentOfPopupMgr != null && m_parentOfPopupMgr.Modal)
{
// Close the dlg that opened the master POS dlg,
// since its hotlink was used to close it,
// and a new POS has been created.
m_parentOfPopupMgr.DialogResult = DialogResult.Cancel;
m_parentOfPopupMgr.Close();
}
break;
default:
// NOTE: If the user has selected "Cancel", then don't change
// our m_lastConfirmedNode to the "More..." node. Keep it
// the value set by popupTree_PopupTreeClosed() when we
// called pt.Hide() above. (cf. comments in LT-2522)
break;
}
}
}