Esempio n. 1
0
        private void NewTextRuleBtn_Click(object sender, EventArgs e)
        {
            TextRuleEditForm form = new TextRuleEditForm(true);

            if (form.ShowDialog() == DialogResult.OK)
            {
                string      dt       = DateTime.Now.ToString() + "." + DateTime.Now.Millisecond.ToString();
                ExtractRule textRule = new ExtractRule(dt, form.StartLabel, form.EndLabel, "");
                textRule.ExtractRuleState = WebRuleState.New;
                textRule.IsStateChange    = true;
                activeRule.ExtractRuleCollection.Add(textRule);

                this.TextRuleNameComboBox.Items.Add(dt);
                this.TextRuleNameComboBox.Text = dt;
            }
        }
Esempio n. 2
0
        private void ModifyTextRuleBtn_Click(object sender, EventArgs e)
        {
            //得到当前操作的ExtractRule对象
            string      name    = this.TextRuleNameComboBox.Text;
            ExtractRule modRule = activeRule.ExtractRuleCollection[name];

            if (modRule.ExtractRuleState != WebRuleState.New)
            {
                modRule.ExtractRuleState = WebRuleState.Modify;
                modRule.IsStateChange    = true;
            }

            TextRuleEditForm form = new TextRuleEditForm(false);

            form.StartLabel = modRule.Start;
            form.EndLabel   = modRule.End;
            if (form.ShowDialog() == DialogResult.OK)
            {
                modRule.Start = form.StartLabel;
                modRule.End   = form.EndLabel;
            }
        }