- if (list_queue.Items.Count != listCount)\r
- {\r
- MessageBox.Show("Unable to modify the selected item. The number of items on the list has changed. \nPlease avoid modifying an item when a new encode is about to start!", "Warning", MessageBoxButtons.OK, MessageBoxIcon.Warning);\r
- }\r
- else\r
- {\r
- if (list_queue.SelectedItem != null)\r
- {\r
- }\r
- \r
- }\r
+ // Copy the selected indices to preserve them during the movement\r
+ List<int> selectedIndices = new List<int>(list_queue.SelectedIndices.Count);\r
+ foreach (int selectedIndex in list_queue.SelectedIndices)\r
+ selectedIndices.Add(selectedIndex);\r
+\r
+ // Reverse the indices to move the items down from last to first (preserves indices)\r
+ selectedIndices.Reverse();\r
+\r
+ // Move down each selected item\r
+ foreach (int selectedIndex in selectedIndices)\r
+ queue.MoveDown(selectedIndex);\r
+\r
+ UpdateUIElements();\r
+\r
+ // Keep the selected item(s) selected, now moved down one index\r
+ foreach (int selectedIndex in selectedIndices)\r
+ if (selectedIndex + 1 < list_queue.Items.Count) // Defensive programming: ensure index is good\r
+ list_queue.Items[selectedIndex + 1].Selected = true;\r