示例#1
0
        private void UpdateControls()
        {
            QuickColorizer colorizer = GetSelectedQuickColorizer();

            buttonRemoveQuickColorizer.Enabled = colorizer != null;
            buttonModifyQuickColorizer.Enabled = colorizer != null;
        }
示例#2
0
        private void buttonModifyQuickColorizer_Click(object sender, EventArgs e)
        {
            QuickColorizer colorizer = GetSelectedQuickColorizer();

            if (colorizer == null)
            {
                return;
            }

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

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

            QuickColorizer existing = GetExistingQuickColorizer(edit.QuickColorizer);

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

            ListViewItem item = listViewQuickColorizers.SelectedItems[0];

            item.Text             = edit.QuickColorizer.Active.ToString();
            item.SubItems[1].Text = edit.QuickColorizer.IgnoreCase.ToString();
            item.SubItems[2].Text = edit.QuickColorizer.WholeText.ToString();
            item.SubItems[3].Text = edit.QuickColorizer.ColorSet != null?edit.QuickColorizer.ColorSet.ToString() : string.Empty;

            item.SubItems[4].Text = edit.QuickColorizer.Text;
        }
示例#3
0
        private static ListViewItem GetQuickColorizerItem(QuickColorizer colorizer)
        {
            var item = new ListViewItem(colorizer.Active.ToString());

            item.SubItems.Add(colorizer.IgnoreCase.ToString());
            item.SubItems.Add(colorizer.WholeText.ToString());
            item.SubItems.Add(colorizer.ColorSet != null ? colorizer.ColorSet.ToString() : string.Empty);
            item.SubItems.Add(colorizer.Text);
            item.Tag = colorizer;
            return(item);
        }
示例#4
0
        private void buttonRemoveQuickColorizer_Click(object sender, EventArgs e)
        {
            QuickColorizer colorizer = GetSelectedQuickColorizer();

            if (colorizer == null)
            {
                return;
            }

            listViewQuickColorizers.SelectedItems[0].Remove();
        }
示例#5
0
        public QuickColorizerEdit(QuickColorizer colorizer)
        {
            if (colorizer == null)
            {
                colorizer = new QuickColorizer();
            }

            QuickColorizer = colorizer;
            InitializeComponent();
            textBoxDefinition.Text = colorizer.Text;
            textBoxColor.Text      = colorizer.ColorSet != null?colorizer.ColorSet.ToString() : string.Empty;

            textBoxColor.Tag           = colorizer.ColorSet;
            checkBoxIgnoreCase.Checked = colorizer.IgnoreCase;
            checkBoxWholeText.Checked  = colorizer.WholeText;
            checkBoxActive.Checked     = colorizer.Active;
            UpdateControls();
        }
示例#6
0
        private void buttonAddQuickColorizer_Click(object sender, EventArgs e)
        {
            QuickColorizerEdit edit = new QuickColorizerEdit(null);
            DialogResult       dr   = edit.ShowDialog(this);

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

            QuickColorizer existing = GetExistingQuickColorizer(edit.QuickColorizer);

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

            listViewQuickColorizers.Items.Add(GetQuickColorizerItem(edit.QuickColorizer)).Selected = true;
        }
示例#7
0
 private QuickColorizer GetExistingQuickColorizer(QuickColorizer colorizer)
 {
     return(AllQuickColorizers.FirstOrDefault(c => c.Equals(colorizer)));
 }