Improvisation
Improvisation copied to clipboard
"Load Okay" button retrieves the wrong file names
FinalUICreateNN::loadOkayButton_Click will set "this.okayFiles" to all file names selected from the OpenFileDialog. However, the call to add to "this.okayMidiFilesListView.Items" says to add all the things from "this.files" which is used for the "this.midiFileListView" List Box.
private void loadOkayButton_Click(object sender, EventArgs e)
{
OpenFileDialog openFileDialog1 = new OpenFileDialog();
openFileDialog1.Filter = "Midi Files (*.mid)|*.mid";
openFileDialog1.Multiselect = true;
DialogResult result = openFileDialog1.ShowDialog();
if (result == DialogResult.OK)
{
this.okayFiles = openFileDialog1.FileNames;
try
{
// Here is the issue! It should be using "this.okayFiles.Select(..."
this.okayMidiFilesListView.Items.AddRange(this.files.Select(x => new ListViewItem(FinalUIHelperMethods.FileFriendlyString(x))).ToArray());
}
catch (Exception ex)
{
MessageBox.Show("Could Not Load Midi Files", ex.Message);
}
}
}