Exemplo n.º 1
0
        /// <summary>
        /// Override method to handle launching of a chooser for selecting lexical entries.
        /// </summary>
        protected override void HandleChooser()
        {
            ILexRefType lrt = LexRefType.CreateFromDBObject(m_cache, m_obj.OwnerHVO);

            LexRefType.MappingTypes type = (LexRefType.MappingTypes)lrt.MappingType;
            BaseGoDlg dlg = null;

            switch (type)
            {
            case LexRefType.MappingTypes.kmtSensePair:
            case LexRefType.MappingTypes.kmtSenseAsymmetricPair:                     // Sense pair with different Forward/Reverse names
                dlg = new LinkEntryOrSenseDlg();
                (dlg as LinkEntryOrSenseDlg).SelectSensesOnly = true;
                break;

            case LexRefType.MappingTypes.kmtEntryPair:
            case LexRefType.MappingTypes.kmtEntryAsymmetricPair:                     // Entry pair with different Forward/Reverse names
                dlg = new GoDlg();
                break;

            case LexRefType.MappingTypes.kmtEntryOrSensePair:
            case LexRefType.MappingTypes.kmtEntryOrSenseAsymmetricPair:                     // Entry or sense pair with different Forward/Reverse
                dlg = new LinkEntryOrSenseDlg();
                (dlg as LinkEntryOrSenseDlg).SelectSensesOnly = false;
                break;
            }
            Debug.Assert(dlg != null);
            WindowParams wp = new WindowParams();

            //on creating Pair Lexical Relation have an Add button and Add in the title bar
            if (TargetHvo == 0)
            {
                wp.m_title = String.Format(LexEdStrings.ksIdentifyXEntry,
                                           lrt.Name.AnalysisDefaultWritingSystem);
                wp.m_btnText = LexEdStrings.ks_Add;
            }
            else             //Otherwise we are Replacing the item
            {
                wp.m_title   = String.Format(LexEdStrings.ksReplaceXEntry);
                wp.m_btnText = LexEdStrings.ks_Replace;
            }

            wp.m_label = LexEdStrings.ksFind_;

            dlg.SetDlgInfo(m_cache, wp, m_mediator);
            dlg.SetHelpTopic("khtpChooseLexicalRelationAdd");
            if (dlg.ShowDialog(FindForm()) == DialogResult.OK)
            {
                TargetHvo = dlg.SelectedID;
            }
            dlg.Dispose();
        }
        /// <summary>
        /// Override method to handle launching of a chooser for selecting lexical entries.
        /// </summary>
        protected override void HandleChooser()
        {
            var       lrt    = (ILexRefType)m_obj.Owner;
            var       type   = (LexRefTypeTags.MappingTypes)lrt.MappingType;
            BaseGoDlg dlg    = null;
            string    sTitle = string.Empty;

            try
            {
                switch (type)
                {
                case LexRefTypeTags.MappingTypes.kmtSenseCollection:
                    dlg = new LinkEntryOrSenseDlg();
                    (dlg as LinkEntryOrSenseDlg).SelectSensesOnly = true;
                    sTitle = String.Format(LexEdStrings.ksIdentifyXSense,
                                           lrt.Name.BestAnalysisAlternative.Text);
                    break;

                case LexRefTypeTags.MappingTypes.kmtEntryCollection:
                    dlg    = new EntryGoDlg();
                    sTitle = String.Format(LexEdStrings.ksIdentifyXLexEntry,
                                           lrt.Name.BestAnalysisAlternative.Text);
                    break;

                case LexRefTypeTags.MappingTypes.kmtEntryOrSenseCollection:
                    dlg    = new LinkEntryOrSenseDlg();
                    sTitle = String.Format(LexEdStrings.ksIdentifyXLexEntryOrSense,
                                           lrt.Name.BestAnalysisAlternative.Text);
                    break;
                }
                Debug.Assert(dlg != null);
                var wp = new WindowParams {
                    m_title = sTitle, m_btnText = LexEdStrings.ks_Add
                };
                dlg.SetDlgInfo(m_cache, wp, m_mediator);
                dlg.SetHelpTopic("khtpChooseLexicalRelationAdd");
                if (dlg.ShowDialog(FindForm()) == DialogResult.OK && dlg.SelectedObject != null)
                {
                    if (!((ILexReference)m_obj).TargetsRS.Contains(dlg.SelectedObject))
                    {
                        AddItem(dlg.SelectedObject);
                    }
                }
            }
            finally
            {
                if (dlg != null)
                {
                    dlg.Dispose();
                }
            }
        }
