private void MoveRow(int old_index, int new_index) { if (new_index < 0 || new_index >= options.replacements.Count) { return; } Replacement tmp = options.replacements[old_index]; options.replacements[old_index] = options.replacements[new_index]; options.replacements[new_index] = tmp; bindingSource1.ResetItem(old_index); bindingSource1.ResetItem(new_index); }
private void buttonAddReplacement_Click(object sender, EventArgs e) { string selText = GetSelectedText(); if (formAddReplacement == null) { formAddReplacement = new FormAddReplacement(); } string oldNewText = ""; foreach (Replacement rep in Global.options.replacements) { if (rep.oldText == selText) { oldNewText = rep.newText; break; } } formAddReplacement.UpdateControls(selText, oldNewText); TopMost = false; if (formAddReplacement.ShowDialog() == DialogResult.OK) { string oldText, newText; formAddReplacement.GetControlValues(out oldText, out newText); Replacement old = Global.options.replacements.Find(x => x.oldText == oldText); if (old != null) { old.newText = newText; } else { Global.options.replacements.Add(new Replacement(oldText, newText)); } Global.options.SaveReplacements(); } TopMost = Global.isTopMost(); }
public static int SortByNewText(Replacement a, Replacement b) { return(a.newText.CompareTo(b.newText)); }
public static int SortByOldText(Replacement a, Replacement b) { return(a.oldText.CompareTo(b.oldText)); }
public static int SortByOldText(Replacement a, Replacement b) { return a.oldText.CompareTo(b.oldText); }
public static int SortByNewText(Replacement a, Replacement b) { return a.newText.CompareTo(b.newText); }