private void WriteSubstitution() { BaseSubstitution substitution; if (((ListItem)ddoMethod.SelectedItem).Value == 1) { substitution = new AnySubstitution(); } else { substitution = new WholeSubstitution(); } substitution.Replace = txtReplace.Text; substitution.With = txtWith.Text; substitution.CaseSensitive = ckCaseSensitive.Checked; Substitution = substitution; }
private void SetListViewDetails(BaseSubstitution substitution, ListViewItem item) { if (substitution is AnySubstitution) { item.Text = "Anything"; } else if (substitution is WholeSubstitution) { item.Text = "Everything"; } if (item.SubItems.Count < 2) { item.SubItems.Add(substitution.Replace); } else { item.SubItems[colReplace.Index].Text = substitution.Replace; } if (item.SubItems.Count < 3) { item.SubItems.Add(substitution.With); } else { item.SubItems[colWith.Index].Text = substitution.With; } if (item.SubItems.Count < 4) { item.SubItems.Add(substitution.CaseSensitive ? "Yes" : "No"); } else { item.SubItems[colCaseSensitive.Index].Text = substitution.CaseSensitive ? "Yes" : "No"; } }