Beispiel #1
0
        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);
        }
Beispiel #2
0
        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();
        }
Beispiel #3
0
 public static int SortByNewText(Replacement a, Replacement b)
 {
     return(a.newText.CompareTo(b.newText));
 }
Beispiel #4
0
 public static int SortByOldText(Replacement a, Replacement b)
 {
     return(a.oldText.CompareTo(b.oldText));
 }
Beispiel #5
0
 public static int SortByOldText(Replacement a, Replacement b)
 {
     return a.oldText.CompareTo(b.oldText);
 }
Beispiel #6
0
 public static int SortByNewText(Replacement a, Replacement b)
 {
     return a.newText.CompareTo(b.newText);
 }