Amazon.com AlbumViewer Application for Silverlight 2 Released

Back in the early days when Silverlight still had the WPF/e code name I put together a sample application that showed how to access album data from Amazon.com to display a 3D carousel.  When Silverlight 1 was released I upgraded it which was straightforward since JavaScript was used for just about everything anyway.  I’ve had a Silverlight 2 version available for a few months now but had to wait until the official release to make it available (and had some other priorities :-)).  The upgrade was quite a bit more involved this time around since I had to convert all of the JavaScript to C#.  It still went really smoothly although I’m certain that many improvements can be made. 

In addition to updating all of the code I also had to deal with issues accessing the Amazon.com data.  Silverlight 2 requires that remote sites have a cross-domain policy file at their root (a good thing that Flash applications have to deal with as well).  Amazon.com’s server has a crossdomain.xml file that works fine for REST calls but doesn’t currently have a compatible file that works for SOAP calls (that may certainly change in the future).  I ended up adding two data access classes into the Silverlight 2 project to deal with SOAP calls not working. 

The first class accesses the data using a standard Web Service proxy object and SOAP.  As mentioned, this class doesn’t currently work  due to the cross-domain issues mentioned.  The second class calls Amazon’s REST API and parses the XML data that’s returned using LINQ to XML.  Both of the classes implement an interface named IAmazonSearcher so that either one can be injected into the application quickly and easily.  If a SOAP-compatible cross-domain file is added to Amazon.com’s server in the future then the SOAP-capable class should work as well.

The application doesn’t look much different from the original version released a few years ago, but it does use all native Silverlight 2 controls as opposed to using HTML objects mixed with Silverlight objects.  Here’s what the new version looks like:

image

Those interested in the code can download it here.  I’m planning to put together some more detailed write-ups (or videos) about the application.  If you have a preference on written versus video let me know.

comments powered by Disqus

3 Comments

Comments have been disabled for this content.