Exemple #1
0
        private void _btnRemoveRegex_Click(object sender, EventArgs e)
        {
            LinkRegex item = (LinkRegex)_lbxRegexes.SelectedItem;

            item.Delete();
            RefreshRegexList(null);
        }
Exemple #2
0
 private void _btnAddRegex_Click(object sender, System.EventArgs e)
 {
     using (RegexOptions dlg = new RegexOptions())
     {
         if (dlg.ShowDialog(this) == DialogResult.OK)
         {
             LinkRegex linkRegex = LinkRegex.Create();
             linkRegex.RegexMatch   = dlg.RegexMatch;
             linkRegex.RegexReplace = dlg.RegexReplace;
             linkRegex.Save();
             RefreshRegexList(linkRegex);
         }
     }
 }
Exemple #3
0
        private void _btnEditRegex_Click(object sender, EventArgs e)
        {
            LinkRegex item = (LinkRegex)_lbxRegexes.SelectedItem;

            using (RegexOptions dlg = new RegexOptions())
            {
                dlg.RegexMatch   = item.RegexMatch;
                dlg.RegexReplace = item.RegexReplace;
                if (dlg.ShowDialog(this) == DialogResult.OK)
                {
                    item.RegexMatch   = dlg.RegexMatch;
                    item.RegexReplace = dlg.RegexReplace;
                    item.Save();
                    RefreshRegexList(item);
                }
            }
        }
Exemple #4
0
        private void RefreshRegexList(LinkRegex itemToSelect)
        {
            _lbxRegexes.Items.Clear();
            BusinessObjectList <LinkRegex> repList = Core.ResourceStore.GetAllResources(LinkRegex.ResourceType);

            foreach (LinkRegex res in repList)
            {
                _lbxRegexes.Items.Add(res);
            }
            if (itemToSelect != null)
            {
                _lbxRegexes.SelectedItem = itemToSelect;
            }
            if (_lbxRegexes.SelectedItem == null && _lbxRegexes.Items.Count > 0)
            {
                _lbxRegexes.SelectedItem = _lbxRegexes.Items [0];
            }
            UpdateRegexButtons();
        }