Exemplo n.º 3
0
        /// <summary>
        /// Override method to handle launching of a chooser for selecting lexical entries.
        /// </summary>
        protected override void HandleChooser()
        {
            ILexRefType lrt  = (ILexRefType)m_obj.Owner;
            int         type = lrt.MappingType;
            BaseGoDlg   dlg  = null;

            try
            {
                switch ((LexRefTypeTags.MappingTypes)type)
                {
                case LexRefTypeTags.MappingTypes.kmtSenseTree:
                    dlg = new LinkEntryOrSenseDlg();
                    (dlg as LinkEntryOrSenseDlg).SelectSensesOnly = true;
                    break;

                case LexRefTypeTags.MappingTypes.kmtEntryTree:
                    dlg = new EntryGoDlg();
                    break;

                case LexRefTypeTags.MappingTypes.kmtEntryOrSenseTree:
                    dlg = new LinkEntryOrSenseDlg();
                    break;
                }
                Debug.Assert(dlg != null);
                var wp = new WindowParams {
                    m_title = String.Format(LexEdStrings.ksReplaceXEntry), m_btnText = LexEdStrings.ks_Replace
                };
                //This method is only called when we are Replacing the
                //tree root of a Whole/Part lexical relation
                dlg.SetDlgInfo(m_cache, wp, m_mediator);
                dlg.SetHelpTopic("khtpChooseLexicalRelationAdd");
                if (dlg.ShowDialog(FindForm()) == DialogResult.OK)
                {
                    if (dlg.SelectedObject != null)
                    {
                        AddItem(dlg.SelectedObject);
                    }
                }
            }
            finally
            {
                if (dlg != null)
                {
                    dlg.Dispose();
                }
            }
        }
