public LibraryManager(List<List<int>> library, Selection selection) { InitializeComponent(); this.library = library; this.selection = selection; }
private void buttonLibrary_Click(object sender, EventArgs e) { int librarySize = library.Count; Selection selection = new Selection(); LibraryManager lm = new LibraryManager(library, selection); DialogResult dialogResult = lm.ShowDialog(); // if the size is different then you deleted at least one entry // so will need saving at end as is changed if (librarySize != library.Count) { libraryChanged = true; } if (dialogResult == DialogResult.OK) { // do something int chosenIndex = selection.Choice; // copy this up if (chosenIndex != -1) // safety { List<int> newCogSettings = new List<int>(library[chosenIndex]); cogSettings.Add(newCogSettings); CopyCogSettingsToListbox(); CreateCogsFromCurrentSettings(); pictureBoxDisplay.Invalidate(); } } }