Customizing with XML and a couple other issues

Nov 5, 2008 at 10:31 PM
I have my slideshow working using a builtin theme but have run into two issues. Which has resulted in a bunch of questions, but first my issues.

First, the display defaults to having the navigation bar and title bars visible and I want them hidden.
Second, the image preview likes to appear beneath the display window.  I have seen it work once :(

So I tried creating a custom configuration (I copied the example in the documentation) and was met with a black screen (see below for how I called the custom file).  Beyond it not working, I have a few questions. 

Does the xml configuration file require all parameters be set for each module or are there safe defaults?
Is it possible to load a theme then "overload" it with customizations?
Are there any working examples using a custom xml file that I can look at?

Is there any documentation for all the options available in the slideshow file?  All I have been able to find is what is in the quick install file, as the advanced one seems to exclusively deal with configuring the appearance/operation of the app.

+++++Here is how I am calling the object+++++

<object type="application/x-silverlight-2" data="data:application/x-silverlight-2," width="360" height="240">
<param name="background" value="black" />
<param name="source" value="Vertigo.SlideShow.xap" />
<param name="initParams" value="ConfigurationProvider=XmlConfigurationProvider;Path=configure.xml,DataProvider=XmlDataProvider;Path=slideshow.xml"/>
<param name="autoUpgrade" value="true" />
<a href="http://go.microsoft.com/fwlink/?LinkID=124807" style="text-decoration: none;"><img src="http://go.microsoft.com/fwlink/?LinkId=108181" alt="Get Microsoft Silverlight" style="border-style: none"/></a>
</object>

+++++++++++++++++++++++

++++++configure.xml++++++
This is a direct copy and past from the documentation.  I can include it or a link if necessary but it is rather long, so obmited it.
+++++++++++++++++++++

I have to be missing something as I have redone this a couple of times and I get the same results.  So I will assume I keep making the same mistakes.

Thank you for any help you can give me. 

aaron

Nov 12, 2008 at 12:35 PM
Hi,

there are some issues with the XmlConfigurationProvider. In client_DownloadStringCompleted you have to add one line:
   Options defaultOptions = DefaultTheme.Options; //existing line
   Options = DefaultTheme.Options; //new line
   #region [ General ] //existing line

And then replace every occurrance of
       ?? Options.
with
       ?? defaultOptions.

With this your config-file must not include all modules but only the ones you want to change from the default config (LightTheme).

Olaf
Nov 12, 2008 at 1:26 PM
Thank you, I will give that a go.

aaron
Nov 13, 2008 at 10:44 AM
Hello,

sorry, there are some other things that have to be changed: all regions have to be checked for default null values, i.e. the lines in (XmlConfigurationPrivider.cs client_DownloadStringCompleted):

    Options.AlbumPage = new Options.AlbumPageOptions()
    {
     Background =
      d.ContainsKey("Background") ?
      ParseBrush(d["Background"]) :
      null
    };

have to be changed to

    Options.AlbumPage = new Options.AlbumPageOptions()
    {
     Background =
      d.ContainsKey("Background") ?
      ParseBrush(d["Background"]) :
                        defaultOptions.AlbumPage.Background // changed line
    };

...and many other lines too...

Olaf
Jan 20, 2009 at 11:03 PM
I can't get the XmlConfigurationProvider to work at all.  Is there going to be a fix for this?
Jan 27, 2009 at 7:23 AM
Hello Chase,

the problem with the existing code ist that every option that is not contained in the xml file will be replaced with null:

    Background = d.ContainsKey("Background") ? ParseBrush(d["Background"]) : null

With this the background will be nothing and that doesn't work. So you have to search for every occurance of "null" in "client_DownloadStringCompleted" and replace it with the corresponding default option value:

    Background = d.ContainsKey("Background") ? ParseBrush(d["Background"]) : defaultOptions.AlbumPage.Background


Olaf
Jan 29, 2009 at 2:32 AM
Edited Jan 29, 2009 at 2:34 AM
This is the only one I can see

   #region [ General ]
   Options.General = new Options.GeneralOptions()
   {
    Background = ParseBrush(xmlOptions[string.Empty]["background"])
   };
   #endregion
Jan 29, 2009 at 2:40 AM
nm... I understand what you are saying now.  However I don't see where you are getting the "d.ContainsKey" from...
Jan 29, 2009 at 2:42 AM
Should it be more like this?

   Dictionary<string, Dictionary<string, string>> xmlOptions = new Dictionary<string, Dictionary<string, string>>();
   using (XmlReader reader = XmlReader.Create(new StringReader(e.Result)))
   {
    while (reader.Read())
    {
     if (reader.IsStartElement())
     {
      switch (reader.Name)
      {
       case "configuration":
        xmlOptions.Add(
         string.Empty,
         ParseRoot(reader));
        break;
       case "module":
        xmlOptions.Add(
         reader.GetAttribute("name"),
         ParseOptions(reader.ReadSubtree()));
        break;
      }
     }
    }
   }

   Options defaultOptions = DefaultTheme.Options;
   
   #region [ General ]
   Options.General = new Options.GeneralOptions()
   {
    Background = xmlOptions.ContainsKey("Background") ? ParseBrush(xmlOptions[string.Empty]["background"]) ? defaultOptions.AlbumPage.Background
   };
   #endregion

Jan 29, 2009 at 3:34 AM
sorry... I got it working... just had to actually "think" about your instructions.... works like a champ!!!
Apr 1, 2009 at 10:25 AM
Hi,

is there a patch that allow the XmlConfiguration to work?
I have tried the configuration file from the documentation, also several other "reduced" configuration files but non of them worked, except using the default provided themes.

many thanks, adi

Apr 1, 2009 at 1:58 PM
This thread should explain everything you need to do to do it yourself.

I patched mine using some direction from olafb, and it works like a champ.

You can find my patched xap file for download on my blog
http://www.dotnetblogger.com/post/2009/02/04/SlideShow2-Database-Config-(Singleton).aspx 



ultimately the answer lies in olafb's answer here...
"So you have to search for every occurance of "null" in "client_DownloadStringCompleted" and replace it with the corresponding default option value:"

    Background = d.ContainsKey("Background") ? ParseBrush(d["Background"]) : null
should be
    Background = d.ContainsKey("Background") ? ParseBrush(d["Background"]) : defaultOptions.AlbumPage.Background

along with every other instance of       ":null"
Apr 1, 2009 at 4:04 PM
thanks for your quick answer, but it was useless for me since with your pached .xap file the behaviour is the same - meaning the slideshow starts when i use

ConfigurationProvider=LightTheme (or any other theme provided)

but stops when i use

ConfigurationProvider=XmlConfigurationProvider;Path=config.xml

I have copy in the config.xml file all the code provided in the Slide.Show 2 Configuration Guide.doc and just disabled some modules or buttons.
Do you have a valid form for a config.xml?


Apr 1, 2009 at 4:29 PM
The demo I showed you can be seen in use at the following site
http://test.infinitas.ws/slideshow.aspx

and the config files (generated from the database) are here
http://test.infinitas.ws/SlideShowConfig.axd?ID=46
http://test.infinitas.ws/SlideShowData.axd?ID=46
Apr 1, 2009 at 5:04 PM
Thanks, i'll look on it.

rockinthesix wrote:

From: rockinthesix

The demo I showed you can be seen in use at the following site
http://test.infinitas.ws/slideshow.aspx

and the config files (generated from the database) are here
http://test.infinitas.ws/SlideShowConfig.axd?ID=46
http://test.infinitas.ws/SlideShowData.axd?ID=46


__________ Information from ESET NOD32 Antivirus, version of virus signature database 3980 (20090401) __________

The message was checked by ESET NOD32 Antivirus.

http://www.eset.com
Developer
Jul 6, 2009 at 4:48 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

Developer
Jul 7, 2009 at 7:17 PM

A new XML configuration sample has been added in change set 25845 that demonstrates how to use an xml configuration file to provide simple overrides of the default Light Theme:

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

Sep 6, 2009 at 3:13 AM
Edited Sep 6, 2009 at 3:16 AM

Hello,

this is my case:

<param name="initParams" value="ConfigurationProvider=XmlConfigurationProvider;Path=Configuration.xml,DataProvider=XmlDataProvider;Path=Data.xml" /> 

Configuration.xml file is below:

<?xml version="1.0" encoding="utf-8" ?>
<configuration background="Black">
<module name="EmbedViewer">
<option name="Enabled" value="false" />
</module>
<module name="ToggleEmbedViewButton">
<option name="Enabled" value="false" />
</module>
</configuration>

I tried both versions of Vertigo.SlideShow.xap: 25804 and 25845. I can see only black background with these settings. I checked  client_DownloadStringCompleted method in XmlConfigurationPrivider.cs and found no nulls there, everything seem to have valid defaults.

With ConfigurationProvider=LightTheme everything works fine.
Any Ideas?

Jan 31, 2010 at 12:46 AM

Did you ever get this figured out?  Have the same problem.  What was the solution?

Jun 23, 2011 at 8:44 PM

I started using SlideShow2 for the first time this morning and have spent the better part of a day dealing with this issue.  I have finally landed here and I am wondering if 17 months later there is an answer to Frank's question.  It might be useful to add that I am using Web Expression (3 this morning with an upgrade to 4 this afternoon).  To preview Silverlight I need to change the file extension to aspx and run on the localhost development server.  Do you think that this might be part of the problem?