SIL.FieldWorks.LexText.Controls.MasterCategoryListDlg.SetDlginfo C# (CSharp) Method

SetDlginfo() public method

public SetDlginfo ( ICmPossibilityList posList, XCore.Mediator mediator, bool launchedFromInsertMenu, IPartOfSpeech subItemOwner ) : void
posList ICmPossibilityList
mediator XCore.Mediator
launchedFromInsertMenu bool
subItemOwner IPartOfSpeech
return void
		public void SetDlginfo(ICmPossibilityList posList, Mediator mediator, bool launchedFromInsertMenu, IPartOfSpeech subItemOwner)
		{
			CheckDisposed();

			m_subItemOwner = subItemOwner; // May be null, which is fine.
			m_posList = posList;
			m_launchedFromInsertMenu = launchedFromInsertMenu;
			m_mediator = mediator;
			if (mediator != null)
			{
				// Reset window location.
				// Get location to the stored values, if any.
				object locWnd = m_mediator.PropertyTable.GetValue("masterCatListDlgLocation");
				object szWnd = m_mediator.PropertyTable.GetValue("masterCatListDlgSize");
				if (locWnd != null && szWnd != null)
				{
					Rectangle rect = new Rectangle((Point)locWnd, (Size)szWnd);
					ScreenUtils.EnsureVisibleRect(ref rect);
					DesktopBounds = rect;
					StartPosition = FormStartPosition.Manual;
				}
				m_helpTopicProvider = m_mediator.HelpTopicProvider;
				if (m_helpTopicProvider != null)
				{
					helpProvider = new HelpProvider();
					helpProvider.HelpNamespace = m_helpTopicProvider.HelpFile;
					helpProvider.SetHelpKeyword(this, m_helpTopicProvider.GetHelpString(s_helpTopic));
					helpProvider.SetHelpNavigator(this, HelpNavigator.Topic);
				}
			}
			m_bnHelp.Enabled = (m_helpTopicProvider != null);

			Debug.Assert(posList != null);
			m_cache = posList.Cache;
			var posSet = new Set<IPartOfSpeech>();
			foreach (IPartOfSpeech pos in posList.ReallyReallyAllPossibilities)
				posSet.Add(pos);
			LoadMasterCategories(posSet);
		}

Usage Example

示例#1
0
        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;
                }
            }
        }
All Usage Examples Of SIL.FieldWorks.LexText.Controls.MasterCategoryListDlg::SetDlginfo