private void addThemToolStripMenuItem_Click(object sender, EventArgs e) { // Add all images in the SlideShow folder that are not already in the SlideShow iSlideShow.PopulateFromFolder(); InitialiseShow(); // Resynchronise the editor iSlideShowChanged = true; // Ensure new slides are saved to file }
// aSubDirectory is the name of a folder in the aCurrentDirectory which contains // the photos to make up a new slide show static public SlideShow Create(string aCurrentDirectory, string aSubDirectory) { string slideShowFolder = Path.Combine(aCurrentDirectory, aSubDirectory); string slideShowFilename = slideShowFolder + ".xml"; if (File.Exists(slideShowFilename)) { DialogResult response = MessageBox.Show("Slide show already exists for this folder. Overwrite?", "PhotoStudio", MessageBoxButtons.YesNo, MessageBoxIcon.Question, MessageBoxDefaultButton.Button2); if (response == DialogResult.No) { // User declined to let existing file be overwritten - cancel operation return(null); } } SlideShow newShow = new SlideShow(slideShowFilename); int numPictures = newShow.PopulateFromFolder(); if (numPictures > 0) { // SlideShow created in memory - not saved yet - this is the responsibility // of the caller, which is probably going to modify the SlideShow first. return(newShow); } else { MessageBox.Show("No pictures found: slide show not created", "PhotoStudio"); return(null); } }