private void MoveDownMenuItem_Click(object sender, EventArgs e) { var indices = SelectedIndices.ToList(); if (indices.Count == 0 || indices.Last() == MainForm.CheatList.Count - 1) { return; } for (var i = indices.Count - 1; i >= 0; i--) { var cheat = MainForm.CheatList[indices[i]]; MainForm.CheatList.Remove(cheat); MainForm.CheatList.Insert(indices[i] + 1, cheat); } UpdateMessageLabel(); var newIndices = indices.Select(t => t + 1); CheatListView.DeselectAll(); foreach (var index in newIndices) { CheatListView.SelectRow(index, true); } GeneralUpdate(); }
private void MoveUpMenuItem_Click(object sender, EventArgs e) { var indices = SelectedIndices.ToList(); if (indices.Count == 0 || indices[0] == 0) { return; } foreach (var index in indices) { var cheat = MainForm.CheatList[index]; MainForm.CheatList.Remove(cheat); MainForm.CheatList.Insert(index - 1, cheat); } var newIndices = indices.Select(t => t - 1); CheatListView.DeselectAll(); foreach (var index in newIndices) { CheatListView.SelectRow(index, true); } UpdateMessageLabel(); GeneralUpdate(); }