Example #1
0
        private void RefreshButton()
        {
            RegularExpressionItem item = GetSelectedItem();

            this.buttonModifyItem.Enabled = item != null && _isEdit;
            this.buttonDeleteItem.Enabled = item != null;
            this.buttonAddItem.Enabled    = _isEdit;
        }
Example #2
0
        private void Add()
        {
            RegularExpressionItem item = new RegularExpressionItem();

            item.Description = this.textBoxDescription.Text;
            item.Expression  = this.textBoxRegExpression.Text;
            item.Replacement = this.textBoxReplacement.Text;

            Program.ConfigMgt.Config.RegularExpressions.Add(item);

            _isEdit = false;

            RefreshList();
            SelectItem(item);
        }
Example #3
0
 private void SelectItem(RegularExpressionItem item)
 {
     if (item == null)
     {
         return;
     }
     foreach (ListViewItem i in this.listViewList.Items)
     {
         if (item == i.Tag as RegularExpressionItem)
         {
             i.Selected = true;
             break;
         }
     }
 }
Example #4
0
        private void Delete()
        {
            RegularExpressionItem item = GetSelectedItem();

            if (item == null)
            {
                return;
            }

            Program.ConfigMgt.Config.RegularExpressions.Remove(item);

            RefreshList();
            RefreshText();
            RefreshButton();
        }
Example #5
0
        private void Edit()
        {
            RegularExpressionItem item = GetSelectedItem();

            if (item == null)
            {
                return;
            }

            item.Description = this.textBoxDescription.Text;
            item.Expression  = this.textBoxRegExpression.Text;
            item.Replacement = this.textBoxReplacement.Text;

            RefreshList();
            RefreshText();
            RefreshButton();
        }
Example #6
0
        private void Import()
        {
            FormRegExpression frm = new FormRegExpression();

            if (frm.ShowDialog(this) != DialogResult.OK)
            {
                return;
            }

            RegularExpressionItem item = frm.RegExpression;

            if (item == null)
            {
                return;
            }

            this.textBoxDescription.Text   = item.Description;
            this.textBoxReplacement.Text   = item.Replacement;
            this.textBoxRegExpression.Text = item.Expression;
        }
Example #7
0
        private void RefreshText()
        {
            _isEdit = false;

            _isLock = true;
            RegularExpressionItem item = GetSelectedItem();

            if (item == null)
            {
                this.textBoxDescription.Text   = "";
                this.textBoxRegExpression.Text = "";
                this.textBoxReplacement.Text   = "";
            }
            else
            {
                this.textBoxReplacement.Text   = item.Replacement;
                this.textBoxRegExpression.Text = item.Expression;
                this.textBoxDescription.Text   = item.Description;
            }
            _isLock = false;
        }