cadencii.Preference.buttonResamplerUpDown_Click C# (CSharp) Method

buttonResamplerUpDown_Click() public method

public buttonResamplerUpDown_Click ( Object sender, EventArgs e ) : void
sender Object
e EventArgs
return void
        public void buttonResamplerUpDown_Click( Object sender, EventArgs e )
        {
            int delta = 1;
            if ( sender == buttonResamplerUp ) {
                delta = -1;
            }
            int count = listResampler.Items.Count;
            if ( listResampler.SelectedIndices.Count == 0 ) {
                return;
            }
            int index = listResampler.SelectedIndices[0];
            if (index + delta < 0 || count <= index + delta) {
                return;
            }

            String sel = (String)listResampler.Items[index].SubItems[0].Text;
            boolean chk = listResampler.Items[index].Checked;
            listResampler.Items[index].SubItems[0].Text = listResampler.Items[index + delta].SubItems[0].Text;
            listResampler.Items[index].Checked = listResampler.Items[index + delta].Checked;
            listResampler.Items[index + delta].SubItems[0].Text = sel;
            listResampler.Items[index + delta].Checked = chk;
            if (!listResampler.Items[index + delta].Selected) {
                listResampler.SelectedIndices.Clear();
                listResampler.Items[index + delta].Selected = true;
            }
        }
Preference