private void buttonPlay_Click(object sender, EventArgs e) { // Get the slide show for the current event SlideShow selectedShow = iEventList.GetSlideShow(listBoxEvents.SelectedIndex); if (selectedShow == null) { int choice = listBoxEvents.SelectedIndex; string choiceName = listBoxEvents.Items[choice].ToString(); MessageBox.Show("Slide show for <" + choiceName + "> event cannot be played"); } else { SlideViewerForm slideScreen = new SlideViewerForm(selectedShow, iSlideParameters); slideScreen.Show(); } }
void playMenuItem_Click(object sender, EventArgs e) { // It should only be possible to invoke the Play menu item for an XML // file, but we will check to make sure ListView.SelectedListViewItemCollection selectedItems = this.listView.SelectedItems; if (selectedItems.Count == 1) { string filename = selectedItems[0].Text; if (IsXml(new FileInfo(filename))) { string currentDirectory = TreePath(treeView.SelectedNode); string filetype = Path.GetFileNameWithoutExtension(filename); if (filetype.Equals("album", StringComparison.CurrentCultureIgnoreCase)) { AlbumForm albumForm = new AlbumForm(true, iSlideParameters); albumForm.LoadAlbum(currentDirectory); albumForm.ShowDialog(); } else if (filetype.Equals("events", StringComparison.CurrentCultureIgnoreCase)) { // Display the events for the selected year so that the user can choose a slide show EventsForm eventsForm = new EventsForm(iSlideParameters); eventsForm.LoadEvents(currentDirectory, filename); eventsForm.ShowDialog(); } else { // Not an album nor an events page: must be a slide show SlideViewerForm slideScreen = new SlideViewerForm(iSlideParameters); slideScreen.LoadShow(currentDirectory, filename); slideScreen.ShowDialog(); } } } }