Пример #1
0
        private void ButtonModifyColorizerClick(object sender, EventArgs e)
        {
            Colorizer colorizer = GetSelectedColorizer();

            if (colorizer == null)
            {
                return;
            }

            ColorizerEdit edit = new ColorizerEdit(colorizer);
            DialogResult  dr   = edit.ShowDialog(this);

            listViewColorizers.Focus();
            if (dr != DialogResult.OK)
            {
                return;
            }

            Colorizer existing = GetExistingColorizer(edit.Colorizer);

            if ((existing != null) && (existing != edit.Colorizer))
            {
                Remove(edit.Colorizer);
                return;
            }

            ListViewItem item = listViewColorizers.SelectedItems[0];

            item.Text             = edit.Colorizer.Active.ToString();
            item.SubItems[1].Text = edit.Colorizer.IgnoreCase.ToString();
            item.SubItems[2].Text = edit.Colorizer.Definition;
        }
Пример #2
0
        private static ListViewItem GetColorizerItem(Colorizer colorizer)
        {
            var item = new ListViewItem(colorizer.Active.ToString());

            item.SubItems.Add(colorizer.IgnoreCase.ToString());
            item.SubItems.Add(colorizer.Definition);
            item.Tag = colorizer;
            return(item);
        }
Пример #3
0
        private void ButtonRemoveColorizerClick(object sender, EventArgs e)
        {
            Colorizer colorizer = GetSelectedColorizer();

            if (colorizer == null)
            {
                return;
            }

            listViewColorizers.SelectedItems[0].Remove();
        }
Пример #4
0
        private void UpdateControls()
        {
            Colorizer colorizer = GetSelectedColorizer();

            buttonRemoveColorizer.Enabled = colorizer != null;
            buttonModifyColorizer.Enabled = colorizer != null;

            ColorSet set = GetSelectedColorSet();

            buttonRemoveColorSet.Enabled = set != null;
            buttonModifyColorSet.Enabled = set != null;
        }
Пример #5
0
        public ColorizerEdit(Colorizer colorizer)
        {
            if (colorizer == null)
            {
                colorizer = new Colorizer();
            }

            Colorizer = colorizer;
            InitializeComponent();
            _checkTip = new ToolTip();
            textBoxDefinition.Text     = colorizer.Definition;
            checkBoxIgnoreCase.Checked = colorizer.IgnoreCase;
            checkBoxActive.Checked     = colorizer.Active;
        }
Пример #6
0
        private void ButtonAddColorizerClick(object sender, EventArgs e)
        {
            ColorizerEdit edit = new ColorizerEdit(null);
            DialogResult  dr   = edit.ShowDialog(this);

            listViewColorizers.Focus();
            if (dr != DialogResult.OK)
            {
                return;
            }

            Colorizer existing = GetExistingColorizer(edit.Colorizer);

            if (existing != null)
            {
                GetColorizerItem(existing).Selected = true;
                return;
            }

            listViewColorizers.Items.Add(GetColorizerItem(edit.Colorizer)).Selected = true;
        }
Пример #7
0
 private Colorizer GetExistingColorizer(Colorizer colorizer)
 {
     return(AllColorizers.FirstOrDefault(c => c.Equals(colorizer)));
 }