Beispiel #1
0
        private void Button2Click(System.Object sender, System.EventArgs e)
        {
            // handles noun, verb, adj, adverb click for context menu
            Button b = (Button)sender;

            Wnlib.SearchSet ss = null;
            //= bobj2
            string btext = b.Text;

            if (btext == "Adjective")
            {
                btext = "Adj";
            }

            switch (btext)
            {
            case "Noun":
                ss = (Wnlib.SearchSet)bobj2;

                break;

            case "Verb":
                ss = (Wnlib.SearchSet)bobj3;

                break;

            case "Adj":
                ss = (Wnlib.SearchSet)bobj4;

                break;

            case "Adverb":
                ss = (Wnlib.SearchSet)bobj5;
                break;
            }
            Wnlib.PartOfSpeech pos = Wnlib.PartOfSpeech.of(btext.ToLower());
            int i = 0;

            opts = new ArrayList();
            ContextMenu cm     = new ContextMenu();
            ArrayList   tmplst = new ArrayList();

            for (i = 0; i <= Wnlib.Opt.Count - 1; i++)
            {
                Wnlib.Opt opt = Wnlib.Opt.at(i);

                //Try ' TODO: fix problem with adjective menu
                if (ss[opt.sch.ptp.ident] & object.ReferenceEquals(opt.pos, pos))
                {
                    if (tmplst.IndexOf(opt.label) == -1 & opt.label != "Grep")
                    {
                        MenuItem mi = new MenuItem();
                        // (opt.label, AddressOf searchMenu_Click)
                        mi.Text   = opt.label;
                        mi.Click += searchMenu_Click;
                        opts.Add(opt);
                        cm.MenuItems.Add(mi);

                        tmplst.Add(opt.label);
                    }
                }
                //Catch
                //End Try
            }

            cm.Show(b.Parent, new System.Drawing.Point(b.Left, b.Bottom));
            //Point(b.Left, b.Bottom))
        }
        /// <summary>
        /// Handles the sense buttons to build and display the appropriate dropdown menu for
        /// searches on word relationships.
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void btnWordType_Click(System.Object sender, System.EventArgs e)
        {
            Button b = (Button)sender;

            Wnlib.SearchSet ss    = null;
            string          btext = b.Text;

            if (btext == "Adjective")
            {
                btext = "Adj";
            }

            switch (btext)
            {
            case "Noun":
                ss = (Wnlib.SearchSet)bobj2;

                break;

            case "Verb":
                ss = (Wnlib.SearchSet)bobj3;

                break;

            case "Adj":
                ss = (Wnlib.SearchSet)bobj4;

                break;

            case "Adverb":
                ss = (Wnlib.SearchSet)bobj5;
                break;
            }

            Wnlib.PartOfSpeech pos = Wnlib.PartOfSpeech.of(btext.ToLower());
            int i = 0;

            opts = new ArrayList();
            ContextMenu cm     = new ContextMenu();
            ArrayList   tmplst = new ArrayList();

            for (i = 0; i <= Wnlib.Opt.Count - 1; i++)
            {
                Wnlib.Opt opt = Wnlib.Opt.at(i);                 //opt.at(i);

                if (ss[opt.sch.ptp.ident] & object.ReferenceEquals(opt.pos, pos))
                {
                    if (tmplst.IndexOf(opt.label) == -1 & opt.label != "Grep")
                    {
                        MenuItem mi = new MenuItem();
                        mi.Text   = opt.label;
                        mi.Click += searchMenu_Click;
                        opts.Add(opt);
                        cm.MenuItems.Add(mi);

                        tmplst.Add(opt.label);
                    }
                }
            }
            cm.Show(b.Parent, new Point(b.Left, b.Bottom));
        }