private void UpBtn_Click(object sender, EventArgs e) { string temp = null; int selItemIndex; try { selItemIndex = NPlistbox.Items.IndexOf(NPlistbox.SelectedItem); if (selItemIndex > 0) { playlist.moveItem(selItemIndex, selItemIndex - 1); temp = NPlist[selItemIndex]; NPlist[selItemIndex] = NPlist[selItemIndex - 1]; NPlist[selItemIndex - 1] = temp; temp = NPlistbox.SelectedItem.ToString(); NPlistbox.Items.RemoveAt(selItemIndex); NPlistbox.Items.Insert(selItemIndex - 1, temp); NPlistbox.SelectedIndex = selItemIndex - 1; } } catch (Exception ex) { MessageBox.Show("Unable to Move!\n\nPlease check the selection of Item" + ex.Message); } }
private void вышеToolStripMenuItem_Click(object sender, EventArgs e) { p.moveItem(selected, selected - 1); ChangePL?.Invoke(this); }