Example #1
0
        /// <summary>
        /// 添加常用
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void addHighBtn_Click(object sender, EventArgs e)
        {
            AddHighForm aForm = new AddHighForm();
            aForm.ShowDialog();
            string index = aForm.index;
            string highKey = aForm.highKey;
            aForm.Dispose();
            if (index == "-1"||index==null)
            {
                statusLabel.Text = "索引错误,不能添加。";
                return;
            }

            if (index == "常用")
                index = "High";

            try
            {
                ListView lv = (ListView)(this.Controls.Find(index + "ListView", true)[0]);
                if (!isExist(lv, highKey))
                {
                    lv.Items.Add(new ListViewItem(highKey));
                    statusLabel.Text = "向索引 " + index + " 添加关键字:" + highKey;
                }
                else
                {
                    statusLabel.Text = "索引 " + index + " 中已存在:" + highKey + " ,不需要再次添加。";
                }
            }
            catch
            {
                statusLabel.Text = "索引错误,不能添加。";
            }
        }
Example #2
0
        /// <summary>
        /// 添加常用
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void addHighBtn_Click(object sender, EventArgs e)
        {
            AddHighForm aForm = new AddHighForm();

            aForm.ShowDialog();
            string index   = aForm.index;
            string highKey = aForm.highKey;

            aForm.Dispose();
            if (index == "-1" || index == null)
            {
                statusLabel.Text = "索引错误,不能添加。";
                return;
            }

            if (index == "常用")
            {
                index = "High";
            }

            try
            {
                ListView lv = (ListView)(this.Controls.Find(index + "ListView", true)[0]);
                if (!isExist(lv, highKey))
                {
                    lv.Items.Add(new ListViewItem(highKey));
                    statusLabel.Text = "向索引 " + index + " 添加关键字:" + highKey;
                }
                else
                {
                    statusLabel.Text = "索引 " + index + " 中已存在:" + highKey + " ,不需要再次添加。";
                }
            }
            catch
            {
                statusLabel.Text = "索引错误,不能添加。";
            }
        }