Exemplo n.º 1
0
        /// <summary>Handler for when the start slideshow button is clicked</summary>
        private void startButton_Click(object sender, EventArgs e)
        {
            // Create a new slideshow form
            SlideshowForm slideForm = new SlideshowForm();

            slideForm.Show();
            // Create a new slideshow model
            Slideshow ss = new Slideshow();

            slideForm.setSlideshow(ss);
            slideForm.setController(this);
            _slideShowForms.Add(slideForm);
            // add some pictures to the slideshow
            ss.addDirectory(folderBrowserDialog1.SelectedPath.ToString());
            _slideshows.Add(ss);
            // Map slideshow forms to slideshows (views to models)
            _slideshowMap[slideForm] = ss;
            // get an enumerator for the slideshow.
            // This allows us to have a one-to-many slideshow-to-view relationship
            _slideshowIEMap[slideForm] = ss.GetEnumerator();
            // Map an item in the list of slideshows to the slideshow itself
            // We need this to determine which slideshow the user wants to stop
            ListViewItem lvi = new ListViewItem(folderBrowserDialog1.SelectedPath.ToString(), 0);

            _lviToSlideshowFormMap[lvi]       = slideForm;
            _SlideshowFormToLVIMap[slideForm] = lvi;
            slideShowListView.Items.Add(lvi);
            _slideshowIntervalMap[slideForm] = (uint)intervalNumericUpDown.Value;
        }
Exemplo n.º 2
0
 /// <summary>Called by A SlideshowForm when it closes</summary>
 /// <param name="sf">The SlideshowForm that closed</param>
 public void slideFormClosedHandler(SlideshowForm sf)
 {
     // Remove the slideshow and all related objects from the collections
     slideShowListView.Items.Remove(_SlideshowFormToLVIMap[sf]);
     _slideshowMap[sf].Dispose();
     _slideshows.Remove(_slideshowMap[sf]);
     _lviToSlideshowFormMap.Remove(_SlideshowFormToLVIMap[sf]);
     _SlideshowFormToLVIMap.Remove(sf);
     _slideshowIEMap.Remove(sf);
     _slideshowMap.Remove(sf);
     _slideShowForms.Remove(sf);
     // XXX should we also remove their slideshow models? (Slideshow class)
 }