private void btnMoveDown_Click(object sender, EventArgs e) { if (Package.PackageState != AMTUtil.State.READY) { return; } if (lbFrames.SelectedIndex == -1) { MessageBox.Show("You need to select a frame!"); return; } if (lbFrames.SelectedItems.Count > 1) { MessageBox.Show("You cannot move more than one frame."); return; } if (lbFrames.SelectedIndex == lbFrames.Items.Count - 1) { return; } else { //Swap int index = lbFrames.SelectedIndex; AMTUtil.Swap <AMTFrame>(Package.Animation.Actions[lbActions.SelectedIndex].Frames, lbFrames.SelectedIndex, lbFrames.SelectedIndex + 1); PopulateFrames(); lbFrames.SelectedIndex = index + 1; } }