Start Slideshow on a specific album via parameter in URL?

Nov 17, 2008 at 1:20 PM
How do I start the slide show on a specific album?  I would like specify which album to start via a parameter in the URL to my slide show site.  How do I do that?

Nov 18, 2008 at 7:27 AM
  public static void StartSlideShow()
  {
            string query = System.Windows.Browser.HtmlPage.Document.DocumentUri.Query;
            if ( query != null && query.StartsWith("?album="))
            {
                query = query.Substring(7);
                int i;
                if (int.TryParse(query, out i))
                {
                    SelectAlbum(i);
                    return;
                }
            }
            SelectAlbum(DataHandler.CurrentAlbumIndex);
  }
Developer
Jun 17, 2009 at 12:58 PM
Edited Jun 17, 2009 at 5:46 PM

Thanks olafb.  This helped get me going.  Here's a slightly modified version of your code above that is a little more flexible by allowing the query string to contain other values other than just the "album" parameter":

        /// <summary>
        /// Starts the slide show.
        /// </summary>
        public static void StartSlideShow()
        {
            if (System.Windows.Browser.HtmlPage.Document.QueryString.ContainsKey("album"))
            {
                string album = System.Windows.Browser.HtmlPage.Document.QueryString["album"];
                if (!String.IsNullOrEmpty(album))
                {
                    int i;
                    if (int.TryParse(album, out i))
                    {
                        SelectAlbum(i);
                        return;
                    }
                }
            }
            SelectAlbum(DataHandler.CurrentAlbumIndex);
        }
Developer
Jul 6, 2009 at 4:43 AM

Fixed in change set 25804. Note that the change set includes additional enhancements and bug fixes as well.

http://slideshow2.codeplex.com/SourceControl/changeset/view/25804

SlideShow can now be started in a specific album by specifying an album parameter in URL. You can also start on a specific slide by providing slideIndex parameter on URL as well.

Jul 6, 2009 at 8:39 AM

Hi,

thank you for include the changes in source.

What do you think about implementing the "select album by title"-feature from http://slideshow2.codeplex.com/Thread/View.aspx?ThreadId=61120 in a future release? I experienced that a new album with new photos will be added as first album (when having the albums ordered by date descending) - so all links to select a specific (older) album have to be modified.

Olaf

 

Developer
Jul 8, 2009 at 7:40 PM

Olaf,

I entered the select album by title as a new issue, and hope to add it soon.

http://slideshow2.codeplex.com/WorkItem/View.aspx?WorkItemId=3476

--Scott