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; }
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); }
private void ButtonRemoveColorizerClick(object sender, EventArgs e) { Colorizer colorizer = GetSelectedColorizer(); if (colorizer == null) { return; } listViewColorizers.SelectedItems[0].Remove(); }
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; }
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; }
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; }
private Colorizer GetExistingColorizer(Colorizer colorizer) { return(AllColorizers.FirstOrDefault(c => c.Equals(colorizer))); }