Prevent sort/clear reverse on shortcut use

Closes #2111 by preventing the user error
This commit is contained in:
Kurt 2018-09-04 15:01:14 -07:00
parent f5b09c2bea
commit 81f6988d3e
2 changed files with 16 additions and 2 deletions

View file

@ -39,6 +39,20 @@
return true;
}
/// <summary>
/// Executes the provided <see cref="type"/> with the provided parameters.
/// </summary>
/// <param name="type">Manipulation to perform on the <see cref="SAV"/> box data.</param>
/// <param name="box">Single box to modify; if <see cref="allBoxes"/> is set, this param is ignored.</param>
/// <param name="allBoxes">Indicates if all boxes are to be manipulated, or just one box.</param>
/// <param name="reverse">Manipulation action should be inverted (criteria) or reversed (sort).</param>
/// <returns>True if operation succeeded, false if no changes made.</returns>
public bool Execute(BoxManipType type, int box, bool allBoxes, bool reverse = false)
{
var manip = type.GetManip();
return Execute(manip, box, allBoxes, reverse);
}
/// <summary>
/// Sanity check for modifying the box data.
/// </summary>

View file

@ -106,8 +106,8 @@ namespace PKHeX.WinForms.Controls
Resources.wand,
};
public void Clear() => ((ToolStripMenuItem)Items[0]).DropDownItems[0].PerformClick();
public void Sort() => ((ToolStripMenuItem)Items[1]).DropDownItems[0].PerformClick();
public void Clear() => Manipulator.Execute(BoxManipType.DeleteAll, sav.SAV.CurrentBox, All);
public void Sort() => Manipulator.Execute(BoxManipType.SortSpecies, sav.SAV.CurrentBox, All);
private static bool All => (ModifierKeys & Keys.Shift) != 0;
private static bool Reverse => (ModifierKeys & Keys.Control) != 0;