Exemplo n.º 4
0
        /// <summary>
        /// Override method to handle launching of a chooser for selecting lexical entries.
        /// </summary>
        protected override void HandleChooser()
        {
            ILexRefType lrt = LexRefType.CreateFromDBObject(m_cache, m_obj.OwnerHVO);

            LexRefType.MappingTypes type = (LexRefType.MappingTypes)lrt.MappingType;
            BaseGoDlg dlg    = null;
            string    sTitle = "";

            switch (type)
            {
            case LexRefType.MappingTypes.kmtSenseCollection:
                dlg = new LinkEntryOrSenseDlg();
                (dlg as LinkEntryOrSenseDlg).SelectSensesOnly = true;
                sTitle = String.Format(LexEdStrings.ksIdentifyXSense,
                                       lrt.Name.BestAnalysisAlternative.Text);
                break;

            case LexRefType.MappingTypes.kmtEntryCollection:
                dlg    = new GoDlg();
                sTitle = String.Format(LexEdStrings.ksIdentifyXLexEntry,
                                       lrt.Name.BestAnalysisAlternative.Text);
                break;

            case LexRefType.MappingTypes.kmtEntryOrSenseCollection:
                dlg    = new LinkEntryOrSenseDlg();
                sTitle = String.Format(LexEdStrings.ksIdentifyXLexEntryOrSense,
                                       lrt.Name.BestAnalysisAlternative.Text);
                break;
            }
            Debug.Assert(dlg != null);
            WindowParams wp = new WindowParams();

            wp.m_title   = sTitle;
            wp.m_label   = LexEdStrings.ksFind_;
            wp.m_btnText = LexEdStrings.ks_Add;             //for collection relation of items always have an Add button
            dlg.SetDlgInfo(m_cache, wp, m_mediator);
            dlg.SetHelpTopic("khtpChooseLexicalRelationAdd");
            if (dlg.ShowDialog(FindForm()) == DialogResult.OK)
            {
                AddItem(dlg.SelectedID);
            }
            dlg.Dispose();
        }
        /// <summary>
        /// Override method to handle launching of a chooser for selecting lexical entries.
        /// </summary>
        protected override void HandleChooser()
        {
            Form       frm = FindForm();
            WaitCursor wc  = null;
            BaseGoDlg  dlg = null;

            try
            {
                if (frm != null)
                {
                    wc = new WaitCursor(frm);
                }
                if (m_obj is IMoAlloAdhocProhib)
                {
                    dlg = new LinkAllomorphDlg();
                }
                else
                {
                    Debug.Assert(m_obj is IMoMorphAdhocProhib);
                    dlg = new LinkMSADlg();
                }
                Debug.Assert(dlg != null);
                dlg.SetDlgInfo(m_cache, null, m_mediator);
                if (dlg.ShowDialog(frm) == DialogResult.OK)
                {
                    AddItem(dlg.SelectedObject);
                }
            }
            finally
            {
                if (wc != null)
                {
                    wc.Dispose();
                }
                if (dlg != null)
                {
                    dlg.Dispose();
                }
            }
        }
        /// <summary>
        /// Override method to handle launching of a chooser for selecting lexical entries.
        /// </summary>
        protected override void HandleChooser()
        {
            ILexRefType lrt  = LexRefType.CreateFromDBObject(m_cache, m_obj.OwnerHVO);
            int         type = lrt.MappingType;
            BaseGoDlg   dlg  = null;

            switch ((LexRefType.MappingTypes)type)
            {
            case LexRefType.MappingTypes.kmtSenseTree:
                dlg = new LinkEntryOrSenseDlg();
                (dlg as LinkEntryOrSenseDlg).SelectSensesOnly = true;
                break;

            case LexRefType.MappingTypes.kmtEntryTree:
                dlg = new GoDlg();
                break;

            case LexRefType.MappingTypes.kmtEntryOrSenseTree:
                dlg = new LinkEntryOrSenseDlg();
                break;
            }
            Debug.Assert(dlg != null);
            WindowParams wp = new WindowParams();

            //This method is only called when we are Replacing the
            //tree root of a Whole/Part lexical relation
            wp.m_title   = String.Format(LexEdStrings.ksReplaceXEntry);
            wp.m_btnText = LexEdStrings.ks_Replace;
            wp.m_label   = LexEdStrings.ksFind_;
            dlg.SetDlgInfo(m_cache, wp, m_mediator);
            dlg.SetHelpTopic("khtpChooseLexicalRelationAdd");
            if (dlg.ShowDialog(FindForm()) == DialogResult.OK)
            {
                TargetHvo = dlg.SelectedID;
            }
            dlg.Dispose();
        }
