コード例 #1
0
        private void btn_remove_Click(object sender, EventArgs e)
        {
            if (indexSelected)
            {
                int i = getListViewIndex();

                if (i != 0)
                {
                    DialogResult dr = MessageBox.Show("Are you sure that you wish to delete: " + mPresetList[i].Name + "?", "Remove Preset", MessageBoxButtons.YesNo);
                    if (dr == DialogResult.Yes)
                    {
                        mPresetList.removePresetAtIndex(i);
                        lv_presetListView.Clear();
                        populatePresetView();
                    }
                }
            }
        }
コード例 #2
0
        private void btn_presetRemove_Click(object sender, EventArgs e)
        {
            // First make sure that the selected index isn't the Default one and that there is more than one in the combobox
            if (cb_presetSelection.SelectedIndex != 0 && presetList.Size() != 1)
            {
                // YES NO Dialog box to determined if it will be deleted or not
                DialogResult dr = MessageBox.Show("Are you sure that you wish to delete: " + presetList[cb_presetSelection.SelectedIndex].Name + "?", "Remove Preset", MessageBoxButtons.YesNo);

                if (dr == DialogResult.Yes)
                {
                    int temp = cb_presetSelection.SelectedIndex > 0 ? cb_presetSelection.SelectedIndex - 1 : 0;

                    presetList.removePresetAtIndex(cb_presetSelection.SelectedIndex);
                    setPresetListDefaults();
                    cb_presetSelection.SelectedIndex = temp;
                }
            }
        }