Exemple #1
0
        private void History_Click(object sender, System.EventArgs e)
        {
            // an item on the History menu was clicked
            MenuItem mi = (MenuItem)sender;
            int      x  = 0;
            int      i  = 0;

            if ((history.Count > maxhistory))
            {
                x = history.Count - maxhistory;
            }

            wnHistory h = null;

            //        For i = x To mi.Parent.MenuItems.Count - 1
            for (i = 0; i <= mi.Parent.MenuItems.Count - 1; i++)
            {
                if (mi.Text == mi.Parent.MenuItems[i].Text)
                {
                    h = (wnHistory)history[i + x];
                }
            }

            TextBox1.Text = Strings.Replace(h.word, "_", " ");
            TextBox2.Text = "" + h.sn.ToString();
            DoSearch(h.opt);
        }
Exemple #2
0
        private void AddHistory(wnHistory his)
        {
            // adds a new item to history, and appends a menu item
            history.Add(his);

            MenuItem mi = mnuHistory;

            mi.MenuItems.Clear();
            int x = 0;
            int i = 0;

            if ((history.Count > maxhistory))
            {
                x = history.Count - maxhistory;
            }
            if ((history.Count == 0))
            {
                MenuItem mitem = new MenuItem();
                // (opt.label, AddressOf searchMenu_Click)
                mitem.Text = "<empty>";
                mi.MenuItems.Add(mitem);
                return;
            }

            for (i = x; i <= history.Count - 1; i++)
            {
                wnHistory h = (wnHistory)history[i];
                // + x)
                string t = h.opt.label.ToString() + " for " + Strings.Chr(34) + h.word + Strings.Chr(34);
                if ((h.sn > 0))
                {
                    t += " sense " + h.sn.ToString();
                }
                MenuItem mitem = new MenuItem();
                // (opt.label, AddressOf searchMenu_Click)
                mitem.Text = Strings.Replace(t, "_", " ");
                mi.MenuItems.Add(mitem);
                mitem.Click += History_Click;
            }
        }
Exemple #3
0
        private void SaveHistory()
        {
            try {
                System.IO.StreamWriter f = new System.IO.StreamWriter(MyPath() + "\\history.txt");
                int x = 0;
                int i = 0;

                if (history.Count > maxhistory)
                {
                    x = history.Count - maxhistory;
                }

                for (i = x; i <= history.Count - 1; i++)
                {
                    wnHistory h = (wnHistory)history[i];
                    // + x)
                    f.WriteLine(Strings.Replace(h.word, " ", "_") + " " + h.opt.id.ToString() + " " + h.sn.ToString());
                }
                f.Close();
            } catch {
            }
        }