Exemplo n.º 7
0
        /// <summary>
        /// Override method to handle launching of a chooser for selecting lexical entries.
        /// </summary>
        protected override void HandleChooser()
        {
            ILexRefType lrt  = LexRefType.CreateFromDBObject(m_cache, m_obj.OwnerHVO);
            int         type = lrt.MappingType;
            BaseGoDlg   dlg  = null;

            switch ((LexRefType.MappingTypes)type)
            {
            case LexRefType.MappingTypes.kmtSenseTree:
                dlg = new LinkEntryOrSenseDlg();
                (dlg as LinkEntryOrSenseDlg).SelectSensesOnly = true;
                break;

            case LexRefType.MappingTypes.kmtEntryTree:
                dlg = new GoDlg();
                break;

            case LexRefType.MappingTypes.kmtEntryOrSenseTree:
                dlg = new LinkEntryOrSenseDlg();
                break;
            }
            Debug.Assert(dlg != null);
            WindowParams wp = new WindowParams();

            wp.m_title = String.Format(LexEdStrings.ksIdentifyXEntry,
                                       lrt.Name.AnalysisDefaultWritingSystem);
            wp.m_label   = LexEdStrings.ksFind_;
            wp.m_btnText = LexEdStrings.ks_Add;             //for parts of a whole always have an Add button
            dlg.SetDlgInfo(m_cache, wp, m_mediator);
            dlg.SetHelpTopic("khtpChooseLexicalRelationAdd");
            if (dlg.ShowDialog(FindForm()) == DialogResult.OK)
            {
                AddItem(dlg.SelectedID);
            }
            dlg.Dispose();
        }
        /// <summary>
        /// Override method to handle launching of a chooser for selecting lexical entries or senses.
        /// </summary>
        protected override void HandleChooser()
        {
            Form frm = FindForm();

            try
            {
                if (frm != null)
                {
                    frm.Cursor = Cursors.WaitCursor;
                }
                BaseGoDlg dlg = null;
                if (m_obj is MoAlloAdhocProhib)
                {
                    dlg = new LinkAllomorphDlg();
                }
                else
                {
                    Debug.Assert(m_obj is MoMorphAdhocProhib);
                    dlg = new LinkMSADlg();
                }
                Debug.Assert(dlg != null);
                dlg.SetDlgInfo(m_cache, null, m_mediator);
                if (dlg.ShowDialog(frm) == DialogResult.OK)
                {
                    AddItem(dlg.SelectedID);
                }
                dlg.Dispose();
            }
            finally
            {
                if (frm != null)
                {
                    frm.Cursor = Cursors.Default;
                }
            }
        }
        /// <summary>
        /// Override method to handle launching of a chooser for selecting lexical entries.
        /// </summary>
        protected override void HandleChooser()
        {
            ILexRefType lrt = (ILexRefType)m_obj.Owner;

            LexRefTypeTags.MappingTypes type = (LexRefTypeTags.MappingTypes)lrt.MappingType;
            BaseGoDlg dlg = null;

            try
            {
                switch (type)
                {
                case LexRefTypeTags.MappingTypes.kmtSensePair:
                case LexRefTypeTags.MappingTypes.kmtSenseAsymmetricPair:                         // Sense pair with different Forward/Reverse names
                    dlg = new LinkEntryOrSenseDlg();
                    (dlg as LinkEntryOrSenseDlg).SelectSensesOnly = true;
                    break;

                case LexRefTypeTags.MappingTypes.kmtEntryPair:
                case LexRefTypeTags.MappingTypes.kmtEntryAsymmetricPair:                         // Entry pair with different Forward/Reverse names
                    dlg = new EntryGoDlg();
                    break;

                case LexRefTypeTags.MappingTypes.kmtEntryOrSensePair:
                case LexRefTypeTags.MappingTypes.kmtEntryOrSenseAsymmetricPair:                         // Entry or sense pair with different Forward/Reverse
                    dlg = new LinkEntryOrSenseDlg();
                    (dlg as LinkEntryOrSenseDlg).SelectSensesOnly = false;
                    break;
                }
                Debug.Assert(dlg != null);
                var wp = new WindowParams();
                //on creating Pair Lexical Relation have an Add button and Add in the title bar
                if (Target == null)
                {
                    wp.m_title   = String.Format(LexEdStrings.ksIdentifyXEntry, lrt.Name.BestAnalysisAlternative.Text);
                    wp.m_btnText = LexEdStrings.ks_Add;
                }
                else                 //Otherwise we are Replacing the item
                {
                    wp.m_title   = String.Format(LexEdStrings.ksReplaceXEntry);
                    wp.m_btnText = LexEdStrings.ks_Replace;
                }

                dlg.SetDlgInfo(m_cache, wp, m_mediator);
                dlg.SetHelpTopic("khtpChooseLexicalRelationAdd");
                if (dlg.ShowDialog(FindForm()) == DialogResult.OK)
                {
                    if (dlg.SelectedObject != null)
                    {
                        AddItem(dlg.SelectedObject);
                        // it is possible that the previous update has caused the data tree to refresh
                        if (!IsDisposed)
                        {
                            m_atomicRefView.RootBox.Reconstruct();                             // view is somehow too complex for auto-update.
                        }
                    }
                }
            }
            finally
            {
                if (dlg != null)
                {
                    dlg.Dispose();
                }
            }
        }